-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description #33 Implements the runs table on the single dataset page. This refactors `DatasetTable` component to extract a more generic `Table` component that is reused for the dataset and runs tables. This uses [Tanstack Table](https://tanstack.com/table/v8) for abstracting the table logic so that it's more reusable. ## Demo <img width="1725" alt="image" src="https://github.com/chanzuckerberg/cryoet-data-portal/assets/2176050/04386ffc-0d26-46c9-a458-268e53980ec6">
- Loading branch information
1 parent
54df7d1
commit 960148f
Showing
32 changed files
with
933 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
frontend/packages/data-portal/app/components/AnnotatedObjectsList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { Tooltip } from '@czi-sds/components' | ||
import Paper from '@mui/material/Paper' | ||
import Skeleton from '@mui/material/Skeleton' | ||
import { range } from 'lodash-es' | ||
import { ReactNode } from 'react' | ||
|
||
import { ANNOTATED_OBJECTS_MAX } from 'app/constants/pagination' | ||
import { i18n } from 'app/i18n' | ||
import { cns } from 'app/utils/cns' | ||
|
||
function List({ | ||
className, | ||
children, | ||
}: { | ||
className?: string | ||
children: ReactNode | ||
}) { | ||
return ( | ||
<ul className={cns('list-none flex flex-col gap-sds-xs', className)}> | ||
{children} | ||
</ul> | ||
) | ||
} | ||
|
||
export function AnnotatedObjectsList({ | ||
annotatedObjects, | ||
isLoading, | ||
}: { | ||
annotatedObjects: string[] | ||
isLoading?: boolean | ||
}) { | ||
if (annotatedObjects.length === 0) { | ||
return null | ||
} | ||
|
||
const nodes = isLoading | ||
? range(0, ANNOTATED_OBJECTS_MAX).map((val) => ( | ||
<Skeleton key={`skeleton-${val}`} variant="rounded" /> | ||
)) | ||
: annotatedObjects.map((obj) => <li key={obj}>{obj}</li>) | ||
|
||
return ( | ||
<List> | ||
{nodes.slice( | ||
0, | ||
nodes.length > ANNOTATED_OBJECTS_MAX | ||
? ANNOTATED_OBJECTS_MAX - 1 | ||
: Infinity, | ||
)} | ||
|
||
{nodes.length > ANNOTATED_OBJECTS_MAX && ( | ||
<li> | ||
<Tooltip | ||
classes={{ tooltip: '!p-0 !bg-transparent' }} | ||
placement="left" | ||
title={ | ||
<Paper className="p-sds-m text-black w-[250px]" elevation={4}> | ||
<List className="font-semibold"> | ||
{nodes.slice(0, 4)} | ||
|
||
<li> | ||
really long object with a long name that is long for some | ||
reason other than being long | ||
</li> | ||
|
||
{nodes.slice(4)} | ||
</List> | ||
</Paper> | ||
} | ||
> | ||
<div | ||
className={cns( | ||
'bg-sds-gray-200 text-sds-gray-600 hover:cursor-pointer', | ||
'rounded-sds-m py-sds-xxxs px-sds-xxs inline', | ||
)} | ||
> | ||
{i18n.nMoreObjects(nodes.length + 1 - ANNOTATED_OBJECTS_MAX)} | ||
</div> | ||
</Tooltip> | ||
</li> | ||
)} | ||
</List> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
frontend/packages/data-portal/app/components/BrowseData/DatasetKeyPhoto.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.