@@ -19,7 +19,23 @@ import { LinkPreview } from './BadgePreviews/LinkPreview'
1919import { TextPreview } from './BadgePreviews/TextPreview'
2020import { TimePreview } from './BadgePreviews/TimePreview'
2121
22- // Type colors definition - single source of truth
22+ // Map types to their icons - source of truth for badge types
23+ export const typeIcons = {
24+ blank : Code ,
25+ code : Code ,
26+ hideTrashed : EyeOff ,
27+ image : Image ,
28+ link : Link ,
29+ open : Monitor ,
30+ sent : MailCheck ,
31+ settings : Settings ,
32+ text : TextSelect ,
33+ time : Clock ,
34+ trashed : Trash2 ,
35+ unsent : MessageSquareDashed ,
36+ } as const
37+
38+ // Type colors definition - must be exhaustive with typeIcons
2339export const typeColors = {
2440 blank : 'bg-transparent text-gray-700' ,
2541 code : 'bg-pink-50 text-pink-700' ,
@@ -33,7 +49,7 @@ export const typeColors = {
3349 time : 'bg-gray-50 text-gray-700' ,
3450 trashed : 'bg-gray-50 text-yellow-700' ,
3551 unsent : 'bg-amber-100 text-amber-700' ,
36- } as const
52+ } as const satisfies Record < keyof typeof typeIcons , string >
3753
3854// TV configuration for stat badges
3955export const badgeCVA = tv ( {
@@ -54,26 +70,10 @@ export const badgeCVA = tv({
5470 } ,
5571} )
5672
57- // Map types to their icons
58- export const typeIcons = {
59- blank : Code ,
60- code : Code ,
61- hideTrashed : EyeOff ,
62- image : Image ,
63- link : Link ,
64- open : Monitor ,
65- sent : MailCheck ,
66- settings : Settings ,
67- text : TextSelect ,
68- time : Clock ,
69- trashed : Trash2 ,
70- unsent : MessageSquareDashed ,
71- } as const
72-
73- export const typeTooltips : { [ key : string ] : ( ) => JSX . Element | undefined } = {
73+ export const typeTooltips = {
7474 code : CodePreview ,
7575 image : ImagePreview ,
7676 link : LinkPreview ,
7777 text : TextPreview ,
7878 time : TimePreview ,
79- }
79+ } satisfies Partial < Record < keyof typeof typeIcons , ( ) => JSX . Element | undefined > >
0 commit comments