From 3e89d2998588f8e35c524e523ba2ee853f0f6475 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Mon, 20 Apr 2026 11:31:17 +0200 Subject: refactor: restructure files to their domains, new preview overlay system, and dep graph --- apps/web/src/hooks/use-font-atlas.ts | 53 ------------------------------------ 1 file changed, 53 deletions(-) delete mode 100644 apps/web/src/hooks/use-font-atlas.ts (limited to 'apps/web/src/hooks/use-font-atlas.ts') diff --git a/apps/web/src/hooks/use-font-atlas.ts b/apps/web/src/hooks/use-font-atlas.ts deleted file mode 100644 index aa48f3b4..00000000 --- a/apps/web/src/hooks/use-font-atlas.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { useState, useMemo, useCallback, useEffect } from "react"; -import { - getCachedFontAtlas, - loadFontAtlas, - clearFontAtlasCache, -} from "@/lib/fonts/google-fonts"; -import type { FontAtlas } from "@/lib/fonts/types"; -import { SYSTEM_FONTS } from "@/lib/fonts/system-fonts"; - -type Status = "idle" | "loading" | "error"; - -export function useFontAtlas({ open }: { open: boolean }) { - const [atlas, setAtlas] = useState(() => - getCachedFontAtlas(), - ); - const [status, setStatus] = useState(() => - getCachedFontAtlas() ? "idle" : "loading", - ); - - useEffect(() => { - if (!open || atlas) return; - - setStatus("loading"); - loadFontAtlas().then((data) => { - if (data) { - setAtlas(data); - setStatus("idle"); - } else { - setStatus("error"); - } - }); - }, [open, atlas]); - - const retry = useCallback(() => { - clearFontAtlasCache(); - setStatus("loading"); - loadFontAtlas().then((data) => { - if (data) { - setAtlas(data); - setStatus("idle"); - } else { - setStatus("error"); - } - }); - }, []); - - const fontNames = useMemo(() => { - if (!atlas) return []; - return [...Object.keys(atlas.fonts), ...SYSTEM_FONTS].sort(); - }, [atlas]); - - return { atlas, status, fontNames, retry }; -} -- cgit v1.3.1