* refactor: adopt shared Input/Textarea components across 15 files Replace 42 raw <input>/<textarea> elements with <Input>/<Textarea> from components/ui/. Consistent focus states, error handling, and styling across all form fields. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: replace hardcoded rgba/hex colors with Tailwind tokens - rgba(255,255,255,0.xx) → bg-white/[0.xx], border-white/[0.xx] - rgba(6,182,212,0.3) → border-primary/30 (focus states) - #0a0a0a → bg-background - Inline style hex colors → var(--color-primary), var(--color-brand-gradient-to) - 28 files updated, zero hardcoded rgba() patterns remaining Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add PageMeta to 16 pages for SEO and proper browser tab titles Public pages (Login, Register, Forgot/Reset Password, Verify Email, Survey Thank You) get descriptions for SEO. Authenticated pages (Dashboard, Flow Library, My Flows, Session History, AI Assistant, Account Settings, Step Library, My Shares, Feedback, Guides) get proper tab titles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add page transitions and staggered list animations - ViewTransitionOutlet: wraps Outlet with fade-in-up animation keyed to route path. Sidebar/topbar stay still, only content area animates. - StaggerList: reusable component that cascades children with incremental delay (50ms default). Pure CSS via @utility stagger-item. - Applied stagger to TreeGridView, MyTreesPage cards, SessionHistoryPage. - New stagger-fade-in keyframe in @theme block. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: ViewTransitionOutlet needs h-full for React Flow canvas The wrapper div broke the height chain needed by TreeEditorPage's h-full layout, causing React Flow canvas to collapse to zero height. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: main-content flex layout for tree editor + scrollable pages Main content area is now flex-col so the ViewTransitionOutlet wrapper gets an explicit computed height via flex-1 min-h-0. This makes h-full resolve correctly in the tree editor (React Flow canvas) while still allowing overflow-y-auto scrolling for normal pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve ESLint errors in Button and Skeleton components - Button: suppress react-refresh/only-export-components for buttonVariants re-export - Skeleton: replace empty interface with type alias, replace Math.random() with static widths array Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add PageMeta, animation classes, and layout fixes to remaining pages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
135 lines
4.1 KiB
TypeScript
135 lines
4.1 KiB
TypeScript
import { Plus, Pin, Trash2, MessageSquare } from 'lucide-react'
|
|
import { cn } from '@/lib/utils'
|
|
import type { ChatListItem } from '@/types/assistant-chat'
|
|
|
|
interface ChatSidebarProps {
|
|
chats: ChatListItem[]
|
|
activeChatId: string | null
|
|
onSelectChat: (id: string) => void
|
|
onNewChat: () => void
|
|
onDeleteChat: (id: string) => void
|
|
onTogglePin: (id: string, pinned: boolean) => void
|
|
}
|
|
|
|
export function ChatSidebar({
|
|
chats,
|
|
activeChatId,
|
|
onSelectChat,
|
|
onNewChat,
|
|
onDeleteChat,
|
|
onTogglePin,
|
|
}: ChatSidebarProps) {
|
|
const pinnedChats = chats.filter(c => c.pinned)
|
|
const unpinnedChats = chats.filter(c => !c.pinned)
|
|
|
|
return (
|
|
<div
|
|
className="w-72 shrink-0 flex flex-col border-r h-full"
|
|
style={{ borderColor: 'var(--glass-border)' }}
|
|
>
|
|
{/* Header */}
|
|
<div className="px-4 py-3 border-b shrink-0" style={{ borderColor: 'var(--glass-border)' }}>
|
|
<button
|
|
onClick={onNewChat}
|
|
className="w-full flex items-center justify-center gap-2 bg-gradient-brand text-brand-dark font-semibold text-sm rounded-[10px] px-4 py-2.5 hover:opacity-90 active:scale-[0.97] transition-all"
|
|
>
|
|
<Plus size={16} />
|
|
New Chat
|
|
</button>
|
|
</div>
|
|
|
|
{/* Chat list */}
|
|
<div className="flex-1 overflow-y-auto py-2">
|
|
{pinnedChats.length > 0 && (
|
|
<div className="px-3 mb-1">
|
|
<span className="font-label text-[0.625rem] uppercase tracking-widest text-muted-foreground">
|
|
Pinned
|
|
</span>
|
|
</div>
|
|
)}
|
|
{pinnedChats.map(chat => (
|
|
<ChatItem
|
|
key={chat.id}
|
|
chat={chat}
|
|
isActive={chat.id === activeChatId}
|
|
onSelect={() => onSelectChat(chat.id)}
|
|
onDelete={() => onDeleteChat(chat.id)}
|
|
onTogglePin={() => onTogglePin(chat.id, !chat.pinned)}
|
|
/>
|
|
))}
|
|
|
|
{pinnedChats.length > 0 && unpinnedChats.length > 0 && (
|
|
<div className="mx-3 my-2 border-b" style={{ borderColor: 'var(--glass-border)' }} />
|
|
)}
|
|
|
|
{unpinnedChats.map(chat => (
|
|
<ChatItem
|
|
key={chat.id}
|
|
chat={chat}
|
|
isActive={chat.id === activeChatId}
|
|
onSelect={() => onSelectChat(chat.id)}
|
|
onDelete={() => onDeleteChat(chat.id)}
|
|
onTogglePin={() => onTogglePin(chat.id, !chat.pinned)}
|
|
/>
|
|
))}
|
|
|
|
{chats.length === 0 && (
|
|
<div className="px-4 py-8 text-center text-muted-foreground text-sm">
|
|
No conversations yet
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
function ChatItem({
|
|
chat,
|
|
isActive,
|
|
onSelect,
|
|
onDelete,
|
|
onTogglePin,
|
|
}: {
|
|
chat: ChatListItem
|
|
isActive: boolean
|
|
onSelect: () => void
|
|
onDelete: () => void
|
|
onTogglePin: () => void
|
|
}) {
|
|
return (
|
|
<div
|
|
onClick={onSelect}
|
|
className={cn(
|
|
'group flex items-center gap-2 px-3 py-2.5 mx-1.5 rounded-lg cursor-pointer transition-colors',
|
|
isActive
|
|
? 'bg-primary/10 text-foreground'
|
|
: 'text-muted-foreground hover:bg-white/[0.04] hover:text-foreground'
|
|
)}
|
|
>
|
|
<MessageSquare size={14} className="shrink-0" />
|
|
<div className="flex-1 min-w-0">
|
|
<div className="text-[0.8125rem] font-medium truncate">{chat.title}</div>
|
|
<div className="text-[0.6875rem] text-muted-foreground">
|
|
{chat.message_count} messages
|
|
</div>
|
|
</div>
|
|
<div className="flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
<button
|
|
onClick={e => { e.stopPropagation(); onTogglePin() }}
|
|
className="p-1 rounded hover:bg-white/[0.08]"
|
|
title={chat.pinned ? 'Unpin' : 'Pin'}
|
|
>
|
|
<Pin size={12} className={chat.pinned ? 'text-primary' : ''} />
|
|
</button>
|
|
<button
|
|
onClick={e => { e.stopPropagation(); onDelete() }}
|
|
className="p-1 rounded hover:bg-white/[0.08] text-muted-foreground hover:text-rose-400"
|
|
title="Delete"
|
|
>
|
|
<Trash2 size={12} />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|