mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 04:57:12 +00:00
* feat(kanban): implement AI-native kanban database models, services, and REST APIs * feat(webui): implement team kanban board and task management * style(webui): increase kanban dialog widths and form container * fix(webui): ensure kanban dialogs override sm:max-w-lg base class * style(webui): set edit task dialog max width to 5xl * chore: untrack kanban plan markdown files * feat(webui): update kanban page layout to 2 columns and refine task activity UI * fix(webui): constrain kanban column and board heights for vertical scrolling * feat(kanban): unify task status transition into updateTask API and allow unconstrained human task transitions * fix(webui): add optimistic updates to kanban drag-and-drop to eliminate flash * refactor(webui): remove client-side search box from kanban header * feat(kanban): redesign task dialog comments area and add attachment support * refactor(webui): remove top status action bar from task info dialog * fix(webui): narrow query cache predicate and add defensive guards for kanban drag optimistic update * feat(kanban): add drag-and-drop task reordering with fractional indexing (#331) * feat(kanban): add drag-and-drop task reordering with fractional indexing * fix(kanban): improve card drop zones, snap indicators, and column highlight * fix(kanban): enable card droppables only during active drag * fix(kanban): refine hover styles and drop indicators for column boundaries * fix(kanban): unify bottom drop indicator and fix top indicator clipping * fix(kanban): ensure full column highlight and full coverage drop target * minor change * feat(kanban): allow agent tasks free drag-and-drop and enforce status change permissions (#332) * refactor(kanban): rename task_type_agentic translation keys to task_type_agent * feat(kanban): refactor task type enum to isAgentTask boolean (#333) * refactor(kanban): remove phase 2 agent execution logic and streamline phase 1 kanban * feat(kanban): add notifications and audit logging for kanban (#334) * feat(kanban): redesign config area layout and add parent tasks multi-selector (#335) * feat(webui): redesign kanban task dialog config area * feat(kanban): simplify task dependencies with parent tasks multi-selector * refactor(kanban): remove unused links routes and legacy dependency methods * feat(kanban): connect assets and kanban tasks with many-to-many relationship (#336) * feat(kanban): connect assets and kanban tasks with many-to-many relationship * feat(kanban): improve asset picker layout, infinite scrolling, and breadcrumb icon styling * fix(kanban): ensure asset picker scrollarea is scrollable with min-h-0 and shrink-0 flex styling * fix(kanban): hide recently deleted in folder tree picker and adjust header padding * fix(kanban): use lucide files icon instead of paperclip for linked assets * feat(kanban): improve task deletion, goal sidebar interaction, and card styling (#337) * feat(kanban): improve task deletion, goal sidebar interaction, and card styling * feat(kanban): move agent task badge after priority and update to orange style * feat(kanban): add status Compare-And-Swap (CAS) to prevent drag-and-drop race conditions (#338) * feat(kanban): add status Compare-And-Swap (CAS) to prevent drag-and-drop race conditions * style(kanban): rotate kanban icon 180 degrees in sidebar and top nav * style(kanban): remove rotate-180 from SquareKanban icons * feat(kanban): add unassigned goal record and fix all tasks count (#339) * feat(kanban): add unassigned goal record and fix all tasks count * feat(kanban): toggle task count with three-dot action button on goal card hover * fix(ci): pin bun version to 1.3.14 across CI and Docker (#340) * fix(webui): truncate goal name to max 2 lines in kanban sidebar (#341)
152 lines
5.1 KiB
TypeScript
152 lines
5.1 KiB
TypeScript
import { useState } from 'react'
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogFooter,
|
|
} from '@/ui/components/ui/dialog'
|
|
import { Button } from '@/ui/components/ui/button'
|
|
import {
|
|
Select,
|
|
SelectContent,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
} from '@/ui/components/ui/select'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
import { client } from '@/ui/api/client'
|
|
import { FolderTree } from '@/ui/components/folder-tree'
|
|
import { ScrollArea } from '@/ui/components/ui/scroll-area'
|
|
import { m } from '@/ui/paraglide/messages.js'
|
|
import type { AssetInfo, ProjectInfo } from '@shumai/dtos'
|
|
import { Loader2, Folder } from 'lucide-react'
|
|
|
|
interface TaskTargetFolderDialogProps {
|
|
teamId: string
|
|
currentProjectId?: string | null
|
|
currentTargetFolderId?: string | null
|
|
isOpen: boolean
|
|
onClose: () => void
|
|
onSelect: (projectId: string, folderId: string, folderName?: string) => void
|
|
}
|
|
|
|
export function TaskTargetFolderDialog({
|
|
teamId,
|
|
currentProjectId,
|
|
currentTargetFolderId,
|
|
isOpen,
|
|
onClose,
|
|
onSelect,
|
|
}: TaskTargetFolderDialogProps) {
|
|
const [selectedProjectId, setSelectedProjectId] = useState<string>(currentProjectId || '')
|
|
const [selectedFolder, setSelectedFolder] = useState<AssetInfo | null>(null)
|
|
|
|
const { data: projectsData, isLoading: isLoadingProjects } = useQuery({
|
|
queryKey: ['teams', teamId, 'projects'],
|
|
queryFn: async () => {
|
|
const res = await client.api.teams[':teamId'].projects.$get({
|
|
param: { teamId },
|
|
query: { first: '100' },
|
|
})
|
|
if (!res.ok) throw new Error('Failed to fetch projects')
|
|
return (await res.json()) as unknown as { data: ProjectInfo[] }
|
|
},
|
|
enabled: !!teamId && isOpen,
|
|
})
|
|
|
|
const projects = projectsData?.data || []
|
|
const activeProjectId = selectedProjectId || (projects[0]?.id ?? '')
|
|
const selectedProject = projects.find((p) => p.id === activeProjectId)
|
|
|
|
const handleConfirm = () => {
|
|
if (!activeProjectId) return
|
|
const folderId = selectedFolder?.id || selectedProject?.rootFolder
|
|
if (folderId) {
|
|
onSelect(activeProjectId, folderId, selectedFolder?.name || selectedProject?.name)
|
|
onClose()
|
|
}
|
|
}
|
|
|
|
return (
|
|
<Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>
|
|
<DialogContent className="sm:max-w-2xl flex flex-col h-[580px]">
|
|
<DialogHeader>
|
|
<div className="flex items-center gap-2">
|
|
<Folder className="w-5 h-5 text-primary" />
|
|
<DialogTitle>{m.select_target_folder()}</DialogTitle>
|
|
</div>
|
|
</DialogHeader>
|
|
|
|
<div className="flex flex-col gap-3 flex-1 overflow-hidden py-2">
|
|
{/* Project Select */}
|
|
<div className="space-y-1.5">
|
|
<label className="text-xs font-medium text-muted-foreground">
|
|
{m.select_project()}
|
|
</label>
|
|
<Select
|
|
value={activeProjectId}
|
|
onValueChange={(val) => {
|
|
setSelectedProjectId(val)
|
|
setSelectedFolder(null)
|
|
}}
|
|
>
|
|
<SelectTrigger className="h-9">
|
|
<SelectValue placeholder={m.select_project()} />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
{projects.map((p) => (
|
|
<SelectItem key={p.id} value={p.id}>
|
|
{p.name}
|
|
</SelectItem>
|
|
))}
|
|
</SelectContent>
|
|
</Select>
|
|
</div>
|
|
|
|
{/* Folder Tree Scroll Area */}
|
|
<div className="space-y-1.5 flex-1 flex flex-col overflow-hidden">
|
|
<label className="text-xs font-medium text-muted-foreground">{m.target_folder()}</label>
|
|
<div className="border rounded-md flex-1 overflow-hidden bg-sidebar/50">
|
|
<ScrollArea className="h-full">
|
|
{selectedProject && selectedProject.rootFolder ? (
|
|
<FolderTree
|
|
teamId={teamId}
|
|
projectId={selectedProject.id}
|
|
projectName={selectedProject.name}
|
|
rootFolderId={selectedProject.rootFolder}
|
|
onSelect={setSelectedFolder}
|
|
selectedFolderId={
|
|
selectedFolder?.id || currentTargetFolderId || selectedProject.rootFolder
|
|
}
|
|
hideCollections
|
|
hideShares
|
|
hideRecentlyDeleted
|
|
/>
|
|
) : (
|
|
<div className="flex items-center justify-center h-full p-6 text-xs text-muted-foreground">
|
|
{isLoadingProjects ? (
|
|
<Loader2 className="w-5 h-5 animate-spin text-muted-foreground" />
|
|
) : (
|
|
m.no_project_selected()
|
|
)}
|
|
</div>
|
|
)}
|
|
</ScrollArea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<DialogFooter>
|
|
<Button variant="outline" onClick={onClose}>
|
|
{m.cancel()}
|
|
</Button>
|
|
<Button onClick={handleConfirm} disabled={!activeProjectId}>
|
|
{m.confirm()}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|