[feat] use heroui + setup persistore + setup toast
todo: fix launchoption problem
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import Header from "@/components/window/Header"
|
||||
import Nav from "@/components/window/Nav"
|
||||
import SideBar from "@/components/window/SideBar"
|
||||
import clsx from "clsx"
|
||||
import { cn } from "@heroui/react"
|
||||
// import { platform } from "@tauri-apps/plugin-os"
|
||||
|
||||
export default function BaseLayout({
|
||||
@@ -11,7 +11,7 @@ export default function BaseLayout({
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<div className="w-full h-full bg-transparent">
|
||||
<div className="w-full h-full p-0 m-0 bg-transparent">
|
||||
{/* bg-[#f1f0f2] */}
|
||||
<Nav />
|
||||
|
||||
@@ -19,7 +19,7 @@ export default function BaseLayout({
|
||||
<SideBar />
|
||||
|
||||
<main
|
||||
className={clsx(
|
||||
className={cn(
|
||||
"flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden",
|
||||
// platform() === "windows" ? "ml-20" : "ml-[4.25rem]"
|
||||
)}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
"use client"
|
||||
import useAppStore from "@/store/app"
|
||||
import { appStore } from "@/store/app"
|
||||
import { useSnapshot } from "valtio"
|
||||
|
||||
export default function Page() {
|
||||
const app = useAppStore()
|
||||
const app = useSnapshot(appStore.state)
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
|
||||
<div className="flex flex-col gap-3 items-start pt-2 pb-1">
|
||||
<p>版本号:{app.version}</p>
|
||||
<p>是否有更新:{app.hasUpdate ? "有" : "无"}</p>
|
||||
<p>初始化:{app.inited ? "是" : "否"}</p>
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
UploadOne,
|
||||
Videocamera,
|
||||
} from "@icon-park/react"
|
||||
import clsx from "clsx"
|
||||
import { cn } from "@heroui/react"
|
||||
import { usePathname, useRouter } from "next/navigation"
|
||||
// import { platform } from "@tauri-apps/plugin-os"
|
||||
|
||||
@@ -30,21 +30,21 @@ export default function PreferenceLayout({
|
||||
<CardIcon
|
||||
type="menu"
|
||||
onClick={() => router.push("/preference/general")}
|
||||
className={clsx(pathname === "/preference/general" && "bg-black/5")}
|
||||
className={cn(pathname === "/preference/general" && "bg-black/5")}
|
||||
>
|
||||
<SettingConfig /> 通用
|
||||
</CardIcon>
|
||||
<CardIcon
|
||||
type="menu"
|
||||
onClick={() => router.push("/preference/path")}
|
||||
className={clsx(pathname === "/preference/path" && "bg-black/5")}
|
||||
className={cn(pathname === "/preference/path" && "bg-black/5")}
|
||||
>
|
||||
<AssemblyLine /> 路径
|
||||
</CardIcon>
|
||||
<CardIcon
|
||||
type="menu"
|
||||
onClick={() => router.push("/preference/replay")}
|
||||
className={clsx(pathname === "/preference/replay" && "bg-black/5")}
|
||||
className={cn(pathname === "/preference/replay" && "bg-black/5")}
|
||||
>
|
||||
<Videocamera /> 录像
|
||||
</CardIcon>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import "@/styles/globals.css"
|
||||
import type { AppProps } from "next/app"
|
||||
|
||||
function MyApp({ Component, pageProps }: AppProps) {
|
||||
return <Component {...pageProps} />
|
||||
}
|
||||
|
||||
export default MyApp
|
||||
@@ -1,10 +1,12 @@
|
||||
export const metadata = {
|
||||
title: "CS工具箱",
|
||||
description: "Generated by Next.js",
|
||||
icons: ["/favicon.ico"],
|
||||
}
|
||||
"use client"
|
||||
// export const metadata = {
|
||||
// title: "CS工具箱",
|
||||
// description: "Generated by Next.js",
|
||||
// icons: ["/favicon.ico"],
|
||||
// }
|
||||
|
||||
import "./globals.css"
|
||||
import Providers from "./providers"
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
@@ -13,7 +15,9 @@ export default function RootLayout({
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
<body>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
||||
12
src/app/providers.tsx
Normal file
12
src/app/providers.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
"use client"
|
||||
import { HeroUIProvider } from "@heroui/react"
|
||||
import { ToastProvider } from "@heroui/toast"
|
||||
|
||||
export default function Providers({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<HeroUIProvider className="h-full bg-transparent">
|
||||
<ToastProvider toastOffset={10} placement="top-center" />
|
||||
{children}
|
||||
</HeroUIProvider>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user