Spaces:
Runtime error
Runtime error
File size: 12,413 Bytes
d03d74d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | # Vault - UI Components
**Generated:** 2026-02-11
**Framework:** React 19 + shadcn/ui
**Styling:** Tailwind CSS 4
---
## Design System
### Theme Configuration
**Dark Theme (Default)**
| Token | Value | Usage |
|-------|-------|-------|
| `--background` | `#0A0B14` | Page backgrounds |
| `--foreground` | `#FFFFFF` | Primary text |
| `--primary` | `#4169FF` | Primary actions |
| `--muted` | `#1A1B2E` | Secondary backgrounds |
| `--border` | `#2A2B3E` | Borders, dividers |
### Breakpoints
| Breakpoint | Width | Target |
|------------|-------|--------|
| `sm` | 375px | Mobile (iOS Safari) |
| `md` | 768px | Tablet |
| `lg` | 1200px | Desktop |
### Glassmorphism Pattern
```css
.glass {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
```
---
## Shared UI Components
Located in [`src/components/ui/`](../src/components/ui/). These are shadcn/ui components with minimal customization.
### Layout Components
#### `Card`
Container for grouped content.
```tsx
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@/components/ui/card';
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardContent>Content</CardContent>
<CardFooter>Footer</CardFooter>
</Card>
```
#### `Badge`
Status indicators and labels.
```tsx
import { Badge } from '@/components/ui/badge';
<Badge variant="default">Default</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
```
**Custom Variants:**
- `IN_STOCK` - Green background
- `SOLD_OUT` - Gray background
- `DISCONTINUED` - Blue background
### Form Components
#### `Button`
Primary interactive element.
```tsx
import { Button } from '@/components/ui/button';
<Button variant="default">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="destructive">Destructive</Button>
<Button size="sm">Small</Button>
<Button size="lg">Large</Button>
```
#### `Input`
Text input field.
```tsx
import { Input } from '@/components/ui/input';
<Input type="text" placeholder="Enter text" />
```
#### `Textarea`
Multi-line text input.
```tsx
import { Textarea } from '@/components/ui/textarea';
<Textarea placeholder="Enter description" />
```
#### `Select`
Dropdown selection.
```tsx
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
<Select>
<SelectTrigger>
<SelectValue placeholder="Select option" />
</SelectTrigger>
<SelectContent>
<SelectItem value="1">Option 1</SelectItem>
<SelectItem value="2">Option 2</SelectItem>
</SelectContent>
</Select>
```
#### `Checkbox`
Boolean input.
```tsx
import { Checkbox } from '@/components/ui/checkbox';
<Checkbox id="terms" />
```
### Feedback Components
#### `Dialog`
Modal overlay.
```tsx
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog';
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Title</DialogTitle>
<DialogDescription>Description</DialogDescription>
</DialogHeader>
{/* Content */}
</DialogContent>
</Dialog>
```
#### `AlertDialog`
Confirmation dialog.
```tsx
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from '@/components/ui/alert-dialog';
<AlertDialog>
<AlertDialogTrigger>Delete</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
<AlertDialogDescription>This action cannot be undone.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
```
#### `Sonner` (Toast)
Toast notifications.
```tsx
import { toast } from 'sonner';
toast.success('Success message');
toast.error('Error message');
toast.info('Info message');
```
### Navigation Components
#### `Tabs`
Tabbed navigation.
```tsx
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
<Tabs defaultValue="tab1">
<TabsList>
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
</TabsList>
<TabsContent value="tab1">Content 1</TabsContent>
<TabsContent value="tab2">Content 2</TabsContent>
</Tabs>
```
#### `DropdownMenu`
Dropdown navigation.
```tsx
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from '@/components/ui/dropdown-menu';
<DropdownMenu>
<DropdownMenuTrigger>Open</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>Item 1</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem>Item 2</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
```
### Data Display Components
#### `Avatar`
User avatar display.
```tsx
import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar';
<Avatar>
<AvatarImage src="/avatar.png" />
<AvatarFallback>JD</AvatarFallback>
</Avatar>
```
#### `Skeleton`
Loading placeholder.
```tsx
import { Skeleton } from '@/components/ui/skeleton';
<Skeleton className="h-4 w-[250px]" />
```
---
## Feature Components
### Vault Components
Located in [`src/features/vault/components/`](../src/features/vault/components/).
#### `VaultGrid`
Main product grid display.
**File:** [`vault-grid.tsx`](../src/features/vault/components/vault-grid.tsx)
**Props:**
```typescript
interface VaultGridProps {
vault: CreatorVault;
products?: ProductCard[];
editUrl?: string;
hideVideos?: boolean;
}
```
**Features:**
- Client-side category filtering
- Responsive grid layout
- Empty state handling
- Video/product toggle
#### `ProductCard`
Individual product display.
**File:** [`product-card.tsx`](../src/features/vault/components/product-card.tsx)
**Props:**
```typescript
interface ProductCardProps {
id: string;
objectName: string;
category: string;
thumbnailUrl?: string;
frameTimestamp: number;
marketplaceMatches: MarketplaceMatch[];
videoId: string;
creatorId: string;
isAdmin?: boolean;
onRefresh?: () => void;
}
```
**Features:**
- Availability status badges
- Affiliate link redirect
- "I want this" interest capture
- FTC disclosure display
- Admin quick actions
#### `CategoryFilter`
Category tab navigation.
**File:** [`category-filter.tsx`](../src/features/vault/components/category-filter.tsx)
**Features:**
- URL parameter sync
- "All Items" default
- Dynamic category list
#### `SearchBar`
Product search input.
**File:** [`search-bar.tsx`](../src/features/vault/components/search-bar.tsx)
**Features:**
- Debounced search
- Loading state
- Results dropdown
#### `VideoCard`
Video thumbnail display.
**File:** [`video-card.tsx`](../src/features/vault/components/video-card.tsx)
**Features:**
- Play button overlay
- View count display
- Product count badge
### Moderation Components
Located in [`src/features/moderation/components/`](../src/features/moderation/components/).
#### `ModerationQueue`
Creator moderation interface.
**File:** [`moderation-queue.tsx`](../src/features/moderation/components/moderation-queue.tsx)
**Props:**
```typescript
interface ModerationQueueProps {
initialDetections: Detection[];
userId: string;
videos: { id: string; title: string }[];
stats: { pending: number; approved: number; rejected: number };
initialStatus?: 'PENDING' | 'APPROVED' | 'REJECTED';
}
```
**Features:**
- Status filtering
- Confidence filtering
- Video filtering
- Link status filtering
- Bulk selection
- Bulk approve/reject
- Click/interest sorting
#### `EditDetectionDialog`
Edit detection details.
**File:** [`edit-detection-dialog.tsx`](../src/features/moderation/components/edit-detection-dialog.tsx)
**Features:**
- Edit object name
- Change category
- Update thumbnail URL
- Add/edit marketplace links
#### `AddProductDialog`
Manually add product to video.
**File:** [`add-product-dialog.tsx`](../src/features/moderation/components/add-product-dialog.tsx)
**Features:**
- Object name input
- Category selection
- Timestamp input
- Marketplace link addition
#### `AdminModerationQueue`
Admin moderation interface.
**File:** [`admin-moderation-queue.tsx`](../src/features/moderation/components/admin-moderation-queue.tsx)
**Features:**
- High-ambiguity filtering
- Admin correction modal
- Mark incorrect with reason
- AI training flag
### Interest Components
Located in [`src/features/interest/components/`](../src/features/interest/components/).
#### `InterestCaptureModal`
"I want this" email capture.
**File:** [`interest-capture-modal.tsx`](../src/features/interest/components/interest-capture-modal.tsx)
**Props:**
```typescript
interface InterestCaptureModalProps {
isOpen: boolean;
onClose: () => void;
marketplaceMatchId?: string;
detectedObjectId?: string;
productName: string;
videoId?: string;
creatorId?: string;
}
```
**Features:**
- Email input
- GDPR consent checkbox
- Duplicate detection
- Success state
- Affiliate link submission option
### Analytics Components
Located in [`src/features/analytics/components/`](../src/features/analytics/components/).
#### `KeyMetricsRow`
Dashboard metrics display.
**File:** [`key-metrics-row.tsx`](../src/features/analytics/components/key-metrics-row.tsx)
**Props:**
```typescript
interface KeyMetricsRowProps {
stats?: {
totalClicks: number;
totalPledges: number;
totalRequests: number;
monetizedCount: number;
};
}
```
**Metrics:**
- Total Clicks
- Interest Pledges
- Product Requests
- Monetized Videos
### Auth Components
Located in [`src/components/auth/`](../src/components/auth/).
#### `UserNav`
User avatar dropdown.
**File:** [`user-nav.tsx`](../src/components/auth/user-nav.tsx)
**Features:**
- Avatar display
- Name display
- Dashboard link
- Sign out action
#### `SignInForm`
Login form.
**File:** [`sign-in-form.tsx`](../src/components/auth/sign-in-form.tsx)
**Features:**
- Google OAuth button
- Redirect after login
#### `SignUpForm`
Registration form.
**File:** [`sign-up-form.tsx`](../src/components/auth/sign-up-form.tsx)
**Features:**
- Google OAuth button
- Terms acceptance
---
## Common Patterns
### Loading States
```tsx
import { Skeleton } from '@/components/ui/skeleton';
// Card skeleton
<Card>
<CardHeader>
<Skeleton className="h-4 w-3/4" />
<Skeleton className="h-3 w-1/2" />
</CardHeader>
<CardContent>
<Skeleton className="h-32 w-full" />
</CardContent>
</Card>
// Grid skeleton
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
{Array.from({ length: 8 }).map((_, i) => (
<ProductCardSkeleton key={i} />
))}
</div>
```
### Error Boundaries
```tsx
// In page component
if (!vault) {
return (
<div className="min-h-screen flex items-center justify-center">
<div className="text-center">
<h2 className="text-2xl font-bold">Unable to load vault</h2>
<p className="text-muted-foreground">Please try again later.</p>
</div>
</div>
);
}
```
### Optimistic Updates
```tsx
const [isPending, startTransition] = useTransition();
const handleApprove = () => {
startTransition(async () => {
const result = await approveDetection(detectionId);
if (result.success) {
toast.success('Detection approved');
// Update local state optimistically
setDetections(prev => prev.filter(d => d.id !== detectionId));
} else {
toast.error(result.error);
}
});
};
```
### Responsive Design
```tsx
// Mobile-first responsive classes
<div className="
grid
grid-cols-1
sm:grid-cols-2
md:grid-cols-3
lg:grid-cols-4
gap-4
">
{products.map(product => (
<ProductCard key={product.id} {...product} />
))}
</div>
```
---
## Related Documentation
- [Project Overview](./project-overview.md) - Architecture and features
- [Source Tree](./source-tree.md) - File locations
- [Development Guide](./development-guide.md) - Setup instructions
|