-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(website): migrate covid "compare side-by-side" to React #982
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
Open
fengelniederhammer
wants to merge
1
commit into
973-migrate-compare-side-by-side-to-react
Choose a base branch
from
981-migrate-covid-compare-side-by-side-page-to-react
base: 973-migrate-compare-side-by-side-to-react
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,130 +1,6 @@ | ||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
| import GsAggregate from '../../components/genspectrum/GsAggregate.astro'; | ||||||||||||||||||||||||||||||||
| import GsMutations from '../../components/genspectrum/GsMutations.astro'; | ||||||||||||||||||||||||||||||||
| import GsPrevalenceOverTime from '../../components/genspectrum/GsPrevalenceOverTime.astro'; | ||||||||||||||||||||||||||||||||
| import GsRelativeGrowthAdvantage from '../../components/genspectrum/GsRelativeGrowthAdvantage.astro'; | ||||||||||||||||||||||||||||||||
| import { CompareSideBySidePageStateSelector } from '../../components/pageStateSelectors/CompareSideBySidePageStateSelector'; | ||||||||||||||||||||||||||||||||
| import { CompareSideBySideSelectorFallback } from '../../components/pageStateSelectors/FallbackElement'; | ||||||||||||||||||||||||||||||||
| import { toDownloadLink } from '../../components/views/compareSideBySide/toDownloadLink'; | ||||||||||||||||||||||||||||||||
| import { isStaging, getDashboardsConfig, getLapisUrl } from '../../config'; | ||||||||||||||||||||||||||||||||
| import OrganismViewPageLayout from '../../layouts/OrganismPage/OrganismViewPageLayout.astro'; | ||||||||||||||||||||||||||||||||
| import { chooseGranularityBasedOnDateRange } from '../../util/chooseGranularityBasedOnDateRange'; | ||||||||||||||||||||||||||||||||
| import { ComponentHeight } from '../../views/OrganismConstants'; | ||||||||||||||||||||||||||||||||
| import { toLapisFilterWithoutVariant } from '../../views/pageStateHandlers/toLapisFilterWithoutVariant'; | ||||||||||||||||||||||||||||||||
| import type { OrganismViewKey } from '../../views/routing'; | ||||||||||||||||||||||||||||||||
| import { ServerSide } from '../../views/serverSideRouting'; | ||||||||||||||||||||||||||||||||
| const organismViewKey: OrganismViewKey = 'covid.compareSideBySideView'; | ||||||||||||||||||||||||||||||||
| const view = ServerSide.routing.getOrganismView(organismViewKey); | ||||||||||||||||||||||||||||||||
| const pageState = view.pageStateHandler.parsePageStateFromUrl(Astro.url); | ||||||||||||||||||||||||||||||||
| const downloadLinks = [...pageState.filters.entries()].map( | ||||||||||||||||||||||||||||||||
| toDownloadLink(view.pageStateHandler, view.organismConstants.organism), | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| import GenericCompareSideBySidePage from '../../components/views/compareSideBySide/GenericCompareSideBySidePage.astro'; | ||||||||||||||||||||||||||||||||
| import { Organisms } from '../../types/Organism'; | ||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <OrganismViewPageLayout view={view} downloadLinks={downloadLinks}> | ||||||||||||||||||||||||||||||||
| <gs-app lapis={getLapisUrl(view.organismConstants.organism)}> | ||||||||||||||||||||||||||||||||
| <div class='flex overflow-x-auto'> | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| Array.from(pageState.filters).map(([id, { variantFilter, datasetFilter }]) => { | ||||||||||||||||||||||||||||||||
| const baselineLapisFilter = toLapisFilterWithoutVariant( | ||||||||||||||||||||||||||||||||
| datasetFilter, | ||||||||||||||||||||||||||||||||
| view.organismConstants.additionalFilters, | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| const timeGranularity = chooseGranularityBasedOnDateRange({ | ||||||||||||||||||||||||||||||||
| earliestDate: new Date(view.organismConstants.earliestDate), | ||||||||||||||||||||||||||||||||
| dateRange: datasetFilter.dateFilters[view.organismConstants.mainDateField], | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
| const numeratorFilter = { | ||||||||||||||||||||||||||||||||
| ...variantFilter.lineages, | ||||||||||||||||||||||||||||||||
| ...variantFilter.mutations, | ||||||||||||||||||||||||||||||||
| variantQuery: variantFilter.variantQuery, | ||||||||||||||||||||||||||||||||
| ...baselineLapisFilter, | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
|
Comment on lines
-40
to
-45
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was another difference to the generic page - but I think the logic is already handled by this: dashboards/website/src/views/pageStateHandlers/PageStateHandler.ts Lines 14 to 28 in ae2e48e
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||
| <div class='flex min-w-[500px] flex-1 flex-col gap-4 border-r-2 border-gray-200 px-2'> | ||||||||||||||||||||||||||||||||
| <div class='mb-4'> | ||||||||||||||||||||||||||||||||
| {pageState.filters.size > 1 && ( | ||||||||||||||||||||||||||||||||
| <a | ||||||||||||||||||||||||||||||||
| class='block w-full px-2 py-1 text-sm font-light hover:bg-neutral-100' | ||||||||||||||||||||||||||||||||
| href={view.pageStateHandler.toUrl( | ||||||||||||||||||||||||||||||||
| view.pageStateHandler.removeFilter(pageState, id), | ||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||
| Remove column | ||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||
| <CompareSideBySidePageStateSelector | ||||||||||||||||||||||||||||||||
| filterId={id} | ||||||||||||||||||||||||||||||||
| initialPageState={pageState} | ||||||||||||||||||||||||||||||||
| organismsConfig={getDashboardsConfig().dashboards.organisms} | ||||||||||||||||||||||||||||||||
| organismViewKey={organismViewKey} | ||||||||||||||||||||||||||||||||
| enableAdvancedQueryFilter={isStaging()} | ||||||||||||||||||||||||||||||||
| client:only='react' | ||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||
| <CompareSideBySideSelectorFallback | ||||||||||||||||||||||||||||||||
| slot='fallback' | ||||||||||||||||||||||||||||||||
| numFilters={pageState.filters.size} | ||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||
| </CompareSideBySidePageStateSelector> | ||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <GsPrevalenceOverTime | ||||||||||||||||||||||||||||||||
| numeratorFilters={[ | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| displayName: '', | ||||||||||||||||||||||||||||||||
| lapisFilter: numeratorFilter, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| ]} | ||||||||||||||||||||||||||||||||
| denominatorFilter={baselineLapisFilter} | ||||||||||||||||||||||||||||||||
| lapisDateField={view.organismConstants.mainDateField} | ||||||||||||||||||||||||||||||||
| granularity={timeGranularity} | ||||||||||||||||||||||||||||||||
| height={ComponentHeight.large} | ||||||||||||||||||||||||||||||||
| pageSize={10} | ||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||
| <GsRelativeGrowthAdvantage | ||||||||||||||||||||||||||||||||
| numeratorFilter={numeratorFilter} | ||||||||||||||||||||||||||||||||
| denominatorFilter={baselineLapisFilter} | ||||||||||||||||||||||||||||||||
| lapisDateField={view.organismConstants.mainDateField} | ||||||||||||||||||||||||||||||||
| height={ComponentHeight.large} | ||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||
| <GsMutations | ||||||||||||||||||||||||||||||||
| lapisFilter={numeratorFilter} | ||||||||||||||||||||||||||||||||
| baselineLapisFilter={baselineLapisFilter} | ||||||||||||||||||||||||||||||||
| sequenceType='nucleotide' | ||||||||||||||||||||||||||||||||
| pageSize={10} | ||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||
| <GsMutations | ||||||||||||||||||||||||||||||||
| lapisFilter={numeratorFilter} | ||||||||||||||||||||||||||||||||
| baselineLapisFilter={baselineLapisFilter} | ||||||||||||||||||||||||||||||||
| sequenceType='amino acid' | ||||||||||||||||||||||||||||||||
| pageSize={10} | ||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||
| {view.organismConstants.aggregatedVisualizations.compareSideBySide.map( | ||||||||||||||||||||||||||||||||
| ({ label, fields, views }) => ( | ||||||||||||||||||||||||||||||||
| <GsAggregate | ||||||||||||||||||||||||||||||||
| title={label} | ||||||||||||||||||||||||||||||||
| fields={fields} | ||||||||||||||||||||||||||||||||
| lapisFilter={numeratorFilter} | ||||||||||||||||||||||||||||||||
| views={views} | ||||||||||||||||||||||||||||||||
| pageSize={10} | ||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| <a | ||||||||||||||||||||||||||||||||
| class='py-4 pt-8 text-left text-sm font-light hover:bg-neutral-100' | ||||||||||||||||||||||||||||||||
| href={view.pageStateHandler.toUrl(view.pageStateHandler.addEmptyFilter(pageState))} | ||||||||||||||||||||||||||||||||
| style='writing-mode: vertical-rl;' | ||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||
| Add column | ||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||
| </gs-app> | ||||||||||||||||||||||||||||||||
| </OrganismViewPageLayout> | ||||||||||||||||||||||||||||||||
| <GenericCompareSideBySidePage organism={Organisms.covid} /> | ||||||||||||||||||||||||||||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.