Files
cstb-next/src/app/page.tsx
2025-03-12 22:20:06 +08:00

47 lines
1.1 KiB
TypeScript

"use client"
import { open } from "@tauri-apps/plugin-dialog"
import { useRouter } from "next/navigation"
import React from "react"
const Home = () => {
const router = useRouter()
const [file, setFile] = React.useState<string | null>("")
const openFile = async () => {
const filePath = await open({
multiple: true,
directory: false,
})
setFile(filePath?.join("\n") || " ")
}
return (
<main
className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region
>
<h1 className="text-4xl font-bold tracking-wide text-zinc-800">
CS
</h1>
<button
type="button"
onClick={() => router.push("/home")}
className="px-4 py-1 rounded bg-zinc-200"
>
</button>
<button
type="button"
onClick={openFile}
className="px-4 py-1 text-white bg-blue-500 rounded"
>
</button>
<p className="text-center bg-zinc-50">{file}</p>
</main>
)
}
export default Home