@@ -2,6 +2,7 @@ import { type JSX, useState } from 'react'
22import { twMerge } from 'tailwind-merge'
33import type { VariantProps } from 'tailwind-variants'
44import { badgeCVA , typeColors , typeIcons } from '@/components/design'
5+ import type { CommentTableRow } from '@/entrypoints/background'
56
67import { CodePreview } from './BadgePopups/CodePreview'
78import { ImagePreview } from './BadgePopups/ImagePreview'
@@ -17,12 +18,16 @@ const typePopups = {
1718 open : OpenTabPopup ,
1819 text : TextPreview ,
1920 time : TimePreview ,
20- } satisfies Partial < Record < keyof typeof typeIcons , ( props ?: any ) => JSX . Element > >
21+ } satisfies Partial < Record < keyof typeof typeIcons , ( props : BadgePopupProps ) => JSX . Element > >
22+
23+ export interface BadgePopupProps {
24+ row : CommentTableRow
25+ }
2126
2227export type BadgeProps = VariantProps < typeof badgeCVA > & {
2328 type : keyof typeof typeIcons
2429 text ?: number | string
25- data ?: any
30+ data ?: CommentTableRow
2631}
2732
2833const Badge = ( { text, type, data } : BadgeProps ) => {
@@ -48,14 +53,14 @@ const Badge = ({ text, type, data }: BadgeProps) => {
4853 { type === 'blank' || < Icon className = 'h-3 w-3' /> }
4954 { text || type }
5055 </ span >
51- { PopupComponent && (
56+ { PopupComponent && data && (
5257 < div
5358 className = { twMerge (
5459 'absolute top-full z-10 w-30 rounded border px-2 py-1 text-left text-xs shadow-lg' ,
5560 typeColors [ type ] ,
5661 ) }
5762 >
58- < PopupComponent { ... data } />
63+ < PopupComponent row = { data } />
5964 </ div >
6065 ) }
6166 </ button >
0 commit comments