import { ParsedSearch, searchModeLabel, useGalleryStore } from "../../store"; import { FolderScopeDropdown } from "../FolderScopeDropdown"; export function ToolbarTitle({ parsedSearch }: { parsedSearch: ParsedSearch }) { const search = useGalleryStore((state) => state.search); const totalImages = useGalleryStore((state) => state.totalImages); const loadedCount = useGalleryStore((state) => state.loadedCount); const selectedFolderId = useGalleryStore((state) => state.selectedFolderId); const collectionTitle = useGalleryStore((state) => state.collectionTitle); const folders = useGalleryStore((state) => state.folders); const activeView = useGalleryStore((state) => state.activeView); const selectedFolder = folders.find((folder) => folder.id === selectedFolderId); const title = collectionTitle ?? (selectedFolder ? selectedFolder.name : "All Media"); const hasActiveSearch = search.trim().length > 0; return ( <>

{title}

{loadedCount < totalImages ? `${loadedCount.toLocaleString()} / ${totalImages.toLocaleString()}` : totalImages.toLocaleString()} {hasActiveSearch ? ( {searchModeLabel(parsedSearch.mode)} ) : null}
{activeView === "timeline" ? : null} ); }