@@ -25,6 +25,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
2525import { useCommonData } from "../data-provider"
2626import { IconChevronDown , IconChevronRight , IconDots , IconDotsVertical , IconFolder , IconFolderOpen , IconFolderPlus , IconLoader , IconPlayerStopFilled , IconPlus , IconPointFilled , IconTrash } from "@tabler/icons-react"
2727import { Button } from "@/components/ui/button"
28+ import { Separator } from "@/components/ui/separator"
2829import AddProjectDialog from "../project/add-project"
2930import StartDevelopTaskDialog from "../project/start-develop-task-dialog"
3031import CreateDefaultTaskDialog from "../task/create-default-task-dialog"
@@ -100,16 +101,18 @@ export default function NavProject() {
100101 < DropdownMenuContent align = "end" className = "py-1" >
101102 { ( task . status === "pending" || task . status === "processing" ) && (
102103 < DropdownMenuItem
104+ variant = "destructive"
103105 onClick = { ( ) => setTaskToStop ( task ) }
104- className = "text-destructive focus:text-destructive text- xs py-1 px-1.5 [&_svg]:size-3"
106+ className = "text-xs py-1 px-1.5 [&_svg]:size-3"
105107 >
106108 < IconPlayerStopFilled className = "mr-1" />
107109 终止任务
108110 </ DropdownMenuItem >
109111 ) }
110112 < DropdownMenuItem
113+ variant = "destructive"
111114 onClick = { ( ) => setTaskToDelete ( task ) }
112- className = "text-destructive focus:text-destructive text- xs py-1 px-1.5 [&_svg]:size-3"
115+ className = "text-xs py-1 px-1.5 [&_svg]:size-3"
113116 >
114117 < IconTrash className = "mr-1" />
115118 删除任务
@@ -251,47 +254,27 @@ export default function NavProject() {
251254 ) : (
252255 < SidebarMenu className = "gap-2" >
253256 < SidebarMenuItem >
254- < div
255- className = { cn (
256- "group/default-row flex w-full items-center gap-1 overflow-hidden rounded-md pl-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 my-1" ,
257- isUnlinkedActive && "font-medium text-primary"
258- ) }
259- >
260- < Link
261- to = "/console/tasks"
262- className = { cn (
263- "min-w-0 flex-1 flex items-center gap-2 truncate text-sidebar-foreground/70 group-hover/default-row:text-primary" ,
264- isUnlinkedActive && "text-primary"
265- ) }
266- >
267- < IconFolderOpen className = "size-3.5 shrink-0 opacity-50" />
268- < span className = "truncate" > 空项目</ span >
269- </ Link >
270- < Tooltip >
271- < TooltipTrigger asChild >
272- < Button
273- variant = "ghost"
274- size = "icon"
275- className = "size-5 shrink-0 text-muted-foreground/50 group-hover/default-row:text-primary hover:text-primary"
276- onClick = { ( e ) => {
277- e . preventDefault ( )
278- e . stopPropagation ( )
279- setDefaultTaskDialogOpen ( true )
280- } }
281- >
282- < IconPlus className = "size-3.5" />
283- </ Button >
284- </ TooltipTrigger >
285- < TooltipContent side = "right" > 创建任务</ TooltipContent >
286- </ Tooltip >
287- </ div >
288257 < SidebarMenuSub className = "border-none px-0 mx-0" >
289258 < SidebarMenuSubItem className = "flex flex-col gap-0.5" >
290259 { renderTaskList ( unlinkedTasks , "unlinked" ) }
291260 </ SidebarMenuSubItem >
292261 </ SidebarMenuSub >
293262 < SidebarMenuSub className = "border-none px-0 mx-0" >
294263 < SidebarMenuSubItem className = "flex flex-col gap-0.5" >
264+ < SidebarMenuSubButton
265+ asChild
266+ size = "md"
267+ className = "group/task-row py-4 text-sidebar-foreground/70 [&>svg]:size-3.5 [&>svg]:text-sidebar-foreground/70 hover:text-sidebar-accent-foreground hover:[&>svg]:text-sidebar-accent-foreground"
268+ >
269+ < button
270+ type = "button"
271+ className = "flex w-full min-w-0 items-center gap-2 truncate"
272+ onClick = { ( ) => setDefaultTaskDialogOpen ( true ) }
273+ >
274+ < IconPlus className = "size-3.5 shrink-0" />
275+ < span className = "truncate" > 启动任务</ span >
276+ </ button >
277+ </ SidebarMenuSubButton >
295278 < button
296279 type = "button"
297280 className = "group/history-row flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sm text-sidebar-foreground/70 transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
@@ -338,6 +321,7 @@ export default function NavProject() {
338321 </ SidebarMenuSubItem >
339322 </ SidebarMenuSub >
340323 </ SidebarMenuItem >
324+ { projects . length > 0 && < Separator className = "my-2" /> }
341325 { projects . length > 0 ? projects . map ( ( project ) => {
342326 const projectId = project . id ?? ""
343327 const isProjectActive =
@@ -430,16 +414,18 @@ export default function NavProject() {
430414 < DropdownMenuContent align = "end" className = "py-1" >
431415 { ( task . status === "pending" || task . status === "processing" ) && (
432416 < DropdownMenuItem
417+ variant = "destructive"
433418 onClick = { ( ) => setTaskToStop ( task ) }
434- className = "text-destructive focus:text-destructive text- xs py-1 px-1.5 [&_svg]:size-3"
419+ className = "text-xs py-1 px-1.5 [&_svg]:size-3"
435420 >
436421 < IconPlayerStopFilled className = "mr-1" />
437422 终止任务
438423 </ DropdownMenuItem >
439424 ) }
440425 < DropdownMenuItem
426+ variant = "destructive"
441427 onClick = { ( ) => setTaskToDelete ( task ) }
442- className = "text-destructive focus:text-destructive text- xs py-1 px-1.5 [&_svg]:size-3"
428+ className = "text-xs py-1 px-1.5 [&_svg]:size-3"
443429 >
444430 < IconTrash className = "mr-1" />
445431 删除任务
@@ -462,8 +448,8 @@ export default function NavProject() {
462448 </ SidebarMenuButton >
463449 </ SidebarMenuItem >
464450 ) }
465- < SidebarMenuItem className = "mt-2" >
466- < SidebarMenuButton onClick = { ( ) => setAddDialogOpen ( true ) } >
451+ < SidebarMenuItem >
452+ < SidebarMenuButton onClick = { ( ) => setAddDialogOpen ( true ) } className = "[&>svg]:size-3.5" >
467453 < IconFolderPlus />
468454 < span > 添加项目</ span >
469455 </ SidebarMenuButton >
0 commit comments