diff --git a/app/(main)/ClientComponents/LiveTag.tsx b/app/(main)/ClientComponents/LiveTag.tsx deleted file mode 100644 index 46cba27..0000000 --- a/app/(main)/ClientComponents/LiveTag.tsx +++ /dev/null @@ -1,43 +0,0 @@ -"use client"; -import { useEffect, useState } from "react"; -import { toast } from "sonner"; - -import { Badge } from "@/components/ui/badge"; -import { verifySSEConnection } from "@/lib/sseFetch"; - -export default function LiveTag() { - const [connected, setConnected] = useState(false); - - useEffect(() => { - // Store the promise in a variable - const ssePromise = verifySSEConnection( - "https://home.buycoffee.tech/v2/VerifySSEConnect", - ); - setTimeout(() => { - toast.promise(ssePromise, { - loading: "Connecting to SSE...", - success: "HomeDash SSE Connected", - error: "Error connecting to SSE", - }); - }); - // Handle promise resolution separately - ssePromise - .then(() => { - setConnected(true); - }) - .catch(() => { - setConnected(false); - }); - }, []); - - return connected ? ( - - Synced - - - ) : ( - - Static - - ); -} diff --git a/app/layout.tsx b/app/layout.tsx index da61a5f..5ad011a 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -5,7 +5,6 @@ import { Inter as FontSans } from "next/font/google"; import { ThemeProvider } from "next-themes"; import React from "react"; -import NextThemeToaster from "@/components/client/NextToast"; import { cn } from "@/lib/utils"; const fontSans = FontSans({ @@ -43,7 +42,6 @@ export default function RootLayout({ children }: RootLayoutProps) { enableSystem disableTransitionOnChange > - {children} diff --git a/bun.lockb b/bun.lockb index 3474d36..6b1439a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/client/NextToast.tsx b/components/client/NextToast.tsx deleted file mode 100644 index 6a94343..0000000 --- a/components/client/NextToast.tsx +++ /dev/null @@ -1,27 +0,0 @@ -"use client"; -import { useTheme } from "next-themes"; -import React from "react"; -import { Toaster } from "sonner"; - -type ThemeType = "light" | "dark" | "system"; // 声明 theme 的类型 -export default function NextThemeToaster() { - const { theme } = useTheme(); - const themeMap: Record = { - light: "light", - dark: "dark", - system: "system", - }; - - // 使用类型断言确保theme是一个ThemeType - const selectedTheme = theme ? themeMap[theme as ThemeType] : "system"; - - return ( - - ); -} diff --git a/components/client/client-side-refresh.tsx b/components/client/client-side-refresh.tsx deleted file mode 100644 index 2a0cfd8..0000000 --- a/components/client/client-side-refresh.tsx +++ /dev/null @@ -1,18 +0,0 @@ -"use client"; -import { useRouter } from "next/navigation"; -import { useEffect } from "react"; - -type ClientSideRefreshProps = { - timeMs: number; -}; -export default function ClientSideRefresh({ timeMs }: ClientSideRefreshProps) { - const router = useRouter(); - useEffect(() => { - const interval = setInterval(() => { - router.refresh(); - }, timeMs); - return () => clearInterval(interval); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - return null; -} diff --git a/components/client/theme-switcher.tsx b/components/client/theme-switcher.tsx deleted file mode 100644 index 95a59f6..0000000 --- a/components/client/theme-switcher.tsx +++ /dev/null @@ -1,40 +0,0 @@ -"use client"; - -import { Moon, Sun } from "lucide-react"; -import { useTheme } from "next-themes"; -import * as React from "react"; - -import { Button } from "@/components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "@/components/ui/dropdown-menu"; - -export function ModeToggle() { - const { setTheme } = useTheme(); - - return ( - - - - - - setTheme("light")}> - Light - - setTheme("dark")}> - Dark - - setTheme("system")}> - System - - - - ); -} diff --git a/package.json b/package.json index 17b36e6..c03e08e 100644 --- a/package.json +++ b/package.json @@ -33,17 +33,15 @@ "react-intersection-observer": "^9.8.2", "react-wrap-balancer": "^1.1.0", "sharp": "^0.33.3", - "sonner": "^1.4.41", "swr": "^2.2.6-beta.4", "tailwind-merge": "^2.2.2", - "tailwindcss-animate": "^1.0.7", - "zod": "^3.22.4" + "tailwindcss-animate": "^1.0.7" }, "devDependencies": { "eslint-plugin-turbo": "^2.0.3", "eslint-plugin-unused-imports": "^4.0.0", "@next/bundle-analyzer": "^14.1.4", - "@types/node": "^20.12.4", + "@types/node": "^22.0.0", "@types/react": "^18.2.74", "@types/react-dom": "^18.2.24", "autoprefixer": "^10.4.19",