diff --git a/src/components/mixed/ImageLightbox.tsx b/src/components/mixed/ImageLightbox.tsx index f3ec6f4..22ad6b3 100644 --- a/src/components/mixed/ImageLightbox.tsx +++ b/src/components/mixed/ImageLightbox.tsx @@ -12,11 +12,15 @@ interface Props { itemKey?: string onTagsChanged?: () => void onAiTag?: () => Promise + showTags?: boolean + onShowTagsChange?: (v: boolean) => void } -export default function ImageLightbox({ url, name, onClose, onPrev, onNext, itemKey, onTagsChanged, onAiTag }: Props) { +export default function ImageLightbox({ url, name, onClose, onPrev, onNext, itemKey, onTagsChanged, onAiTag, showTags: showTagsProp, onShowTagsChange }: Props) { const overlayRef = useRef(null) - const [showTags, setShowTags] = useState(false) + const [showTagsLocal, setShowTagsLocal] = useState(false) + const showTags = showTagsProp ?? showTagsLocal + const setShowTags = onShowTagsChange ?? setShowTagsLocal const [aiTagging, setAiTagging] = useState(false) const [aiTagError, setAiTagError] = useState(null) const [tagRefreshKey, setTagRefreshKey] = useState(0) diff --git a/src/components/mixed/MixedView.tsx b/src/components/mixed/MixedView.tsx index 3f9999d..a543a14 100644 --- a/src/components/mixed/MixedView.tsx +++ b/src/components/mixed/MixedView.tsx @@ -27,6 +27,7 @@ export default function MixedView({ libraryId, initialPath }: Props) { const [loading, setLoading] = useState(true) const [error, setError] = useState(null) const [modal, setModal] = useState(null) + const [modalShowTags, setModalShowTags] = useState(false) const [tagPanel, setTagPanel] = useState(null) const [search, setSearch] = useState('') const [selectedTagIds, setSelectedTagIds] = useState>(new Set()) @@ -533,9 +534,11 @@ export default function MixedView({ libraryId, initialPath }: Props) { name={modal.name} itemKey={modal.itemKey} onTagsChanged={() => { setFilterRefreshKey((k) => k + 1); fetchAssignments() }} - onClose={() => setModal(null)} + onClose={() => { setModal(null); setModalShowTags(false) }} onPrev={modal.mediaIndex > 0 ? () => navigateModal(-1) : undefined} onNext={modal.mediaIndex < mediaEntries.length - 1 ? () => navigateModal(1) : undefined} + showTags={modalShowTags} + onShowTagsChange={setModalShowTags} onAiTag={modal.itemKey ? async () => { const res = await fetch('/api/ai-tagging', { method: 'POST', @@ -557,9 +560,11 @@ export default function MixedView({ libraryId, initialPath }: Props) { name={modal.name} itemKey={modal.itemKey} onTagsChanged={() => { setFilterRefreshKey((k) => k + 1); fetchAssignments() }} - onClose={() => setModal(null)} + onClose={() => { setModal(null); setModalShowTags(false) }} onPrev={modal.mediaIndex > 0 ? () => navigateModal(-1) : undefined} onNext={modal.mediaIndex < mediaEntries.length - 1 ? () => navigateModal(1) : undefined} + showTags={modalShowTags} + onShowTagsChange={setModalShowTags} onAiTag={async () => { const res = await fetch('/api/ai-tagging', { method: 'POST', diff --git a/src/components/mixed/VideoPlayerModal.tsx b/src/components/mixed/VideoPlayerModal.tsx index 4f5b0ed..b6b82e3 100644 --- a/src/components/mixed/VideoPlayerModal.tsx +++ b/src/components/mixed/VideoPlayerModal.tsx @@ -14,16 +14,20 @@ interface Props { onTagsChanged?: () => void onAiTag?: () => Promise context?: 'mixed' | 'movies' | 'tv' + showTags?: boolean + onShowTagsChange?: (v: boolean) => void } -export default function VideoPlayerModal({ url, name, onClose, onPrev, onNext, itemKey, onTagsChanged, onAiTag, context = 'mixed' }: Props) { +export default function VideoPlayerModal({ url, name, onClose, onPrev, onNext, itemKey, onTagsChanged, onAiTag, context = 'mixed', showTags: showTagsProp, onShowTagsChange }: Props) { const settings = useUserSettings() const autoPlay = context === 'mixed' ? settings.mixedAutoplay : context === 'movies' ? settings.moviesAutoplay : settings.tvAutoplay const loop = context === 'mixed' ? settings.mixedLoop : context === 'movies' ? settings.moviesLoop : settings.tvLoop const muted = context === 'mixed' ? settings.mixedMuted : context === 'movies' ? settings.moviesMuted : settings.tvMuted const overlayRef = useRef(null) - const [showTags, setShowTags] = useState(false) + const [showTagsLocal, setShowTagsLocal] = useState(false) + const showTags = showTagsProp ?? showTagsLocal + const setShowTags = onShowTagsChange ?? setShowTagsLocal const [aiTagging, setAiTagging] = useState(false) const [aiTagError, setAiTagError] = useState(null) const [tagRefreshKey, setTagRefreshKey] = useState(0)