diff --git a/.eslintrc.json b/.eslintrc.json index 25012b4..dc8c474 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -49,6 +49,8 @@ "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/prefer-nullish-coalescing": "off", "@typescript-eslint/no-unsafe-member-access": "warn", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-unused-vars": "warn", "jsx-a11y/click-events-have-key-events": "off" } } \ No newline at end of file diff --git a/.gitignore b/.gitignore index e7334f4..df9ac71 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ yarn-error.log* # typescript *.tsbuildinfo + +.env +.env.* \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index 53997d5..0a8b540 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 8629df7..e6c19f6 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,15 @@ "tauri": "tauri", "build": "tauri build", "dev": "tauri dev", - "lint": "next lint && biome check src/", - "fix": "next lint --fix && biome check src/ --write", + "lint": "next lint", + "fix": "next lint --fix", "prepare": "husky" }, "dependencies": { "@heroui/react": "^2.7.5", "@icon-park/react": "^1.4.2", "@reactuses/core": "6.0.1", + "@supabase/ssr": "^0.5.2", "@tauri-apps/api": "2.1.0", "@tauri-apps/plugin-clipboard-manager": "2.0.0", "@tauri-apps/plugin-dialog": "~2.2.0", @@ -38,6 +39,7 @@ "next-themes": "^0.4.6", "react": "^19.0.0", "react-dom": "^19.0.0", + "swr": "^2.3.3", "tauri-plugin-system-info-api": "^2.0.9", "tauri-plugin-valtio": "1.1.1", "throttle-debounce": "^5.0.2", diff --git a/src/app/(main)/console/cfgx/page.tsx b/src/app/(main)/console/cfgx/page.tsx new file mode 100644 index 0000000..d1a56f1 --- /dev/null +++ b/src/app/(main)/console/cfgx/page.tsx @@ -0,0 +1,92 @@ +"use client" + +import { createClient } from "@/utils/supabase/client" +import { Chip, Code, Skeleton } from "@heroui/react" +import useSWR from "swr" + +export default function Page() { + return +} + +function CfgxList() { + const noticeFetcher = async () => { + const supabase = createClient() + const { data /* , error */ } = await supabase + .from("CFGX") + .select( + "created_at, updated_at, cfgx_version, title, description, version, author, content, alias_list, key_list, value_list", + ) + .order("created_at", { ascending: false }) + + return data as CfgxCardProps[] + } + + const { data: cfgx /* , error */, isLoading } = useSWR( + "/api/cfgx", + noticeFetcher, + ) + + if (isLoading) + return [1, 2, 3].map((id) => ( + +
+ + )) + + return ( +
    + {cfgx?.map((cfgx) => ( + + ))} +
+ ) +} + +interface CfgxCardProps { + created_at: string + updated_at: string + cfgx_version: string + title: string + description: string + version: string + author: string + content: string + alias_list?: { + id: string + info: string + value: string + } + key_list?: { + id: string + info: string + value: string + } + value_list?: { + id: string + info: string + value: string + } +} + +function CfgxCard(props: CfgxCardProps) { + return ( +
  • + +

    {props.title}

    + + {props.version} + + + {props.author} + +
    +

    {props.description}

    + {props.content} + {props.alias_list && ( +

    + {props.alias_list.id} {props.alias_list.info} {props.alias_list.value} +

    + )} +
  • + ) +} diff --git a/src/app/(main)/console/layout.tsx b/src/app/(main)/console/layout.tsx new file mode 100644 index 0000000..6189fbb --- /dev/null +++ b/src/app/(main)/console/layout.tsx @@ -0,0 +1,52 @@ +"use client" +import { Card, CardBody, CardHeader, CardIcon } from "@/components/window/Card" +import { cn } from "@heroui/react" +import { SettingConfig } from "@icon-park/react" +import { usePathname, useRouter } from "next/navigation" + +export default function PreferenceLayout({ + children, +}: { children: React.ReactNode }) { + const router = useRouter() + const pathname = usePathname() + + return ( + + + router.push("/console/cfgx")} + className={cn(pathname === "/console/cfgx" && "bg-black/5")} + > + CFGX + + {/* router.push("/console/path")} + className={cn(pathname === "/console/path" && "bg-black/5")} + > + 路径 + + router.push("/console/replay")} + className={cn(pathname === "/console/replay" && "bg-black/5")} + > + 录像 + */} + + {/* + + + 云同步 + + + + 保存 + + */} + + {children} + + ) +} diff --git a/src/app/(main)/console/page.tsx b/src/app/(main)/console/page.tsx index cf9ae48..76885a6 100644 --- a/src/app/(main)/console/page.tsx +++ b/src/app/(main)/console/page.tsx @@ -1,4 +1,6 @@ "use client" +import { redirect } from "next/navigation" + export default function Page() { - return
    Console
    + redirect("/console/cfgx") } diff --git a/src/app/prepare/layout.tsx b/src/app/prepare/layout.tsx index 5b62d6d..ef3079b 100644 --- a/src/app/prepare/layout.tsx +++ b/src/app/prepare/layout.tsx @@ -1,7 +1,9 @@ "use client" import Nav from "@/components/window/Nav" -export default function BaseLayout({ children }: { children: React.ReactNode }) { +export default function BaseLayout({ + children, +}: { children: React.ReactNode }) { return (