[dep] update to eslint 9

This commit is contained in:
Purp1e
2024-11-11 10:04:00 +08:00
parent e308309fb8
commit b1d505fd6b
36 changed files with 353 additions and 218 deletions

View File

@@ -1,5 +1,5 @@
import { ReactNode } from "react"
import clsx from "clsx"
import type { ReactNode } from "react"
interface CardProps {
children?: ReactNode
@@ -20,23 +20,41 @@ const Card = ({ children }: CardProps) => {
}
const CardHeader = ({ children }: CardProps) => {
return <div className="flex items-center gap-1.5 tracking-wide">{children}</div>
return (
<div className="flex items-center gap-1.5 tracking-wide">{children}</div>
)
}
const CardIcon = ({ children, type, className, ...rest }: CardProps) => {
return (
<div className={clsx("flex gap-1.5 items-center font-semibold", type === "menu" && "transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95", className)} {...rest}>
<div
className={clsx(
"flex gap-1.5 items-center font-semibold",
type === "menu" &&
"transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95",
className,
)}
{...rest}
>
{children}
</div>
)
}
const CardTool = ({ children }: CardProps) => {
return <div className="flex items-center justify-end flex-grow gap-2">{children}</div>
return (
<div className="flex items-center justify-end flex-grow gap-2">
{children}
</div>
)
}
const CardBody = ({ children }: CardProps) => {
return <div className="w-full h-full text-sm tracking-wide text-zinc-800">{children}</div>
return (
<div className="w-full h-full text-sm tracking-wide text-zinc-800">
{children}
</div>
)
}
export { Card, CardHeader, CardIcon, CardTool, CardBody }

View File

@@ -8,7 +8,7 @@ const Header = () => {
使CS工具箱 114
</p>
</div>
);
};
)
}
export default Header;
export default Header

View File

@@ -1,9 +1,9 @@
"use client"
import { RocketOne, Minus, Close, Square } from "@icon-park/react"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
import { Close, Minus, RocketOne, Square } from "@icon-park/react"
import { getCurrentWindow } from "@tauri-apps/api/window"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
// import { platform } from "@tauri-apps/plugin-os"
import { useRouter, usePathname } from "next/navigation"
import { usePathname, useRouter } from "next/navigation"
const Nav = () => {
const close = async () => {
@@ -35,35 +35,44 @@ const Nav = () => {
const pathname = usePathname()
return (
<nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
<nav
className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4"
data-tauri-drag-region
>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => pathname !== "/prepare" ? router.push("/prepare") : router.back()}
onClick={() =>
pathname !== "/prepare" ? router.push("/prepare") : router.back()
}
>
<RocketOne size={16} />
</button>
{/* { platform() === "windows" && ( */}
<>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={minimize}
>
<Minus size={16} />
</button>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={toggleMaximize}
>
<Square size={16} />
</button>
<button
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={close}
>
<Close size={16} />
</button>
</>
<>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={minimize}
>
<Minus size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={toggleMaximize}
>
<Square size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={close}
>
<Close size={16} />
</button>
</>
{/* )} */}
</nav>
)

View File

@@ -1,8 +1,15 @@
"use client"
import { ReactNode } from "react"
import {
Home,
MonitorOne,
Movie,
Setting,
Terminal,
Toolkit,
} from "@icon-park/react"
import clsx from "clsx"
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
import { useRouter, usePathname } from "next/navigation"
import { usePathname, useRouter } from "next/navigation"
import type { ReactNode } from "react"
// import { platform } from "@tauri-apps/plugin-os"
import useAppStore from "@/store/app"
@@ -24,11 +31,12 @@ const SideButton = ({
return (
<button
onClick={() => router.push(route || "/")}
type="button"
onKeyUp={() => router.push(route || "/")}
className={clsx(
className,
"p-2.5 hover:bg-black/5 rounded-lg transition relative",
path.startsWith(route) && "bg-black/5"
path.startsWith(route) && "bg-black/5",
)}
{...rest}
>
@@ -36,7 +44,7 @@ const SideButton = ({
<div
className={clsx(
path.startsWith(route) && "opacity-100",
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2"
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2",
)}
/>
</button>
@@ -49,10 +57,10 @@ const Avatar = () => {
return (
<div
onClick={() => router.push("/users")}
onKeyUp={() => router.push("/users")}
className={clsx(
"w-12 h-12 bg-gray-700 rounded-full shadow-2xl cursor-pointer transition active:scale-95 shadow-purple-800",
path.startsWith("/users") && "shadow-sm"
path.startsWith("/users") && "shadow-sm",
)}
>
<img src="favicon.ico" alt="avatar" draggable={false} />
@@ -66,7 +74,7 @@ const SideBar = () => {
return (
<div
className={clsx(
"absolute left-0 flex flex-col h-full select-none w-20 py-7"
"absolute left-0 flex flex-col h-full select-none w-20 py-7",
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
)}
data-tauri-drag-region
@@ -99,9 +107,12 @@ const SideBar = () => {
</SideButton>
</section>
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
<div
className="mx-auto text-sm text-center text-zinc-500"
data-tauri-drag-region
>
<p></p>
<p onClick={() => setVersion("x.y.z")}>{version}</p>
<p onKeyUp={() => setVersion("x.y.z")}>{version}</p>
</div>
</div>
)

View File

@@ -1,8 +1,17 @@
import { ReactNode } from "react";
import type { ReactNode } from "react"
interface ToolButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children?: ReactNode;
interface ToolButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children?: ReactNode
}
export const ToolButton = ({ children, ...rest }: ToolButtonProps) => {
return <button className="flex gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 rounded-md text-sm leading-none" {...rest}>{children}</button>;
};
return (
<button
type="button"
className="flex gap-0.5 active:scale-95 items-center min-w-7 justify-center px-2 py-1.5 bg-black/5 transition hover:bg-black/10 rounded-md text-sm leading-none"
{...rest}
>
{children}
</button>
)
}