feat(onboarding): guided first-run tour with background FFmpeg provisioning
Phase 5 of the 0.1.0 release prep: - FFmpeg no longer blocks startup (or crashes the app offline): provisioning runs in a background thread emitting throttled ffmpeg-progress events, with installed/downloading/failed state queryable via get_ffmpeg_status and a retry command - video jobs are invisible to claiming and tier-priority checks until FFmpeg is ready, so they wait as pending without failing — and without starving image embeddings/tagging (include_videos gating in db.rs) - 7-step show-don't-tell onboarding wizard: welcome + live FFmpeg progress, real first-folder picker, faked animating pipeline bar, placeholder gallery tiles, cycling search-syntax demo, views overview, and an AI features step with a real opt-in tagger download - skippable at every point (Escape included), persisted via settings/onboarding_completed.txt, re-runnable from Settings > General, which also gains an FFmpeg status/retry row
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
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<string | null>(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 (
|
||||
<div>
|
||||
<p className="text-sm leading-relaxed text-gray-300">
|
||||
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.
|
||||
</p>
|
||||
|
||||
<div className="mt-5 flex items-center justify-between gap-6 border-y border-white/[0.05] py-4">
|
||||
<div className="min-w-0">
|
||||
{folders.length > 0 ? (
|
||||
<>
|
||||
<p className="text-sm text-white">
|
||||
{folders.length === 1 ? `“${folders[0].name}” added` : `${folders.length} folders in your library`}
|
||||
</p>
|
||||
<p className="mt-1 text-xs text-gray-500">
|
||||
Indexing runs in the background — you can add more folders from the sidebar any time.
|
||||
</p>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="text-sm text-white">Add your first folder</p>
|
||||
<p className="mt-1 text-xs text-gray-500">
|
||||
Pick somewhere with photos or videos. You can add more later from the sidebar.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{addError ? <p className="mt-1.5 text-xs text-amber-300/90">{addError}</p> : null}
|
||||
</div>
|
||||
<button
|
||||
className="shrink-0 rounded-md border border-emerald-400/35 bg-emerald-500/15 px-3 py-1.5 text-xs text-emerald-200 transition-colors hover:bg-emerald-500/25 disabled:cursor-not-allowed disabled:opacity-45"
|
||||
onClick={() => void handlePick()}
|
||||
disabled={adding}
|
||||
>
|
||||
{adding ? "Adding..." : folders.length > 0 ? "Add another folder" : "Choose a folder"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p className="mt-5 text-xs leading-relaxed text-gray-500">
|
||||
As indexing runs, the gallery fills in roughly like this — tiles appear immediately and sharpen
|
||||
as thumbnails are generated:
|
||||
</p>
|
||||
<div className="mt-3 grid grid-cols-6 gap-1.5">
|
||||
<FakeTile index={0} />
|
||||
<FakeTile index={1} favorite />
|
||||
<FakeTile index={2} duration="0:42" />
|
||||
<FakeTile index={3} rating={4} />
|
||||
<FakeTile index={4} loaded={false} />
|
||||
<FakeTile index={5} loaded={false} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user