diff --git a/frontend/src/components/MediaViewer/MediaViewer.tsx b/frontend/src/components/MediaViewer/MediaViewer.tsx index 8177338..e199adf 100644 --- a/frontend/src/components/MediaViewer/MediaViewer.tsx +++ b/frontend/src/components/MediaViewer/MediaViewer.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { api, type BrowseEntry, type MediaItem } from "../../api/client"; import TagPanel from "../TagPanel/TagPanel"; @@ -11,6 +11,8 @@ interface Props { } export default function MediaViewer({ mediaId, siblings, onClose, onNavigate }: Props) { + const [showTags, setShowTags] = useState(true); + const { data: item } = useQuery({ queryKey: ["media", mediaId], queryFn: () => api.media.get(mediaId), @@ -32,74 +34,80 @@ export default function MediaViewer({ mediaId, siblings, onClose, onNavigate }: }, [prevId, nextId, onClose, onNavigate]); return ( -
+ <> + {/* Backdrop */} +
+ + {/* Prev */} + + + {/* Next */} + + + {/* Media card */}
e.stopPropagation()} - style={{ - display: "flex", gap: 16, background: "#1a1a1a", borderRadius: 8, - padding: 16, maxWidth: "95vw", maxHeight: "95vh", overflow: "auto", - }} + style={{ position: "fixed", top: "50%", left: "50%", transform: "translate(-50%, -50%)", zIndex: 101, background: "#1a1a1a", borderRadius: 8, padding: 16, display: "flex", flexDirection: "column", alignItems: "center", gap: 12, maxWidth: "80vw", maxHeight: "90vh", overflow: "auto" }} > - {/* Prev */} - - - {/* Media */} -
- {item?.filename && ( -
{item.filename}
- )} - {item?.media_type === "image" && ( - {item.filename} - )} - {item?.media_type === "video" && ( -
- - {/* Next */} - - - {/* Tag panel */} - {item && ( -
- -
+ {item?.filename && ( +
{item.filename}
)} + {item?.media_type === "image" && ( + {item.filename} + )} + {item?.media_type === "video" && ( +
- {/* Close */} + {/* Top-right controls */} +
+
-
+ + {/* Tag panel */} + {showTags && item && ( +
e.stopPropagation()} + style={{ position: "fixed", top: 0, right: 0, height: "100%", width: 260, background: "#1a1a1a", borderLeft: "1px solid #333", padding: "48px 16px 16px", zIndex: 101, overflowY: "auto" }} + > + +
+ )} + ); }