@@ -6,15 +6,18 @@ import { useSearchParams } from 'next/navigation';
66import BarList from './BarList' ;
77import { useState , useEffect } from 'react' ;
88import { tabs } from '../constants' ;
9+ import { useTinybirdToken } from '@/providers/TinybirdProvider' ;
910
1011interface TabbedPaneProps {
1112 filters : Record < string , string > ;
1213 onFilterUpdate : ( dimension : string , name : string , values : string [ ] ) => void ;
1314}
1415
1516export default function TabbedPane ( { filters, onFilterUpdate } : TabbedPaneProps ) {
17+ const { orgName } = useTinybirdToken ( ) ;
1618 const searchParams = useSearchParams ( ) ;
17- const initialDimension = searchParams . get ( 'dimension' ) || tabs [ 0 ] . key ;
19+ const filteredTabs = tabs . filter ( tab => ! orgName || tab . key !== 'organization' ) ;
20+ const initialDimension = searchParams . get ( 'dimension' ) || filteredTabs [ 0 ] . key ;
1821 const [ selectedTab , setSelectedTab ] = useState < string > ( initialDimension ) ;
1922 const [ barListData , setBarListData ] = useState < Array < { name : string ; value : number } > > ( [ ] ) ;
2023 // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -50,7 +53,7 @@ export default function TabbedPane({ filters, onFilterUpdate }: TabbedPaneProps)
5053 window . history . replaceState ( { } , '' , `?${ params . toString ( ) } ` ) ;
5154
5255 // Notify parent to update filters
53- onFilterUpdate ( selectedTab , tabs . find ( t => t . key === selectedTab ) ?. name || selectedTab , newSelection ) ;
56+ onFilterUpdate ( selectedTab , filteredTabs . find ( t => t . key === selectedTab ) ?. name || selectedTab , newSelection ) ;
5457 } ;
5558
5659 // const handleRemoveFilter = (dimension: string, value: string) => {
@@ -59,7 +62,7 @@ export default function TabbedPane({ filters, onFilterUpdate }: TabbedPaneProps)
5962 // };
6063
6164 const handleTabChange = ( index : number ) => {
62- const tab = tabs [ index ] ;
65+ const tab = filteredTabs [ index ] ;
6366 const dimension = tab . key ;
6467
6568 // Update URL without scroll
@@ -85,11 +88,11 @@ export default function TabbedPane({ filters, onFilterUpdate }: TabbedPaneProps)
8588 return (
8689 < div className = "h-full" >
8790 < TabGroup
88- defaultIndex = { tabs . findIndex ( t => t . key === selectedTab ) }
91+ defaultIndex = { filteredTabs . findIndex ( t => t . key === selectedTab ) }
8992 onIndexChange = { handleTabChange }
9093 >
9194 < TabList className = "flex space-x-2" >
92- { tabs . map ( ( tab ) => (
95+ { filteredTabs . map ( ( tab ) => (
9396 < Tab
9497 key = { tab . key }
9598 // @ts -expect-error fix later
0 commit comments