|
1 | | -import { cva, type VariantProps } from 'class-variance-authority' |
2 | | -import { |
3 | | - Clock, |
4 | | - Code, |
5 | | - Eye, |
6 | | - EyeOff, |
7 | | - Image, |
8 | | - Link, |
9 | | - MailCheck, |
10 | | - MessageSquareDashed, |
11 | | - Monitor, |
12 | | - Search, |
13 | | - Settings, |
14 | | - TextSelect, |
15 | | - Trash2, |
16 | | -} from 'lucide-react' |
| 1 | +import type { VariantProps } from 'class-variance-authority' |
| 2 | +import { Eye, EyeOff, Search, Settings, Trash2 } from 'lucide-react' |
17 | 3 | import { useMemo, useState } from 'react' |
18 | 4 | import { twMerge } from 'tailwind-merge' |
| 5 | +import { statBadge, typeIcons } from '@/components/design' |
19 | 6 | import type { CommentTableRow } from '@/entrypoints/background' |
| 7 | +import type { FilterState } from '@/entrypoints/popup/popup' |
20 | 8 | import { EnhancerRegistry } from '@/lib/registries' |
21 | 9 | import { generateMockDrafts } from './replicaData' |
22 | 10 |
|
23 | | -interface FilterState { |
24 | | - sentFilter: 'both' | 'sent' | 'unsent' |
25 | | - searchQuery: string |
26 | | - showTrashed: boolean |
27 | | -} |
28 | | - |
29 | | -// CVA configuration for stat badges |
30 | | -const statBadge = cva( |
31 | | - 'inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-normal h-5', |
32 | | - { |
33 | | - defaultVariants: { |
34 | | - clickable: false, |
35 | | - }, |
36 | | - variants: { |
37 | | - clickable: { |
38 | | - false: '', |
39 | | - true: 'cursor-pointer border border-transparent hover:border-current border-dashed', |
40 | | - }, |
41 | | - selected: { |
42 | | - false: '', |
43 | | - true: '!border-solid !border-current', |
44 | | - }, |
45 | | - type: { |
46 | | - blank: 'bg-transparent text-gray-700', |
47 | | - code: 'bg-pink-50 text-pink-700', |
48 | | - hideTrashed: 'bg-transparent text-gray-700', |
49 | | - image: 'bg-purple-50 text-purple-700', |
50 | | - link: 'bg-blue-50 text-blue-700', |
51 | | - open: 'bg-cyan-50 text-cyan-700', |
52 | | - sent: 'bg-green-50 text-green-700', |
53 | | - settings: 'bg-gray-50 text-gray-700', |
54 | | - text: 'bg-gray-50 text-gray-700', |
55 | | - time: 'bg-gray-50 text-gray-700', |
56 | | - trashed: 'bg-gray-50 text-yellow-700', |
57 | | - unsent: 'bg-amber-100 text-amber-700', |
58 | | - }, |
59 | | - }, |
60 | | - }, |
61 | | -) |
62 | | - |
63 | | -// Map types to their icons |
64 | | -const typeIcons = { |
65 | | - blank: Code, |
66 | | - code: Code, |
67 | | - hideTrashed: EyeOff, |
68 | | - image: Image, |
69 | | - link: Link, |
70 | | - open: Monitor, |
71 | | - sent: MailCheck, |
72 | | - settings: Settings, |
73 | | - text: TextSelect, |
74 | | - time: Clock, |
75 | | - trashed: Trash2, |
76 | | - unsent: MessageSquareDashed, |
77 | | -} as const |
78 | | - |
79 | 11 | // StatBadge component |
80 | | -type BadgeProps = VariantProps<typeof statBadge> & { |
| 12 | +export type BadgeProps = VariantProps<typeof statBadge> & { |
81 | 13 | type: keyof typeof typeIcons |
82 | 14 | text?: number | string |
83 | 15 | } |
|
0 commit comments