import { useState } from "react"; import { open } from "@tauri-apps/plugin-dialog"; import { useGalleryStore } from "../../store"; import { FakeTile } from "./fakes"; export function StepAddLibrary() { const folders = useGalleryStore((s) => s.folders); const addFolder = useGalleryStore((s) => s.addFolder); const [adding, setAdding] = useState(false); const [addError, setAddError] = useState(null); const handlePick = async () => { setAddError(null); const selected = await open({ directory: true, multiple: false, title: "Select Media Folder" }); if (typeof selected !== "string") return; setAdding(true); try { await addFolder(selected); } catch (error) { setAddError(error instanceof Error ? error.message : String(error)); } finally { setAdding(false); } }; return (

A library is just a folder on disk — Phokus watches it and keeps itself in sync as files are added, renamed, or removed. Nothing is moved or copied.

{folders.length > 0 ? ( <>

{folders.length === 1 ? `“${folders[0].name}” added` : `${folders.length} folders in your library`}

Indexing runs in the background — you can add more folders from the sidebar any time.

) : ( <>

Add your first folder

Pick somewhere with photos or videos. You can add more later from the sidebar.

)} {addError ?

{addError}

: null}

As indexing runs, the gallery fills in roughly like this — tiles appear immediately and sharpen as thumbnails are generated:

); }