-
Notifications
You must be signed in to change notification settings - Fork 13
feat: single deposition table updates #1852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements updates to the single deposition page by adding new queries and UI components to support separate views for tomograms and annotations. It updates the loader to conditionally fetch additional data, adds deposition tabs to the sidebar, and introduces new table renderers for annotations and tomograms.
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
locales/en/translation.json | Adds new translation keys for data contents and deposited data/information. |
app/routes/depositions.$id.tsx | Updates the loader function to conditionally fetch tomograms and annotations data using ts-pattern and adjusts query parameters in the revalidation function. |
app/hooks/useDepositionTab.ts | Introduces the DepositionTab enum and related hook for handling deposition tabs. |
app/hooks/useDepositionById.ts | Adds annotations and tomograms data along with count aggregations from the backend. |
app/graphql/* | Adds new GraphQL queries for fetching deposition tomograms and annotations along with count aggregations. |
app/constants/table.ts | Defines new column width constants for deposition tables. |
app/components/Deposition/* | Adds new components including the deposition tabs, table renderers, filters, and deposited-in table cell with updated UI logic. |
frontend/packages/data-portal/app/components/Deposition/DepositionFilters.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fantastic 🏎️ 🏁 🥇 !! LGTMMM
frontend/packages/data-portal/app/components/Deposition/DepositedInTableCell.tsx
Show resolved
Hide resolved
) | ||
|
||
export function DepositionTomogramTable() { | ||
const { tomograms } = useDepositionById() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v clean!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WEEEEEHOOOOO! SO exciting! It is taking shape! Really nice work. A few non-blocking comments - see which ones work for you.
table: isExpandDepositions ? ( | ||
<DepositionTableRenderer /> | ||
) : ( | ||
<DatasetsTable /> | ||
), | ||
|
||
totalCount: match({ isExpandDepositions, tab }) | ||
.with( | ||
{ isExpandDepositions: true, tab: DepositionTab.Annotations }, | ||
() => annotationsCount, | ||
) | ||
.with( | ||
{ isExpandDepositions: true, tab: DepositionTab.Tomograms }, | ||
() => tomogramsCount, | ||
) | ||
.otherwise(() => totalDatasetsCount), | ||
|
||
// TODO replace annotations and tomograms with filtered counts | ||
filteredCount: match({ isExpandDepositions, tab }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 oy this is complex with the feature flag!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'll be cleaner once we remove the feature flag 😆 but yeah imagine how it'd be with nested if statements or ternaries instead! 💀
], | ||
) | ||
|
||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh hmm let me take a look, something might not be fetching correctly 🤔
const [tab, setTab] = useDepositionTab() | ||
const tabs = useTabs(tab) | ||
|
||
return <Tabs tabs={tabs} value={tab} onChange={setTab} vertical /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Future Nice-to-have suggestion: It would be good if changing tabs didn't bring you to the top of the page and also it might be nice if the headers loaded as well as the data - or maybe they just change to the next tabs head (like if you click on Tomograms then the headers change immediately even while we wait for the data to load
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a way to do that in remix: https://remix.run/docs/en/main/components/scroll-restoration#preventing-scroll-reset
also it might be nice if the headers loaded as well as the data - or maybe they just change to the next tabs head (like if you click on Tomograms then the headers change immediately even while we wait for the data to load
I agree, I think this is limitation to how we implemented the frontend in the beginning because data fetching has to complete before it can show the next page. I think this was before Suspense
and Await
became more widespread, so we never adopted this pattern in the codebase 😢
I think overall we should look into deferring the data fetches and using Suspense
to make the application feel snappier. There's a Remix example of using it here:
https://remix.run/docs/en/main/discussion/pending-ui#deferred-data-loading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened an issue to track this: #1861
</div> | ||
))} | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need some padding/margin bottom here when there is no data/loading
frontend/packages/data-portal/app/components/Deposition/DepositedInTableCell.tsx
Show resolved
Hide resolved
frontend/packages/data-portal/app/components/Deposition/DepositionAnnotationTable.tsx
Show resolved
Hide resolved
990a46d
to
f443922
Compare
Issue: #1827
Depends on: #1851
Follow up PR that implements the updated single deposition page using code from #1851. This makes the following changes;