@@ -219,83 +219,38 @@ function getPercentageGradient(percentage: number): {
219219 ) ;
220220}
221221
222- // Component for individual tab button to reduce complexity
223- interface TabButtonProps {
224- tab : TabConfig < any > ;
222+ // Simple tab button component
223+ interface TabButtonProps < TData > {
224+ tab : TabConfig < TData > ;
225225 isActive : boolean ;
226226 itemCount : number ;
227- isTabLoading ?: boolean ;
228- isTransitioning : boolean ;
229227 onTabChange : ( tabId : string ) => void ;
230228}
231229
232230const TabButton = ( {
233231 tab,
234232 isActive,
235233 itemCount,
236- isTabLoading = false ,
237- isTransitioning,
238234 onTabChange,
239235} : TabButtonProps ) => (
240236 < button
241237 aria-controls = { `tabpanel-${ tab . id } ` }
242238 aria-selected = { isActive }
243239 className = { cn (
244- 'relative flex items-center gap-2 rounded-md px-3 py-2 font-medium text-sm transition-all duration-200' ,
245- 'disabled:cursor-not-allowed disabled:opacity-60' ,
246- 'group overflow-hidden' ,
240+ 'cursor-pointer border-b-2 px-3 py-2 text-sm transition-all duration-100 hover:text-foreground' ,
247241 isActive
248- ? 'scale-[1.02] transform bg-sidebar text-sidebar-foreground shadow-md'
249- : 'text-sidebar-foreground/70 hover:scale-[1.01] hover:transform hover:bg-sidebar-accent/40 hover:text-sidebar-foreground hover:shadow-sm' ,
250- isTabLoading && 'cursor-wait opacity-75'
242+ ? 'border-foreground text-foreground'
243+ : 'border-transparent text-muted-foreground'
251244 ) }
252- disabled = { isTransitioning || isTabLoading }
253245 onClick = { ( ) => onTabChange ( tab . id ) }
254246 role = "tab"
255- tabIndex = { isActive ? 0 : - 1 }
256247 type = "button"
257248 >
258- { /* Active indicator */ }
259- { isActive && (
260- < div className = "absolute inset-0 animate-pulse rounded-md bg-gradient-to-r from-primary/20 to-primary/5" />
261- ) }
262-
263- { /* Tab content */ }
264- < div className = "relative z-10 flex items-center gap-2" >
265- { /* Loading spinner */ }
266- { isTabLoading && (
267- < SpinnerIcon className = "h-3.5 w-3.5 animate-spin text-sidebar-foreground/60" />
268- ) }
269-
270- < span
271- className = { cn (
272- 'transition-colors duration-200' ,
273- isActive
274- ? 'text-sidebar-foreground'
275- : 'text-sidebar-foreground/80 group-hover:text-sidebar-foreground'
276- ) }
277- >
278- { tab . label }
249+ { tab . label }
250+ { itemCount > 0 && (
251+ < span className = "ml-1 text-xs opacity-60" >
252+ ({ itemCount > 999 ? '999+' : itemCount } )
279253 </ span >
280-
281- { /* Count badge */ }
282- { itemCount > 0 && ! isTabLoading && (
283- < span
284- className = { cn (
285- 'inline-flex h-5 min-w-[18px] items-center justify-center rounded-full px-1.5 font-semibold text-[10px] transition-all duration-200' ,
286- isActive
287- ? 'border border-primary/30 bg-primary/20 text-primary shadow-sm'
288- : 'border border-transparent bg-sidebar-foreground/20 text-sidebar-foreground/70 group-hover:bg-sidebar-foreground/30 group-hover:text-sidebar-foreground'
289- ) }
290- >
291- { itemCount > 999 ? '999+' : itemCount > 99 ? '99+' : itemCount }
292- </ span >
293- ) }
294- </ div >
295-
296- { /* Hover effect */ }
297- { ! ( isActive || isTabLoading ) && (
298- < div className = "absolute inset-0 rounded-md bg-gradient-to-r from-transparent via-sidebar-accent/20 to-transparent opacity-0 transition-opacity duration-300 group-hover:opacity-100" />
299254 ) }
300255 </ button >
301256) ;
@@ -450,37 +405,28 @@ function FullScreenTable<TData extends { name: string | number }>({
450405 < XIcon size = { 20 } />
451406 </ button >
452407 </ div >
453- { /* Tab bar, consistent with main DataTable */ }
408+ { /* Tab bar */ }
454409 { tabs && tabs . length > 1 && (
455410 < div className = "mt-2 px-3" >
456- < div className = "flex gap-0.5 rounded-lg bg-sidebar-accent/20 p-1 backdrop-blur-sm " >
411+ < div className = "flex gap-1 border-b " >
457412 { tabs . map ( ( tab , idx ) => {
458413 const isActive = activeTab === tab . id ;
459414 const itemCount = tab ?. data ?. length || 0 ;
460- const isTabLoading = tabLoadingStates ?. [ tab . id ] ;
461415
462416 return (
463- < div
417+ < TabButton
418+ isActive = { isActive }
419+ itemCount = { itemCount }
464420 key = { tab . id }
465- ref = { ( el ) => {
466- tabRefs . current [ idx ] = el ;
421+ onTabChange = { ( tabId ) => {
422+ handleTabKeyDown (
423+ { key : 'Enter' } as React . KeyboardEvent ,
424+ idx
425+ ) ;
426+ onTabChange ?.( tabId ) ;
467427 } }
468- >
469- < TabButton
470- isActive = { isActive }
471- isTabLoading = { isTabLoading }
472- isTransitioning = { isTransitioning }
473- itemCount = { itemCount }
474- onTabChange = { ( tabId ) => {
475- handleTabKeyDown (
476- { key : 'Enter' } as React . KeyboardEvent ,
477- idx
478- ) ;
479- onTabChange ?.( tabId ) ;
480- } }
481- tab = { tab }
482- />
483- </ div >
428+ tab = { tab }
429+ />
484430 ) ;
485431 } ) }
486432 </ div >
@@ -710,19 +656,6 @@ function FullScreenTable<TData extends { name: string | number }>({
710656 } ) }
711657 </ TableBody >
712658 </ Table >
713- { /* Tooltip for truncated cell */ }
714- { tooltip && (
715- < div
716- className = "pointer-events-none fixed z-50 rounded bg-foreground px-3 py-1 text-background text-xs shadow-lg"
717- style = { {
718- left : tooltip . x ,
719- top : tooltip . y - 32 ,
720- transform : 'translateX(-50%)' ,
721- } }
722- >
723- { tooltip . value }
724- </ div >
725- ) }
726659 </ div >
727660 </ div >
728661 ) ;
@@ -915,7 +848,7 @@ export function DataTable<TData extends { name: string | number }, TValue>({
915848
916849 { tabs && tabs . length > 1 && (
917850 < div className = "mt-3" >
918- < div className = "flex gap-0.5 rounded bg-sidebar-accent/30 p-0.5 " >
851+ < div className = "flex gap-1 border-b " >
919852 { tabs . map ( ( tab ) => (
920853 < Skeleton className = "h-8 w-20 rounded" key = { tab . id } />
921854 ) ) }
@@ -973,18 +906,15 @@ export function DataTable<TData extends { name: string | number }, TValue>({
973906 </ div >
974907
975908 { tabs && tabs . length > 1 && (
976- < div className = "mt-3 overflow-hidden " >
977- < div className = "flex gap-0.5 rounded-lg bg-sidebar-accent/20 p-1 backdrop-blur-sm " >
909+ < div className = "mt-3" >
910+ < div className = "flex gap-1 border-b " >
978911 { tabs . map ( ( tab ) => {
979912 const isActive = activeTab === tab . id ;
980913 const itemCount = tab ?. data ?. length || 0 ;
981- const isTabLoading = tabLoadingStates ?. [ tab . id ] ;
982914
983915 return (
984916 < TabButton
985917 isActive = { isActive }
986- isTabLoading = { isTabLoading }
987- isTransitioning = { isTransitioning }
988918 itemCount = { itemCount }
989919 key = { tab . id }
990920 onTabChange = { handleTabChange }
0 commit comments