1- import { useQueries , useQuery } from '@tanstack/react-query' ;
1+ import { kebabCase , isNil , get } from 'es-toolkit/compat' ;
2+ import { useQueries } from '@tanstack/react-query' ;
23import { useSearchParams } from 'next/navigation' ;
3- import { useSession } from 'next-auth/react' ;
44import { useAtomValue } from 'jotai' ;
55import { unwrap } from 'jotai/utils' ;
66import { match } from 'ts-pattern' ;
77import { useMemo } from 'react' ;
88
9- import kebabCase from 'es-toolkit/compat/kebabCase' ;
10- import isNil from 'es-toolkit/compat/isNil' ;
11- import get from 'es-toolkit/compat/get' ;
12-
139import { PillTabs , PillTabsList , PillTabsTrigger } from '@/ui/molecules/tabs' ;
14- import { getPersons } from '@/api/entitycore/queries/general/person-agent' ;
15- import { keyBuilder as userKeyBuilder } from '@/ui/use-query-keys/user' ;
1610import { useDefaultBreakpoint } from '@/ui/hooks/create-break-point' ;
1711import { BrowseLink } from '@/ui/segments/explore/browse-link' ;
18- import { ROOT_ROUTE } from '@/config' ;
1912import { useTabs } from '@/components/detail-view-tabs' ;
2013import { useWorkspace } from '@/ui/hooks/use-workspace' ;
2114import { keyBuilder } from '@/ui/use-query-keys/data' ;
@@ -32,6 +25,7 @@ import {
3225 getAllEntitiesCountScoped ,
3326} from '@/ui/segments/explore/helpers' ;
3427import { cn } from '@/utils/css-class' ;
28+ import { ROOT_ROUTE } from '@/config' ;
3529
3630import { type TWorkspaceScope } from '@/constants' ;
3731
@@ -66,7 +60,6 @@ export const tabsConfigItems: Array<{
6660
6761export function EntityLinkCount ( ) {
6862 const breakpoint = useDefaultBreakpoint ( ) ;
69- const session = useSession ( ) ;
7063 const scope = ( useSearchParams ( ) . get ( 'scope' ) ?? WorkspaceScope . Public ) as TWorkspaceScope ;
7164
7265 const { virtualLabId, projectId } = useWorkspace ( ) ;
@@ -81,19 +74,11 @@ export function EntityLinkCount() {
8174 shallow : true ,
8275 } ) ;
8376
84- const { data : personId } = useQuery ( {
85- queryKey : userKeyBuilder . person ( { userId : session . data ?. user . id } ) ,
86- queryFn : ( ) => getPersons ( { filters : { sub_id : session . data ?. user . id } } ) ,
87- enabled : Boolean ( session . data ?. user . id ) ,
88- select : ( data ) => data ?. data . at ( 0 ) ?. id ,
89- } ) ;
90-
9177 const params = {
9278 virtualLabId,
9379 projectId,
9480 brainRegionId : selectedBrainRegion ?. id ! ,
9581 scope,
96- personId,
9782 } ;
9883
9984 const [
@@ -113,7 +98,7 @@ export function EntityLinkCount() {
11398 getSimulationsCount ( {
11499 ...params ,
115100 } ) ,
116- enabled : Boolean ( selectedBrainRegion ?. id ) && Boolean ( personId ) ,
101+ enabled : Boolean ( selectedBrainRegion ?. id ) ,
117102 } ,
118103 {
119104 queryKey : keyBuilder . dataCount ( { ...params , brainRegionId : brainRegionHierarchy ?. root . id } ) ,
@@ -168,9 +153,9 @@ export function EntityLinkCount() {
168153 type = { value . extendedType }
169154 title = { value . title }
170155 count = {
171- < span >
156+ < span className = "flex items-center justify-center gap-1" >
172157 < span className = "font-bold" > { count } </ span > < span className = "font-light" > of</ span >
173- < span className = "font-bold" > { rootCount } </ span >
158+ < span className = "font-bold" > { rootCount } </ span >
174159 </ span >
175160 }
176161 isLoading = { value . isLoading || isNil ( count ) || isNil ( rootCount ) }
@@ -193,7 +178,7 @@ export function EntityLinkCount() {
193178 type = { value . extendedType }
194179 title = { value . title }
195180 count = {
196- < span >
181+ < span className = "flex items-center justify-center gap-1" >
197182 < span className = "font-bold" > { count } </ span > < span className = "font-light" > of</ span >
198183 < span className = "font-bold" > { rootCount } </ span >
199184 </ span >
@@ -217,7 +202,7 @@ export function EntityLinkCount() {
217202 href = { link }
218203 type = { value . extendedType }
219204 title = { value . title }
220- count = { count ? ` $ {count } ` : 0 }
205+ count = { < span className = "font-bold" > { count } </ span > }
221206 isLoading = { value . isLoading || isNil ( count ) }
222207 isUploadable = { value . isUploadable }
223208 />
0 commit comments