Skip to content

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

Merged
merged 5 commits into from
Jun 24, 2025

Conversation

codemonkey800
Copy link
Contributor

Issue: #1827
Depends on: #1851

Follow up PR that implements the updated single deposition page using code from #1851. This makes the following changes;

  • Updates queries to fetch data for tomograms and annotations.
    • I also updated the loader function to return tomograms and annotations data only if the tab has loaded.
    • Right now the depositions query is untouched since we still need some data for the overview.
    • After release we should clean up the query so we're not fetching unnecessary data.
  • Adds deposition tabs to left sidebar
  • Implements annotations / tomograms table using columns from previous PR.

Copy link

@Copilot Copilot AI left a 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.

Copy link

@tihuan tihuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fantastic 🏎️ 🏁 🥇 !! LGTMMM

)

export function DepositionTomogramTable() {
const { tomograms } = useDepositionById()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v clean!!

Copy link
Contributor

@rainandbare rainandbare left a 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.

Comment on lines +184 to +202
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 })
Copy link
Contributor

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!

Copy link
Contributor Author

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 (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we expect to see anything here yet or if something is off with my local set up:

Screenshot 2025-06-20 at 11 06 59 AM

Copy link
Contributor Author

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 />
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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>
Copy link
Contributor

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

Base automatically changed from jeremy/single-deposition-table-updates-setup to main June 20, 2025 22:26
@codemonkey800 codemonkey800 merged commit 4ad2cdc into main Jun 24, 2025
21 checks passed
@codemonkey800 codemonkey800 deleted the jeremy/single-deposition-table-updates branch June 24, 2025 23:17
codemonkey800 added a commit that referenced this pull request Jun 24, 2025
codemonkey800 added a commit that referenced this pull request Jun 24, 2025
codemonkey800 added a commit that referenced this pull request Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants