引入 husky,并全局重新格式化

This commit is contained in:
2025-06-07 11:49:57 +08:00
parent 05fce179c9
commit c7527177b0
89 changed files with 2140 additions and 1899 deletions

View File

@@ -1,6 +1,5 @@
import { ReactNode } from 'react'
import { Metadata } from 'next'
import {ReactNode} from 'react'
import {Metadata} from 'next'
export async function generateMetadata(): Promise<Metadata> {
return {
@@ -9,9 +8,9 @@ export async function generateMetadata(): Promise<Metadata> {
}
export type WhitelistLayoutProps = {
children: ReactNode
children: ReactNode
}
export default async function WhitelistLayout(props: WhitelistLayoutProps) {
return props.children
}
}

View File

@@ -149,7 +149,7 @@ export default function WhitelistPage(props: WhitelistPageProps) {
}
else {
const newSelection = new Set<number>()
data.list.forEach(item => {
data.list.forEach((item) => {
newSelection.add(item.id)
})
setSelection(newSelection)
@@ -231,8 +231,8 @@ export default function WhitelistPage(props: WhitelistPageProps) {
</Button>
<Button
theme={`fail`}
className={`ml-2`}
theme="fail"
className="ml-2"
disabled={selection.size === 0 || wait}
onClick={() => confirmRemove()}>
<Trash2/>
@@ -267,7 +267,7 @@ export default function WhitelistPage(props: WhitelistPageProps) {
cell: ({row}) => (
<div className="flex justify-end gap-2">
<Button
className={`h-9 w-9`}
className="h-9 w-9"
theme="outline"
onClick={() => openDialog('edit', row.original)}
disabled={wait}
@@ -275,9 +275,9 @@ export default function WhitelistPage(props: WhitelistPageProps) {
<Edit className="w-4 h-4"/>
</Button>
<Button
className={`h-9 w-9`}
className="h-9 w-9"
onClick={() => confirmRemove(row.original.id)}
theme={`fail`}
theme="fail"
disabled={wait}
>
<Trash2 className="w-4 h-4"/>
@@ -297,22 +297,22 @@ export default function WhitelistPage(props: WhitelistPageProps) {
</DialogTitle>
</DialogHeader>
<Form<SchemaType>
className={`flex flex-col gap-4 py-4`}
className="flex flex-col gap-4 py-4"
form={form}
onSubmit={onSubmit}>
<FormField name={`host`} label={`IP地址`}>
<FormField name="host" label="IP地址">
{({id, field}) => (
<Input {...field} id={id} placeholder="输入IP地址"/>
)}
</FormField>
<FormField name={`remark`} label={`备注`}>
<FormField name="remark" label="备注">
{({id, field}) => (
<Textarea {...field} id={id} placeholder="输入备注信息(可选)" disabled={wait}/>
)}
</FormField>
<DialogFooter className={`gap-4 mt-4`}>
<Button theme={`outline`} type="button" onClick={() => toggleDialog(false)} disabled={wait}></Button>
<Button type={`submit`} disabled={wait}>
<DialogFooter className="gap-4 mt-4">
<Button theme="outline" type="button" onClick={() => toggleDialog(false)} disabled={wait}></Button>
<Button type="submit" disabled={wait}>
{wait && <Loader2 className="w-4 h-4 mr-2 animate-spin"/>}
</Button>