Skip to content

Commit

Permalink
fix: 图标和样式修改,设置页面新布局
Browse files Browse the repository at this point in the history
  • Loading branch information
besscroft committed Apr 17, 2024
1 parent 31f3e41 commit b65feb3
Show file tree
Hide file tree
Showing 14 changed files with 193 additions and 178 deletions.
9 changes: 2 additions & 7 deletions app/(default)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Header from '~/components/layout/Header'
import Transitions, { Animate } from '~/components/layout/Transitions'

export default async function DefaultLayout({
children,
Expand All @@ -8,12 +7,8 @@ export default async function DefaultLayout({
}>) {
return (
<>
<Transitions className="h-full flex flex-col">
<Header/>
<Animate className="flex-1">
{children}
</Animate>
</Transitions>
<Header/>
{children}
</>
);
}
23 changes: 9 additions & 14 deletions app/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import DashHeader from '~/components/layout/DashHeader'
import { BaseSide } from '~/components/layout/BaseSide'
import Transitions, { Animate } from '~/components/layout/Transitions'

import { AntdRegistry } from '@ant-design/nextjs-registry'

Expand All @@ -12,19 +11,15 @@ export default function AdminLayout({
return (
<>
<div className="flex flex-col h-screen">
<Transitions className="h-full flex flex-col">
<DashHeader/>
<div className="grid flex-1 sm:grid-cols-[200px_1fr] h-full w-full bg-gray-100 dark:bg-zinc-900">
<aside className="hidden w-[200px] flex-col sm:flex">
<BaseSide/>
</aside>
<main className="flex w-full h-full flex-1 flex-col p-2">
<Animate className="flex-1">
<AntdRegistry>{children}</AntdRegistry>
</Animate>
</main>
</div>
</Transitions>
<DashHeader/>
<div className="grid flex-1 sm:grid-cols-[200px_1fr] h-full w-full bg-gray-100 dark:bg-zinc-900">
<aside className="hidden w-[200px] flex-col sm:flex">
<BaseSide/>
</aside>
<main className="flex w-full h-full flex-1 flex-col p-2">
<AntdRegistry>{children}</AntdRegistry>
</main>
</div>
</div>
</>
);
Expand Down
6 changes: 6 additions & 0 deletions app/admin/settings/about/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export default async function About() {
return (
<p>关于</p>
)
}
67 changes: 67 additions & 0 deletions app/admin/settings/layout.tsx
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>
)
}
25 changes: 7 additions & 18 deletions app/admin/settings/page.tsx
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>
)
}
6 changes: 6 additions & 0 deletions app/admin/settings/preferences/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export default async function Preferences() {
return (
<p>首选项</p>
)
}
21 changes: 21 additions & 0 deletions app/admin/settings/storages/page.tsx
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>
)
}
4 changes: 2 additions & 2 deletions components/admin/list/ListProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
Button,
Pagination,
} from '@nextui-org/react'
import { CaretSortIcon } from '@radix-ui/react-icons'
import { ArrowDown10 } from 'lucide-react'
import {
ContextMenu,
ContextMenuContent,
Expand Down Expand Up @@ -116,7 +116,7 @@ export default function ListProps(props : Readonly<HandleListProps>) {
<Chip
color="primary"
variant="shadow"
startContent={<CaretSortIcon/>}
startContent={<ArrowDown10 size={20} />}
>{image.sort}</Chip>
</PopoverTrigger>
<PopoverContent>
Expand Down
4 changes: 2 additions & 2 deletions components/admin/tag/DefaultTag.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client'

import { Card, CardBody, CardFooter, CardHeader, Chip, Popover, PopoverContent, PopoverTrigger } from '@nextui-org/react'
import { CaretSortIcon } from '@radix-ui/react-icons'
import React from 'react'
import { ArrowDown10 } from 'lucide-react'

export default function DefaultTag() {
return (
Expand Down Expand Up @@ -31,7 +31,7 @@ export default function DefaultTag() {
<Chip
color="primary"
variant="shadow"
startContent={<CaretSortIcon />}
startContent={<ArrowDown10 size={20} />}
>-1</Chip>
</PopoverTrigger>
<PopoverContent>
Expand Down
4 changes: 2 additions & 2 deletions components/admin/tag/TagList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
ModalFooter,
Button
} from '@nextui-org/react'
import { CaretSortIcon } from '@radix-ui/react-icons'
import { ArrowDown10 } from 'lucide-react'
import {
ContextMenu,
ContextMenuContent,
Expand Down Expand Up @@ -102,7 +102,7 @@ export default function TagList(props : Readonly<HandleProps>) {
<Chip
color="primary"
variant="shadow"
startContent={<CaretSortIcon/>}
startContent={<ArrowDown10 size={20} />}
>{tag.sort}</Chip>
</PopoverTrigger>
<PopoverContent>
Expand Down
50 changes: 33 additions & 17 deletions components/layout/BaseSide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Listbox, ListboxItem} from '@nextui-org/react'
import { useSession } from 'next-auth/react'
import { usePathname } from 'next/navigation'
import { useRouter } from 'next-nprogress-bar'
import { BookmarkIcon, DesktopIcon, GearIcon, Pencil2Icon, RocketIcon } from '@radix-ui/react-icons'
import { Settings, Milestone, Image, ImageUp, MonitorDot } from 'lucide-react'
import { cn } from '~/utils'

export const BaseSide = () => {
const { data: session, status } = useSession()
Expand All @@ -16,49 +17,64 @@ export const BaseSide = () => {

return (
<div className="w-full h-full p-2">
<div className="w-full px-1 py-2 rounded-small">
<div className="w-full px-1 py-2">
<Listbox
aria-label="移动端菜单"
>
<ListboxItem
className={pathname === '/admin' ? 'text-teal-300 ' + buttonClasses : buttonClasses}
className={cn(
pathname === '/admin' ? 'text-teal-400' : '',
buttonClasses
)}
key="home"
startContent={<DesktopIcon className={iconClasses}/>}
startContent={<MonitorDot size={20} className={iconClasses}/>}
onClick={() => router.push('/admin')}
>
控制台
<span className="text-lg">控制台</span>
</ListboxItem>
<ListboxItem
className={pathname === '/admin/upload' ? 'text-teal-300 ' + buttonClasses : buttonClasses}
className={cn(
pathname === '/admin/upload' ? 'text-teal-400' : '',
buttonClasses
)}
key="upload"
startContent={<RocketIcon className={iconClasses}/>}
startContent={<ImageUp size={20} className={iconClasses}/>}
onClick={() => router.push('/admin/upload')}
>
上传
<span className="text-lg font-sans">上传</span>
</ListboxItem>
<ListboxItem
className={pathname === '/admin/list' ? 'text-teal-300 ' + buttonClasses : buttonClasses}
className={cn(
pathname === '/admin/list' ? 'text-teal-400' : '',
buttonClasses
)}
key="list"
startContent={<Pencil2Icon className={iconClasses}/>}
startContent={<Image size={20} className={iconClasses}/>}
onClick={() => router.push('/admin/list')}
>
图片维护
<span className="text-lg font-sans">图片维护</span>
</ListboxItem>
<ListboxItem
className={pathname === '/admin/tag' ? 'text-teal-300 ' + buttonClasses : buttonClasses}
className={cn(
pathname === '/admin/tag' ? 'text-teal-400' : '',
buttonClasses
)}
key="tag"
startContent={<BookmarkIcon className={iconClasses}/>}
startContent={<Milestone size={20} className={iconClasses}/>}
onClick={() => router.push('/admin/tag')}
>
标签管理
<span className="text-lg font-sans">标签管理</span>
</ListboxItem>
<ListboxItem
className={pathname === '/admin/settings' ? 'text-teal-400 ' + buttonClasses : buttonClasses}
className={cn(
pathname.startsWith('/admin/settings') ? 'text-teal-400' : '',
buttonClasses
)}
key="settings"
startContent={<GearIcon className={iconClasses}/>}
startContent={<Settings size={20} className={iconClasses}/>}
onClick={() => router.push('/admin/settings')}
>
设置
<span className="text-lg font-sans">设置</span>
</ListboxItem>
</Listbox>
</div>
Expand Down
Loading

0 comments on commit b65feb3

Please sign in to comment.