import { Link } from 'react-router'; import { useClient } from 'hooks/useClient'; import { PERSON_PARAM, QUERY_PARAM, personThumbUrl, photosSectionPath, thumbUrl } from './shared'; import { useExplore, usePeople } from './usePhotosData'; // Explore: the faces row, then whatever Immich has clustered the library by — places and things. // // Immich's own explore tiles link to a structured search (`{"city":"Lisbon"}`). This proxy exposes smart and // metadata search only, so a tile links to a smart search for its label instead. Close in spirit, and honest // about it: a city tile finds photos that LOOK like that city rather than ones tagged with it. const SECTION_TITLES: Record = { 'exifInfo.city': 'Places', 'exifInfo.country': 'Countries', 'smartInfo.objects': 'Things', 'exifInfo.state': 'Regions', }; export const ExploreSection = () => { const { token } = useClient(); const { data: explore, isLoading } = useExplore(); const { data: people } = usePeople(); const faces = (people?.people ?? []).filter((person) => person.name).slice(0, 12); return (

Explore

{faces.length > 0 && (

People

View all
{faces.map((person) => ( {person.name} ))}
)} {isLoading &&

Loading…

} {(explore ?? []).map((section) => (

{SECTION_TITLES[section.fieldName] ?? section.fieldName}

{section.items.map((item) => ( {item.value} ))}
))} {!isLoading && (explore ?? []).length === 0 && faces.length === 0 && (

Nothing to explore yet.

)}
); };