feat(webui): add chatbot layout and drag-drop context store

This commit is contained in:
yiling
2026-07-11 10:16:46 +08:00
parent 6ede64495f
commit 8d2d915f36
26 changed files with 665 additions and 100 deletions
+91 -56
View File
@@ -23,7 +23,16 @@ import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import type { AncestorFolder } from '@shumai/dtos'
import { Link, useNavigate } from '@tanstack/react-router'
import { Check, ChevronDown, Columns2, FileIcon, History, LayoutGrid, List } from 'lucide-react'
import {
Check,
ChevronDown,
Columns2,
FileIcon,
History,
LayoutGrid,
List,
MessageSquare,
} from 'lucide-react'
interface BreadcrumbNavProps {
teamId: string
@@ -43,6 +52,8 @@ interface BreadcrumbNavProps {
onLeftSidebarToggle?: () => void
isRightSidebarCollapsed: boolean
onRightSidebarToggle: () => void
isChatbotOpen?: boolean
onChatbotToggle?: () => void
isPublic?: boolean
shareId?: string
onFolderClick?: (folderId: string) => void
@@ -81,6 +92,8 @@ export function BreadcrumbNav({
onLeftSidebarToggle,
isRightSidebarCollapsed,
onRightSidebarToggle,
isChatbotOpen = false,
onChatbotToggle,
isPublic = false,
onFolderClick,
fileId,
@@ -364,67 +377,89 @@ export function BreadcrumbNav({
)}
</div>
{!fileId && (
<div className="flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1">
{/* Left Sidebar Toggle */}
{!isPublic && onLeftSidebarToggle && (
<button
onClick={onLeftSidebarToggle}
className="rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
title={isLeftSidebarCollapsed ? 'Show Left Sidebar' : 'Hide Left Sidebar'}
>
{isLeftSidebarCollapsed ? (
<DockToLeft className="h-4 w-4" />
) : (
<DockToLeftFilled className="h-4 w-4 fill-primary stroke-0" />
)}
</button>
)}
{/* Card View */}
{!isPublic && displayStyle && onDisplayStyleChange && (
<>
<button
onClick={() => onDisplayStyleChange('card')}
className={`rounded p-1.5 transition-colors ${
displayStyle === 'card'
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
}`}
title="Card View"
>
<LayoutGrid className="h-4 w-4" />
</button>
{/* List View */}
<button
onClick={() => onDisplayStyleChange('list')}
className={`rounded p-1.5 transition-colors ${
displayStyle === 'list'
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
}`}
title="List View"
>
<List className="h-4 w-4" />
</button>
</>
)}
{/* Right Sidebar Toggle */}
<div className="flex flex-shrink-0 items-center gap-1 rounded-md border border-border bg-background p-1">
{/* Left Sidebar Toggle */}
{!fileId && !isPublic && onLeftSidebarToggle && (
<button
onClick={onRightSidebarToggle}
onClick={onLeftSidebarToggle}
className="rounded p-1.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
title={isRightSidebarCollapsed ? 'Show Right Sidebar' : 'Hide Right Sidebar'}
title={isLeftSidebarCollapsed ? 'Show Left Sidebar' : 'Hide Left Sidebar'}
>
{isRightSidebarCollapsed ? (
<DockToRight className="h-4 w-4" />
{isLeftSidebarCollapsed ? (
<DockToLeft className="h-4 w-4" />
) : (
<DockToRightFilled className="h-4 w-4 fill-primary stroke-0" />
<DockToLeftFilled className="h-4 w-4 fill-primary stroke-0" />
)}
</button>
</div>
)}
)}
{/* Card View */}
{!fileId && !isPublic && displayStyle && onDisplayStyleChange && (
<>
<button
onClick={() => onDisplayStyleChange('card')}
className={`rounded p-1.5 transition-colors ${
displayStyle === 'card'
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
}`}
title="Card View"
>
<LayoutGrid className="h-4 w-4" />
</button>
{/* List View */}
<button
onClick={() => onDisplayStyleChange('list')}
className={`rounded p-1.5 transition-colors ${
displayStyle === 'list'
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
}`}
title="List View"
>
<List className="h-4 w-4" />
</button>
</>
)}
{/* Right Sidebar Toggle */}
<button
onClick={onRightSidebarToggle}
className={`rounded p-1.5 transition-colors ${
!isRightSidebarCollapsed && !isChatbotOpen
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
}`}
title={isRightSidebarCollapsed ? 'Show Right Sidebar' : 'Hide Right Sidebar'}
>
{!isRightSidebarCollapsed && !isChatbotOpen ? (
<DockToRightFilled className="h-4 w-4 fill-primary stroke-0" />
) : (
<DockToRight className="h-4 w-4" />
)}
</button>
{/* Chatbot Toggle Button */}
{!isPublic && onChatbotToggle && (
<button
onClick={onChatbotToggle}
className={`rounded p-1.5 transition-colors ${
isChatbotOpen
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent/50 hover:text-foreground'
}`}
title={isChatbotOpen ? m.hide_chatbot() : m.show_chatbot()}
>
<MessageSquare
className={cn(
'h-4 w-4 transition-colors',
isChatbotOpen ? 'text-primary fill-primary stroke-1' : 'text-muted-foreground',
)}
/>
</button>
)}
</div>
</div>
)
}