add: preparation page setup

This commit is contained in:
purp1e
2024-09-21 01:05:40 +08:00
parent cb5a934fc7
commit d00c90b0f6
6 changed files with 60 additions and 29 deletions

View File

@@ -0,0 +1,3 @@
export default function Page() {
return <div>Users</div>
}

View File

@@ -5,16 +5,16 @@ import { useRouter } from "next/navigation";
const Home = () => { const Home = () => {
const router = useRouter(); const router = useRouter();
return ( return (
<main className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 items-center justify-center"> <main
<h1 className="text-4xl font-bold text-zinc-800">CS </h1> className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 items-center justify-center"
<button data-tauri-drag-region
onClick={() => router.push("/home")}
className="px-4 py-1 rounded bg-zinc-200"
> >
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS </h1>
<button onClick={() => router.push("/home")} className="px-4 py-1 rounded bg-zinc-200">
</button> </button>
</main> </main>
); )
}; };
export default Home; export default Home;

View File

@@ -0,0 +1,18 @@
import Nav from "@/components/window/Nav"
export default function BaseLayout({ children }: { children: React.ReactNode }) {
return (
<div className="bg-[#f1f0f2] h-full w-full">
<Nav />
<div className="flex flex-col w-full h-full">
<main
className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 p-6 items-center justify-center"
data-tauri-drag-region
>
{children}
</main>
</div>
</div>
)
}

11
src/app/prepare/page.tsx Normal file
View File

@@ -0,0 +1,11 @@
export default function Page() {
return (
<div
className="bg-[#f1f0f2] h-screen w-full flex flex-col gap-6 items-center justify-center"
data-tauri-drag-region
>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">CS工具箱</h1>
<p></p>
</div>
)
}

View File

@@ -1,44 +1,43 @@
"use client" "use client"
import { RocketOne, Minus, Close, Square } from "@icon-park/react"; import { RocketOne, Minus, Close, Square } from "@icon-park/react"
import { relaunch, exit } from "@tauri-apps/plugin-process"; import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window"
// import { invoke } from "@tauri-apps/api/core"; // import { invoke } from "@tauri-apps/api/core";
import { useRouter } from "next/navigation"
const Nav = () => { const Nav = () => {
const close = async () => { const close = async () => {
// (await window.hideOnClose) ? getCurrent().hide() : exit(); // (await window.hideOnClose) ? getCurrent().hide() : exit();
await exit(); await exit()
}; }
const minimize = () => { const minimize = () => {
getCurrentWindow() getCurrentWindow()
.minimize() .minimize()
.then(() => { .then(() => {
console.log("minimized"); console.log("minimized")
}) })
.catch((err: unknown) => { .catch((err: unknown) => {
console.error(err); console.error(err)
}); })
}; }
const toggleMaximize = async () => { const toggleMaximize = async () => {
const current = getCurrentWindow() const current = getCurrentWindow()
const maximized = await current.isMaximized() const maximized = await current.isMaximized()
maximized ? current.unmaximize() : current.maximize() await (maximized ? current.unmaximize() : current.maximize())
} }
const reset = async () => { // const reset = async () => {
await relaunch(); // await relaunch()
}; // }
const router = useRouter()
return ( return (
<nav <nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4"
data-tauri-drag-region
>
<button <button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95" className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={reset} onClick={() => router.push("/prepare")}
> >
<RocketOne size={16} /> <RocketOne size={16} />
</button> </button>
@@ -61,7 +60,7 @@ const Nav = () => {
<Close size={16} /> <Close size={16} />
</button> </button>
</nav> </nav>
); )
}; }
export default Nav; export default Nav

View File

@@ -34,7 +34,7 @@ const Avatar = () => {
const router = useRouter(); const router = useRouter();
return ( return (
<div onClick={() => router.push('/test')} className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer"> <div onClick={() => router.push('/users')} className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer">
<img src="favicon.ico" alt="avatar" draggable={false} /> <img src="favicon.ico" alt="avatar" draggable={false} />
</div> </div>
); );