diff --git a/.eslintrc.json b/.eslintrc.json index 4ebc1d6..9606732 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,6 +24,13 @@ "prefer-spread": "error", "prefer-template": "error", "radix": ["error", "always"], - "react-hooks/exhaustive-deps": "error" + "react-hooks/exhaustive-deps": "error", + "@typescript-eslint/no-misused-promises": [ + "error", + { + "checksVoidReturn": false + } + ], + "@typescript-eslint/no-confusing-void-expression":"off" } } diff --git a/next-env.d.ts b/next-env.d.ts index a4a7b3f..40c3d68 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information. diff --git a/package.json b/package.json index d13c3a3..4ba2a6a 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "tauri-nextjs-template", - "version": "0.1.0", + "name": "cstb-next", + "version": "0.0.1", "private": true, "author": { - "name": "Your Name Here", - "email": "your-email-here@example.com" + "name": "Purp1e", + "email": "zx8244@qq.com" }, "scripts": { "next-start": "cross-env BROWSER=none next dev", @@ -27,7 +27,6 @@ "@tauri-apps/plugin-os": "2.0.0-rc.1", "@tauri-apps/plugin-process": "2.0.0-rc.1", "@tauri-apps/plugin-shell": "2.0.0-rc.1", - "clsx": "^2.1.1", "next": "^14.2.13", "react": "^18.3.1", "react-dom": "^18.3.1" @@ -46,6 +45,7 @@ "@typescript-eslint/eslint-plugin": "^8.6.0", "@typescript-eslint/parser": "^8.6.0", "autoprefixer": "^10.4.20", + "clsx": "^2.1.1", "cross-env": "^7.0.3", "cssnano": "^7.0.6", "eslint": "^8.57.1", @@ -55,11 +55,16 @@ "postcss": "^8.4.47", "postcss-import": "^16.1.0", "postcss-nesting": "^13.0.0", + "tailwind-merge": "^2.5.2", "tailwindcss": "^3.4.12", "typescript": "^5.6.2" }, "browserslist": { - "production": [">0.2%", "not dead", "not op_mini all"], + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], "development": [ "last 1 chrome version", "last 1 firefox version", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3281bb2..82e0a4a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,9 +41,6 @@ importers: '@tauri-apps/plugin-shell': specifier: 2.0.0-rc.1 version: 2.0.0-rc.1 - clsx: - specifier: ^2.1.1 - version: 2.1.1 next: specifier: ^14.2.13 version: 14.2.13(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -93,6 +90,9 @@ importers: autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.47) + clsx: + specifier: ^2.1.1 + version: 2.1.1 cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -120,6 +120,9 @@ importers: postcss-nesting: specifier: ^13.0.0 version: 13.0.0(postcss@8.4.47) + tailwind-merge: + specifier: ^2.5.2 + version: 2.5.2 tailwindcss: specifier: ^3.4.12 version: 3.4.12 @@ -174,28 +177,24 @@ packages: engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - libc: [musl] '@biomejs/cli-linux-arm64@1.9.2': resolution: {integrity: sha512-T8TJuSxuBDeQCQzxZu2o3OU4eyLumTofhCxxFd3+aH2AEWVMnH7Z/c3QP1lHI5RRMBP9xIJeMORqDQ5j+gVZzw==} engines: {node: '>=14.21.3'} cpu: [arm64] os: [linux] - libc: [glibc] '@biomejs/cli-linux-x64-musl@1.9.2': resolution: {integrity: sha512-CjPM6jT1miV5pry9C7qv8YJk0FIZvZd86QRD3atvDgfgeh9WQU0k2Aoo0xUcPdTnoz0WNwRtDicHxwik63MmSg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - libc: [musl] '@biomejs/cli-linux-x64@1.9.2': resolution: {integrity: sha512-T0cPk3C3Jr2pVlsuQVTBqk2qPjTm8cYcTD9p/wmR9MeVqui1C/xTVfOIwd3miRODFMrJaVQ8MYSXnVIhV9jTjg==} engines: {node: '>=14.21.3'} cpu: [x64] os: [linux] - libc: [glibc] '@biomejs/cli-win32-arm64@1.9.2': resolution: {integrity: sha512-2x7gSty75bNIeD23ZRPXyox6Z/V0M71ObeJtvQBhi1fgrvPdtkEuw7/0wEHg6buNCubzOFuN9WYJm6FKoUHfhg==} @@ -316,28 +315,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@next/swc-linux-arm64-musl@14.2.13': resolution: {integrity: sha512-v5jZ/FV/eHGoWhMKYrsAweQ7CWb8xsWGM/8m1mwwZQ/sutJjoFaXchwK4pX8NqwImILEvQmZWyb8pPTcP7htWg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@next/swc-linux-x64-gnu@14.2.13': resolution: {integrity: sha512-aVc7m4YL7ViiRv7SOXK3RplXzOEe/qQzRA5R2vpXboHABs3w8vtFslGTz+5tKiQzWUmTmBNVW0UQdhkKRORmGA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@next/swc-linux-x64-musl@14.2.13': resolution: {integrity: sha512-4wWY7/OsSaJOOKvMsu1Teylku7vKyTuocvDLTZQq0TYv9OjiYYWt63PiE1nTuZnqQ4RPvME7Xai+9enoiN0Wrg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@next/swc-win32-arm64-msvc@14.2.13': resolution: {integrity: sha512-uP1XkqCqV2NVH9+g2sC7qIw+w2tRbcMiXFEbMihkQ8B1+V6m28sshBwAB0SDmOe0u44ne1vFU66+gx/28RsBVQ==} @@ -418,28 +413,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.16': resolution: {integrity: sha512-SNEDcB+sWOls/B0a+UpUHVa/oegvlXXKYWsTxuXtgWIr5VbWG7rXLZ3fZpLLP3SpRVGTGTnABcyqshFbWSqqKQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.16': resolution: {integrity: sha512-Zsq29MM1ooeH1+chQBa7ffDFnzAZebBBFdsvs4e05tS1H8gn4oKE+PSMn9p/okzVXykEk9ri2/n7BG1XFeifMA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@tauri-apps/cli-linux-x64-musl@2.0.0-rc.16': resolution: {integrity: sha512-g+pwSuis2YMxhJJ/pJYwp/Nps5CWvlv/5MV5UfDvClkCkeAyzIqVX+HbBLPcs5S0CePUQNeP0j4d4jBWUqZZQg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.16': resolution: {integrity: sha512-PpPqdMTwJSDAK4KnNjvh77ShSkY+7pih1f6e50EtXar8bjC17e3XcEqFhDNne5mxEVTLYhibs6p1JLPad0ZjRA==} @@ -2349,6 +2340,9 @@ packages: engines: {node: '>=14.0.0'} hasBin: true + tailwind-merge@2.5.2: + resolution: {integrity: sha512-kjEBm+pvD+6eAwzJL2Bi+02/9LFLal1Gs61+QB7HvTfQQ0aXwC5LGT8PEt1gS0CWKktKe6ysPTAy3cBC5MeiIg==} + tailwindcss@3.4.12: resolution: {integrity: sha512-Htf/gHj2+soPb9UayUNci/Ja3d8pTmu9ONTfh4QY8r3MATTZOzmv6UYWF7ZwikEIC8okpfqmGqrmDehua8mF8w==} engines: {node: '>=14.0.0'} @@ -4901,6 +4895,8 @@ snapshots: csso: 5.0.5 picocolors: 1.1.0 + tailwind-merge@2.5.2: {} + tailwindcss@3.4.12: dependencies: '@alloc/quick-lru': 5.2.0 diff --git a/src/app/(main)/console/page.tsx b/src/app/(main)/console/page.tsx new file mode 100644 index 0000000..4eb958b --- /dev/null +++ b/src/app/(main)/console/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Console
; +} diff --git a/src/app/(main)/gear/page.tsx b/src/app/(main)/gear/page.tsx new file mode 100644 index 0000000..2ca8eb9 --- /dev/null +++ b/src/app/(main)/gear/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Gear
; +} diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx new file mode 100644 index 0000000..bc2c6ee --- /dev/null +++ b/src/app/(main)/home/page.tsx @@ -0,0 +1,13 @@ +"use client"; + +import Notice from "@/components/cstb/Notice"; + +const Home = () => { + return ( +
+ +
+ ); +}; + +export default Home; diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx new file mode 100644 index 0000000..526812a --- /dev/null +++ b/src/app/(main)/layout.tsx @@ -0,0 +1,25 @@ +import Header from "@/components/window/Header"; +import Nav from "@/components/window/Nav"; +import SideBar from "@/components/window/SideBar"; + +export default function BaseLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( +
+
+ ); +} diff --git a/src/app/(main)/movie/page.tsx b/src/app/(main)/movie/page.tsx new file mode 100644 index 0000000..3947bf4 --- /dev/null +++ b/src/app/(main)/movie/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Movie
; +} diff --git a/src/app/(main)/preference/page.tsx b/src/app/(main)/preference/page.tsx new file mode 100644 index 0000000..38e9d1d --- /dev/null +++ b/src/app/(main)/preference/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Preference
; +} diff --git a/src/app/(main)/tool/page.tsx b/src/app/(main)/tool/page.tsx new file mode 100644 index 0000000..4048311 --- /dev/null +++ b/src/app/(main)/tool/page.tsx @@ -0,0 +1,3 @@ +export default function Page() { + return
Tool
; +} diff --git a/src/pages/_app.tsx b/src/app/_app.tsx similarity index 100% rename from src/pages/_app.tsx rename to src/app/_app.tsx diff --git a/src/styles/globals.css b/src/app/globals.css similarity index 92% rename from src/styles/globals.css rename to src/app/globals.css index 8f1d4ca..c30f0ad 100644 --- a/src/styles/globals.css +++ b/src/app/globals.css @@ -6,6 +6,8 @@ html, body { padding: 0; margin: 0; + width: 100%; + height: 100%; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; background: transparent; diff --git a/src/app/layout.tsx b/src/app/layout.tsx new file mode 100644 index 0000000..7137574 --- /dev/null +++ b/src/app/layout.tsx @@ -0,0 +1,19 @@ +export const metadata = { + title: "CS工具箱", + description: "Generated by Next.js", + icons: ["/favicon.ico"], +}; + +import "./globals.css"; + +export default function RootLayout({ + children, +}: { + children: React.ReactNode +}) { + return ( + + {children} + + ) +} diff --git a/src/app/page.tsx b/src/app/page.tsx new file mode 100644 index 0000000..2e45c11 --- /dev/null +++ b/src/app/page.tsx @@ -0,0 +1,20 @@ +"use client"; + +import { useRouter } from "next/navigation"; + +const Home = () => { + const router = useRouter(); + return ( +
+

CS 工具箱

+ +
+ ); +}; + +export default Home; diff --git a/src/pages/index.tsx b/src/app/test/page.tsx similarity index 61% rename from src/pages/index.tsx rename to src/app/test/page.tsx index 02c9664..f1fc0ce 100644 --- a/src/pages/index.tsx +++ b/src/app/test/page.tsx @@ -1,39 +1,30 @@ -import { Card } from "@/components/Card" -import { CardButton } from "@/components/CardButton" -import { useGlobalShortcut } from "@/hooks/tauri/shortcuts" -import { invoke } from "@tauri-apps/api/core" -import type { NextPage } from "next" -import Head from "next/head" -import Image from "next/image" -import { useCallback, useState } from "react" +"use client" +import { CardButton } from "@/components/test/CardButton"; +import { useGlobalShortcut } from "@/hooks/tauri/shortcuts"; +import { invoke } from "@tauri-apps/api/core"; +import { useCallback, useState } from "react"; -const Home: NextPage = () => { +export default function Page() { const [buttonDesc, setButtonDesc] = useState( - "Waiting to be clicked. This calls 'on_button_clicked' from Rust.", - ) + "Waiting to be clicked. This calls 'on_button_clicked' from Rust." + ); const onButtonClick = () => { invoke("on_button_clicked") .then((value) => { - setButtonDesc(value) + setButtonDesc(value); }) .catch(() => { - setButtonDesc("Failed to invoke Rust command 'on_button_clicked'") - }) - } + setButtonDesc("Failed to invoke Rust command 'on_button_clicked'"); + }); + }; const shortcutHandler = useCallback(() => { - console.log("Ctrl+P was pressed!") - }, []) - useGlobalShortcut("CommandOrControl+P", shortcutHandler) + console.log("Ctrl+P was pressed!"); + }, []); + useGlobalShortcut("CommandOrControl+P", shortcutHandler); return ( -
- - Create Next App - - - - +

Welcome to{" "} @@ -62,10 +53,6 @@ const Home: NextPage = () => { />

- -
- ) + ); } - -export default Home diff --git a/src/components/cstb/CommonDir.tsx b/src/components/cstb/CommonDir.tsx new file mode 100644 index 0000000..afa04fd --- /dev/null +++ b/src/components/cstb/CommonDir.tsx @@ -0,0 +1,5 @@ +const CommonDir = () => { + return
CommonDir
; +}; + +export default CommonDir; diff --git a/src/components/cstb/FastLaunch.tsx b/src/components/cstb/FastLaunch.tsx new file mode 100644 index 0000000..a84b643 --- /dev/null +++ b/src/components/cstb/FastLaunch.tsx @@ -0,0 +1,5 @@ +const FastLaunch = () => { + return
FastLaunch
; +}; + +export default FastLaunch; diff --git a/src/components/cstb/LaunchOption.tsx b/src/components/cstb/LaunchOption.tsx new file mode 100644 index 0000000..b40a7d8 --- /dev/null +++ b/src/components/cstb/LaunchOption.tsx @@ -0,0 +1,5 @@ +const LaunchOption = () => { + return
LaunchOption
; +}; + +export default LaunchOption; diff --git a/src/components/cstb/Notice.tsx b/src/components/cstb/Notice.tsx new file mode 100644 index 0000000..8b5c675 --- /dev/null +++ b/src/components/cstb/Notice.tsx @@ -0,0 +1,26 @@ +import { VolumeNotice } from "@icon-park/react"; +import { + CardHeader, + CardIcon, + CardTool, + CardBody, + Card, +} from "@/components/window/Card"; + +const Notice = () => { + return ( + + + + 公告 + + +

2021年10月16日

+
+
+ 不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl +
+ ); +}; + +export default Notice; diff --git a/src/components/cstb/PowerPlan.tsx b/src/components/cstb/PowerPlan.tsx new file mode 100644 index 0000000..b4d562a --- /dev/null +++ b/src/components/cstb/PowerPlan.tsx @@ -0,0 +1,5 @@ +const PowerPlan = () => { + return
PowerPlan
; +}; + +export default PowerPlan; diff --git a/src/components/cstb/SmartTranser.tsx b/src/components/cstb/SmartTranser.tsx new file mode 100644 index 0000000..e9f9614 --- /dev/null +++ b/src/components/cstb/SmartTranser.tsx @@ -0,0 +1,5 @@ +const SmartTransfer = () => { + return
SmartTransfer
; +}; + +export default SmartTransfer; diff --git a/src/components/Card.tsx b/src/components/test/Card.tsx similarity index 78% rename from src/components/Card.tsx rename to src/components/test/Card.tsx index 2ab1083..3c349be 100644 --- a/src/components/Card.tsx +++ b/src/components/test/Card.tsx @@ -13,7 +13,7 @@ export const Card: React.FC = ({ href={url} target="_blank" rel="noopener noreferrer" - className="m-4 max-w-xs rounded-xl border border-gray-200 p-6 text-left text-inherit transition-colors hover:border-blue-600 hover:text-blue-600 focus:border-blue-600 focus:text-blue-600 active:border-blue-600 active:text-blue-600" + className="max-w-xs p-6 m-4 text-left transition-colors border border-gray-200 rounded-xl text-inherit hover:border-blue-600 hover:text-blue-600 focus:border-blue-600 focus:text-blue-600 active:border-blue-600 active:text-blue-600" >

{title} →

{description}

diff --git a/src/components/CardButton.tsx b/src/components/test/CardButton.tsx similarity index 100% rename from src/components/CardButton.tsx rename to src/components/test/CardButton.tsx diff --git a/src/components/window/Card.tsx b/src/components/window/Card.tsx new file mode 100644 index 0000000..5543415 --- /dev/null +++ b/src/components/window/Card.tsx @@ -0,0 +1,42 @@ +import { ReactNode } from "react"; + +interface CardProps { + children: ReactNode; +} + +const Card = ({ children }: CardProps) => { + return ( +
+ {children} +
+ ); +}; + +const CardHeader = ({ children }: CardProps) => { + return ( +
{children}
+ ); +}; + +const CardIcon = ({ children }: CardProps) => { + return ( +
{children}
+ ); +}; + +const CardTool = ({ children }: CardProps) => { + return ( +
+ {children} +
+ ); +}; + +const CardBody = ({ children }: CardProps) => { + return
{children}
; +}; + +export { Card, CardHeader, CardIcon, CardTool, CardBody }; diff --git a/src/components/window/Header.tsx b/src/components/window/Header.tsx new file mode 100644 index 0000000..e61d743 --- /dev/null +++ b/src/components/window/Header.tsx @@ -0,0 +1,14 @@ +const Header = () => { + return ( +
+

+ Faze.Rop紫本人 +

+

+ 本周使用CSGO工具箱 62小时 +

+
+ ); +}; + +export default Header; diff --git a/src/components/window/Nav.tsx b/src/components/window/Nav.tsx new file mode 100644 index 0000000..4cb5091 --- /dev/null +++ b/src/components/window/Nav.tsx @@ -0,0 +1,67 @@ +"use client" +import { RocketOne, Minus, Close, Square } from "@icon-park/react"; +import { relaunch, exit } from "@tauri-apps/plugin-process"; +import { getCurrentWindow } from "@tauri-apps/api/window"; +// import { invoke } from "@tauri-apps/api/core"; + +const Nav = () => { + const close = async () => { + // (await window.hideOnClose) ? getCurrent().hide() : exit(); + await exit(); + }; + + const minimize = () => { + getCurrentWindow() + .minimize() + .then(() => { + console.log("minimized"); + }) + .catch((err: unknown) => { + console.error(err); + }); + }; + + const toggleMaximize = async () => { + const current = getCurrentWindow() + const maximized = await current.isMaximized() + maximized ? current.unmaximize() : current.maximize() + } + + const reset = async () => { + await relaunch(); + }; + + return ( + + ); +}; + +export default Nav; diff --git a/src/components/window/SideBar.tsx b/src/components/window/SideBar.tsx new file mode 100644 index 0000000..c59eb0d --- /dev/null +++ b/src/components/window/SideBar.tsx @@ -0,0 +1,90 @@ +"use client" +import { ReactNode } from "react"; +import clsx from "clsx"; +import { + Home, + MonitorOne, + Movie, + Setting, + Terminal, + Toolkit, +} from "@icon-park/react"; +import { useRouter } from "next/navigation"; + +interface SideButtonProps { + className?: string; + children?: ReactNode; +} + +const SideButton = ({ className, children, ...rest }: SideButtonProps & React.ButtonHTMLAttributes) => { + return ( + + ); +}; + +const Avatar = () => { + const router = useRouter(); + + return ( +
router.push('/test')} className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer"> + avatar +
+ ); +}; + +const SideBar = () => { + const router = useRouter(); + + return ( +
+
+ +
+ +
+ router.push("/home")}> + + + router.push("/tool")}> + + + router.push("/console")}> + + + router.push("/gear")}> + + + router.push("/movie")}> + + + router.push("/preference")}> + + +
+ +
+

版本号

+

0.0.1

+
+
+ ); +}; + +export default SideBar; diff --git a/tsconfig.json b/tsconfig.json index e6c21f7..b4ea062 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -16,9 +20,25 @@ "incremental": true, "baseUrl": ".", "paths": { - "@/*": ["src/*"] - } + "@/*": [ + "src/*" + ] + }, + "plugins": [ + { + "name": "next" + } + ] }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "*.js"], - "exclude": ["node_modules", "src-tauri"] -} + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + "*.js", + ".next/types/**/*.ts" + ], + "exclude": [ + "node_modules", + "src-tauri" + ] +}