-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
193 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
export default async function About() { | ||
return ( | ||
<p>关于</p> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use client' | ||
|
||
import { usePathname } from 'next/navigation' | ||
import { cn } from '~/utils' | ||
import { Listbox, ListboxItem } from '@nextui-org/react' | ||
import { SlidersHorizontal, Server, Info } from 'lucide-react' | ||
import { useRouter } from 'next-nprogress-bar' | ||
|
||
export default function AdminLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
const pathname = usePathname() | ||
const router = useRouter() | ||
|
||
const iconClasses = 'text-xl text-default-500 pointer-events-none flex-shrink-0' | ||
const buttonClasses = 'active:scale-95 duration-200 ease-in-out' | ||
return ( | ||
<div className="h-full flex"> | ||
<div className={cn('min-w-64 sm:border-r-2 h-full', | ||
pathname === '/admin/settings' ? 'block sm:flex-none flex-1' : 'hidden sm:block' | ||
)}> | ||
<Listbox | ||
aria-label="设置页二级菜单" | ||
> | ||
<ListboxItem | ||
className={cn( | ||
pathname === '/admin/settings/preferences' ? 'text-teal-400' : '', | ||
buttonClasses | ||
)} | ||
key="home" | ||
startContent={<SlidersHorizontal size={20} className={iconClasses}/>} | ||
onClick={() => router.push('/admin/settings/preferences')} | ||
> | ||
<span className="text-lg font-sans">首选项</span> | ||
</ListboxItem> | ||
<ListboxItem | ||
className={cn( | ||
pathname === '/admin/settings/storages' ? 'text-teal-400' : '', | ||
buttonClasses | ||
)} | ||
key="upload" | ||
startContent={<Server size={20} className={iconClasses}/>} | ||
onClick={() => router.push('/admin/settings/storages')} | ||
> | ||
<span className="text-lg font-sans">存储设置</span> | ||
</ListboxItem> | ||
<ListboxItem | ||
className={cn( | ||
pathname === '/admin/settings/about' ? 'text-teal-400' : '', | ||
buttonClasses | ||
)} | ||
key="list" | ||
startContent={<Info size={20} className={iconClasses}/>} | ||
onClick={() => router.push('/admin/settings/about')} | ||
> | ||
<span className="text-lg font-sans">关于</span> | ||
</ListboxItem> | ||
</Listbox> | ||
</div> | ||
<div className={pathname === '/admin/settings' ? 'hidden sm:block flex-1' : 'block flex-1'}> | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
import { Tabs, Tab } from '@nextui-org/react' | ||
import SettingsTab from '~/components/admin/settings/SettingsTab' | ||
import AListTabs from '~/components/admin/settings/AListTabs' | ||
import S3Tabs from '~/components/admin/settings/S3Tabs' | ||
import { Settings as SettingsIcon } from 'lucide-react' | ||
|
||
export default async function Settings() { | ||
export default function Settings() { | ||
return ( | ||
<div className="flex flex-col space-y-2 h-full flex-1"> | ||
<Tabs aria-label="设置选项卡" radius="md" variant="light"> | ||
<Tab key="system" title="系统"> | ||
<SettingsTab /> | ||
</Tab> | ||
<Tab key="s3" title="S3"> | ||
<S3Tabs /> | ||
</Tab> | ||
<Tab key="alist" title="AList"> | ||
<AListTabs /> | ||
</Tab> | ||
</Tabs> | ||
<div className="h-ful flex justify-center items-center"> | ||
<div className="text-center flex flex-col items-center"> | ||
<SettingsIcon /> | ||
<span className="text-xl">在左侧选择一个设置</span> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
export default async function Preferences() { | ||
return ( | ||
<p>首选项</p> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client' | ||
import React from 'react' | ||
|
||
import { Tabs, Tab } from '@nextui-org/react' | ||
import AListTabs from '~/components/admin/settings/AListTabs' | ||
import S3Tabs from '~/components/admin/settings/S3Tabs' | ||
|
||
export default async function Storages() { | ||
return ( | ||
<div className="flex flex-col space-y-2 h-full flex-1"> | ||
<Tabs aria-label="存储选项卡" radius="md" variant="light"> | ||
<Tab key="s3" title="S3"> | ||
<S3Tabs/> | ||
</Tab> | ||
<Tab key="alist" title="AList"> | ||
<AListTabs/> | ||
</Tab> | ||
</Tabs> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.