-
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.
Merge pull request #119 from besscroft/dev
v1.0.0
- Loading branch information
Showing
39 changed files
with
3,603 additions
and
2,142 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
'use client' | ||
|
||
import * as React from 'react' | ||
import { | ||
CommandDialog, | ||
CommandEmpty, | ||
CommandGroup, | ||
CommandInput, | ||
CommandItem, | ||
CommandList, | ||
CommandSeparator, | ||
} from '~/components/ui/command' | ||
import { useButtonStore } from '~/app/providers/button-store-Providers' | ||
import { Archive, Milestone, Image, Server, ImageUp, MonitorDot, Copyright, Info, SquareAsterisk, ShieldCheck } from 'lucide-react' | ||
import { useRouter } from 'next-nprogress-bar' | ||
|
||
export default function Command() { | ||
const router = useRouter() | ||
const { searchOpen, setSearchOpen } = useButtonStore( | ||
(state) => state, | ||
) | ||
|
||
return ( | ||
<CommandDialog open={searchOpen} onOpenChange={setSearchOpen}> | ||
<CommandInput placeholder="Type a command or search..." /> | ||
<CommandList> | ||
<CommandEmpty>没有任何结果.</CommandEmpty> | ||
<CommandGroup heading="主菜单"> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin') | ||
setSearchOpen(false) | ||
}}> | ||
<MonitorDot className="mr-2 h-4 w-4" /> | ||
<span>控制台</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/upload') | ||
setSearchOpen(false) | ||
}}> | ||
<ImageUp className="mr-2 h-4 w-4" /> | ||
<span>上传</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/list') | ||
setSearchOpen(false) | ||
}}> | ||
<Image className="mr-2 h-4 w-4" /> | ||
<span>图片维护</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/tag') | ||
setSearchOpen(false) | ||
}}> | ||
<Milestone className="mr-2 h-4 w-4" /> | ||
<span>相册管理</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/copyright') | ||
setSearchOpen(false) | ||
}}> | ||
<Copyright className="mr-2 h-4 w-4" /> | ||
<span>版权管理</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/about') | ||
setSearchOpen(false) | ||
}}> | ||
<Info className="mr-2 h-4 w-4" /> | ||
<span>关于</span> | ||
</CommandItem> | ||
</CommandGroup> | ||
<CommandSeparator /> | ||
<CommandGroup heading="二级菜单"> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/settings/preferences') | ||
setSearchOpen(false) | ||
}}> | ||
<Archive className="mr-2 h-4 w-4" /> | ||
<span>首选项</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/settings/password') | ||
setSearchOpen(false) | ||
}}> | ||
<SquareAsterisk className="mr-2 h-4 w-4" /> | ||
<span>密码修改</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/settings/storages') | ||
setSearchOpen(false) | ||
}}> | ||
<Server className="mr-2 h-4 w-4" /> | ||
<span>存储</span> | ||
</CommandItem> | ||
<CommandItem className="cursor-pointer" onSelect={() => { | ||
router.push('/admin/settings/authenticator') | ||
setSearchOpen(false) | ||
}}> | ||
<ShieldCheck className="mr-2 h-4 w-4" /> | ||
<span>双因素验证</span> | ||
</CommandItem> | ||
</CommandGroup> | ||
</CommandList> | ||
</CommandDialog> | ||
) | ||
} |
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,26 @@ | ||
'use client' | ||
|
||
import { Button } from '~/components/ui/button' | ||
import { cn } from '~/utils' | ||
import { MagnifyingGlassIcon } from '@radix-ui/react-icons' | ||
import { useButtonStore } from '~/app/providers/button-store-Providers' | ||
|
||
export default function SearchBorder() { | ||
const { setSearchOpen } = useButtonStore( | ||
(state) => state, | ||
) | ||
|
||
return ( | ||
<Button | ||
variant={"outline"} | ||
className={cn( | ||
"w-[240px] justify-start text-left font-normal", | ||
"text-muted-foreground" | ||
)} | ||
onClick={() => setSearchOpen(true)} | ||
> | ||
<MagnifyingGlassIcon className="mr-2 h-4 w-4" /> | ||
<span>搜索</span> | ||
</Button> | ||
) | ||
} |
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,20 @@ | ||
'use client' | ||
|
||
import { Search } from 'lucide-react' | ||
import { useButtonStore } from '~/app/providers/button-store-Providers' | ||
import { usePathname } from 'next/navigation' | ||
|
||
export default function SearchButton() { | ||
const pathname = usePathname() | ||
const { setSearchOpen } = useButtonStore( | ||
(state) => state, | ||
) | ||
|
||
return ( | ||
<> | ||
{ | ||
pathname.startsWith('/admin') && <Search onClick={() => setSearchOpen(true)} size={20} /> | ||
} | ||
</> | ||
) | ||
} |
Oops, something went wrong.