From 065099b2b1b4bb6b2269b2ccd32295ca29b756ba Mon Sep 17 00:00:00 2001 From: gunshiz Date: Thu, 8 Oct 2026 21:22:14 +0700 Subject: [PATCH] fix : remove unused code --- components/public/section-drawer.tsx | 53 ------------------- components/site-install-button.tsx | 76 ---------------------------- 2 files changed, 129 deletions(-) delete mode 100644 components/public/section-drawer.tsx delete mode 100644 components/site-install-button.tsx diff --git a/components/public/section-drawer.tsx b/components/public/section-drawer.tsx deleted file mode 100644 index cfa20c3..0000000 --- a/components/public/section-drawer.tsx +++ /dev/null @@ -1,53 +0,0 @@ -"use client"; - -import { ListTreeIcon } from "lucide-react"; - -import { Button } from "@/components/ui/button"; -import { - Drawer, - DrawerClose, - DrawerContent, - DrawerDescription, - DrawerHeader, - DrawerTitle, - DrawerTrigger, -} from "@/components/ui/drawer"; - -export interface GuideSectionLink { - id: string; - label: string; -} - -export function SectionDrawer({ sections }: { sections: GuideSectionLink[] }) { - return ( -
- - }> - - - - สารบัญหน้านี้ - เลือกหัวข้อเพื่อเลื่อนไปยังเนื้อหา - - - - -
- ); -} diff --git a/components/site-install-button.tsx b/components/site-install-button.tsx deleted file mode 100644 index 74e0e56..0000000 --- a/components/site-install-button.tsx +++ /dev/null @@ -1,76 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; -import { DownloadIcon } from "lucide-react"; - -import { Button } from "@/components/ui/button"; -import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog"; - -type InstallEvent = Event & { - prompt: () => Promise; - userChoice: Promise<{ outcome: string }>; -}; - -export function SiteInstallButton() { - const [open, setOpen] = useState(false); - const [installed, setInstalled] = useState(false); - const [installEvent, setInstallEvent] = useState(null); - const [busy, setBusy] = useState(false); - const [error, setError] = useState(""); - - useEffect(() => { - const displayMode = window.matchMedia("(display-mode: standalone)"); - const frame = requestAnimationFrame(() => setInstalled(displayMode.matches || - (navigator as Navigator & { standalone?: boolean }).standalone === true)); - const beforeInstall = (event: Event) => { - event.preventDefault(); - setInstallEvent(event as InstallEvent); - }; - const onInstalled = () => { setInstalled(true); setOpen(false); setInstallEvent(null); }; - window.addEventListener("beforeinstallprompt", beforeInstall); - window.addEventListener("appinstalled", onInstalled); - return () => { - cancelAnimationFrame(frame); - window.removeEventListener("beforeinstallprompt", beforeInstall); - window.removeEventListener("appinstalled", onInstalled); - }; - }, []); - - async function install() { - if (!installEvent || busy) return; - setBusy(true); - setError(""); - try { - await installEvent.prompt(); - const result = await installEvent.userChoice; - setInstallEvent(null); - if (result.outcome === "accepted") setOpen(false); - } catch { setError("ติดตั้งไม่สำเร็จ กรุณาลองจากเมนูของเบราว์เซอร์"); } - finally { setBusy(false); } - } - - if (installed) return null; - - return <> - - - - - ติดตั้ง Buzz Guide - เพิ่มไกด์ลงหน้าจอหลักเพื่อเปิดอ่านได้สะดวก - - {!installEvent &&
-

บน iPhone/iPad เปิดใน Safari แตะปุ่มแชร์ แล้วเลือก “เพิ่มไปยังหน้าจอโฮม”

-

บน Android หรือคอมพิวเตอร์ เปิดเมนูของเบราว์เซอร์ แล้วเลือก “ติดตั้งแอป” หรือ “เพิ่มไปยังหน้าจอหลัก” หากมีตัวเลือกนี้

-
} - {error &&

{error}

} - - - {installEvent && } - -
-
- ; -}