Files
autocoder/ui/src/components/ActivityFeed.tsx
Auto c917582a64 refactor(ui): migrate to shadcn/ui components and fix scroll issues
Migrate UI component library from custom implementations to shadcn/ui:
- Add shadcn/ui primitives (Button, Card, Dialog, Input, etc.)
- Replace custom styles with Tailwind CSS v4 theme configuration
- Remove custom-theme.css in favor of globals.css with @theme directive

Fix scroll overflow issues in multiple components:
- ProjectSelector: "New Project" button no longer overlays project list
- FolderBrowser: folder list now scrolls properly within modal
- AgentCard: log modal content stays within bounds
- ConversationHistory: conversation list scrolls correctly
- KanbanColumn: feature cards scroll within fixed height
- ScheduleModal: schedule form content scrolls properly

Key technical changes:
- Replace ScrollArea component with native overflow-y-auto divs
- Add min-h-0 to flex containers to allow proper shrinking
- Restructure dropdown layouts with flex-col for fixed footers

New files:
- ui/components.json (shadcn/ui configuration)
- ui/src/components/ui/* (20 UI primitive components)
- ui/src/lib/utils.ts (cn utility for class merging)
- ui/tsconfig.app.json (app-specific TypeScript config)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 18:25:55 +02:00

116 lines
3.3 KiB
TypeScript

import { Activity } from 'lucide-react'
import { AgentAvatar } from './AgentAvatar'
import type { AgentMascot } from '../lib/types'
import { Card, CardContent } from '@/components/ui/card'
interface ActivityItem {
agentName: string
thought: string
timestamp: string
featureId: number
}
interface ActivityFeedProps {
activities: ActivityItem[]
maxItems?: number
showHeader?: boolean
}
function formatTimestamp(timestamp: string): string {
const date = new Date(timestamp)
const now = new Date()
const diffMs = now.getTime() - date.getTime()
const diffSec = Math.floor(diffMs / 1000)
if (diffSec < 5) return 'just now'
if (diffSec < 60) return `${diffSec}s ago`
if (diffSec < 3600) return `${Math.floor(diffSec / 60)}m ago`
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
}
export function ActivityFeed({ activities, maxItems = 5, showHeader = true }: ActivityFeedProps) {
const displayedActivities = activities.slice(0, maxItems)
if (displayedActivities.length === 0) {
return null
}
return (
<div>
{showHeader && (
<div className="flex items-center gap-2 mb-2">
<Activity size={14} className="text-muted-foreground" />
<span className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
Recent Activity
</span>
</div>
)}
<div className="space-y-2">
{displayedActivities.map((activity) => (
<Card
key={`${activity.featureId}-${activity.timestamp}-${activity.thought.slice(0, 20)}`}
className="py-1.5"
>
<CardContent className="p-2 flex items-start gap-2">
<AgentAvatar
name={activity.agentName as AgentMascot}
state="working"
size="sm"
/>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
<span className="text-xs font-semibold" style={{
color: getMascotColor(activity.agentName as AgentMascot)
}}>
{activity.agentName}
</span>
<span className="text-[10px] text-muted-foreground">
#{activity.featureId}
</span>
<span className="text-[10px] text-muted-foreground ml-auto">
{formatTimestamp(activity.timestamp)}
</span>
</div>
<p className="text-xs text-muted-foreground truncate" title={activity.thought}>
{activity.thought}
</p>
</div>
</CardContent>
</Card>
))}
</div>
</div>
)
}
function getMascotColor(name: AgentMascot): string {
const colors: Record<AgentMascot, string> = {
// Original 5
Spark: '#3B82F6',
Fizz: '#F97316',
Octo: '#8B5CF6',
Hoot: '#22C55E',
Buzz: '#EAB308',
// Tech-inspired
Pixel: '#EC4899',
Byte: '#06B6D4',
Nova: '#F43F5E',
Chip: '#84CC16',
Bolt: '#FBBF24',
// Energetic
Dash: '#14B8A6',
Zap: '#A855F7',
Gizmo: '#64748B',
Turbo: '#EF4444',
Blip: '#10B981',
// Playful
Neon: '#D946EF',
Widget: '#6366F1',
Zippy: '#F59E0B',
Quirk: '#0EA5E9',
Flux: '#7C3AED',
}
return colors[name] || '#6B7280'
}