@openneuro/app 4.33.4 → 4.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -3
- package/src/client.jsx +2 -1
- package/src/scripts/authentication/signOut.ts +1 -1
- package/src/scripts/common/containers/footer.tsx +1 -1
- package/src/scripts/common/containers/header.tsx +3 -2
- package/src/scripts/common/content/affiliate-content.jsx +72 -0
- package/src/scripts/common/content/assets/affiliates/bids.jpg +0 -0
- package/src/scripts/common/content/assets/affiliates/datalad.jpg +0 -0
- package/src/scripts/common/content/assets/affiliates/nih-bi-logo.png +0 -0
- package/src/scripts/common/content/assets/front-page/brand_mark.png +0 -0
- package/src/scripts/common/content/assets/front-page/cube-get.png +0 -0
- package/src/scripts/common/content/assets/front-page/cube-share.png +0 -0
- package/src/scripts/common/content/assets/front-page/cube-use.png +0 -0
- package/src/scripts/common/content/assets/front-page/ljaf.png +0 -0
- package/src/scripts/common/content/assets/front-page/logo_app.png +0 -0
- package/src/scripts/common/content/assets/front-page/logo_cube.png +0 -0
- package/src/scripts/common/content/assets/front-page/logo_data.png +0 -0
- package/src/scripts/common/content/assets/front-page/logo_users.png +0 -0
- package/src/scripts/common/content/assets/front-page/novo-logo.png +0 -0
- package/src/scripts/common/content/assets/front-page/nru-logo.png +0 -0
- package/src/scripts/common/content/assets/front-page/nsf.png +0 -0
- package/src/scripts/common/content/assets/front-page/sqm-logo.png +0 -0
- package/src/scripts/common/content/assets/front-page/squishymedia.png +0 -0
- package/src/scripts/common/content/assets/front-page/stanford.png +0 -0
- package/src/scripts/common/content/assets/modality-cubes/brain-initiative.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/eeg.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/ieeg.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/meg.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/mri.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/nih_cube.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/nirs.jpg +0 -0
- package/src/scripts/common/content/assets/modality-cubes/pet-scan.jpg +0 -0
- package/src/scripts/common/content/assets/portal-content/nih-bi-brand.png +0 -0
- package/src/scripts/common/content/facet-content.jsx +186 -0
- package/src/scripts/common/content/front-page-content.jsx +177 -0
- package/src/scripts/common/content/image-attribution.tsx +3 -3
- package/src/scripts/common/content/modality-cube-content.jsx +92 -0
- package/src/scripts/common/content/portal-content.jsx +149 -0
- package/src/scripts/common/content/portal-grant-content.jsx +30 -0
- package/src/scripts/common/content/sortby-list.jsx +18 -0
- package/src/scripts/common/forms/warn-button.jsx +1 -1
- package/src/scripts/components/accordion/AccordionTab.tsx +68 -0
- package/src/scripts/components/accordion/AccordionWrap.tsx +22 -0
- package/src/scripts/components/accordion/__tests__/AccordionTab.spec.tsx +35 -0
- package/src/scripts/components/accordion/accordion.scss +68 -0
- package/src/scripts/components/activity-slider/ActivitySlider.tsx +121 -0
- package/src/scripts/components/activity-slider/slider.scss +130 -0
- package/src/scripts/components/affiliate-article/AffiliateArticle.tsx +26 -0
- package/src/scripts/components/affiliate-article/affiliate.scss +32 -0
- package/src/scripts/components/aggregate-count/AggregateCount.tsx +20 -0
- package/src/scripts/components/assets/activity-icon.png +0 -0
- package/src/scripts/components/assets/close-button.png +0 -0
- package/src/scripts/components/assets/favicon copy.ico +0 -0
- package/src/scripts/components/assets/favicon.ico +0 -0
- package/src/scripts/components/assets/get_data_browse.png +0 -0
- package/src/scripts/components/assets/get_data_download.png +0 -0
- package/src/scripts/components/assets/ljaf copy.png +0 -0
- package/src/scripts/components/assets/logo_app copy.png +0 -0
- package/src/scripts/components/assets/logo_cube copy.png +0 -0
- package/src/scripts/components/assets/logo_data copy.png +0 -0
- package/src/scripts/components/assets/logo_users copy.png +0 -0
- package/src/scripts/components/assets/mri-scan.jpg +0 -0
- package/src/scripts/components/assets/nih copy.png +0 -0
- package/src/scripts/components/assets/nih-bi-brand.jpg +0 -0
- package/src/scripts/components/assets/nih-stanford.jpg +0 -0
- package/src/scripts/components/assets/nih.png +0 -0
- package/src/scripts/components/assets/nimh.png +0 -0
- package/src/scripts/components/assets/nsf copy.png +0 -0
- package/src/scripts/components/assets/on-dark-horz.svg +1 -0
- package/src/scripts/components/assets/on-dark.svg +1 -0
- package/src/scripts/components/assets/on-light-horz.svg +1 -0
- package/src/scripts/components/assets/on-light.svg +1 -0
- package/src/scripts/components/assets/orcid_24x24 copy.png +0 -0
- package/src/scripts/components/assets/orcid_24x24.png +0 -0
- package/src/scripts/components/assets/share_data_collaborate.png +0 -0
- package/src/scripts/components/assets/share_data_publish.png +0 -0
- package/src/scripts/components/assets/share_data_validate.png +0 -0
- package/src/scripts/components/assets/squishymedia copy.png +0 -0
- package/src/scripts/components/assets/stanford copy.png +0 -0
- package/src/scripts/components/assets/tab-get_data.png +0 -0
- package/src/scripts/components/assets/tab-share_data.png +0 -0
- package/src/scripts/components/assets/tab-use_data.png +0 -0
- package/src/scripts/components/assets/use_data_analyze.png +0 -0
- package/src/scripts/components/assets/use_data_snapshot.png +0 -0
- package/src/scripts/components/button/Button.tsx +113 -0
- package/src/scripts/components/button/__tests__/Button.spec.tsx +21 -0
- package/src/scripts/components/button/button.scss +140 -0
- package/src/scripts/components/count-toggle/CountToggle.tsx +65 -0
- package/src/scripts/components/count-toggle/__tests__/CountToggle.spec.tsx +31 -0
- package/src/scripts/components/count-toggle/count-toggle.scss +34 -0
- package/src/scripts/components/dropdown/Dropdown.tsx +38 -0
- package/src/scripts/components/dropdown/dropdown.scss +29 -0
- package/src/scripts/components/facets/FacetRadio.tsx +43 -0
- package/src/scripts/components/facets/FacetRange.tsx +35 -0
- package/src/scripts/components/facets/FacetSearch.tsx +66 -0
- package/src/scripts/components/facets/FacetSelect.tsx +87 -0
- package/src/scripts/components/facets/SingleSelect.tsx +39 -0
- package/src/scripts/components/facets/__tests__/FacetSelect.spec.tsx +14 -0
- package/src/scripts/components/facets/__tests__/SingleSelect.spec.tsx +58 -0
- package/src/scripts/components/facets/facet.scss +244 -0
- package/src/scripts/components/footer/Footer.tsx +52 -0
- package/src/scripts/components/footer/footer.scss +20 -0
- package/src/scripts/components/formatting/__tests__/modality-label.spec.tsx +34 -0
- package/src/scripts/components/formatting/modality-label.tsx +34 -0
- package/src/scripts/components/front-page/ActivityHeader.tsx +12 -0
- package/src/scripts/components/front-page/AffiliateBlock.tsx +22 -0
- package/src/scripts/components/front-page/Contributors.tsx +28 -0
- package/src/scripts/components/front-page/GetUpdates.tsx +99 -0
- package/src/scripts/components/front-page/Infographic.tsx +36 -0
- package/src/scripts/components/front-page/front-page.scss +295 -0
- package/src/scripts/components/header/Header.tsx +151 -0
- package/src/scripts/components/header/LandingExpandedHeader.tsx +110 -0
- package/src/scripts/components/header/header.scss +409 -0
- package/src/scripts/components/icon/Icon.tsx +55 -0
- package/src/scripts/components/icon/__tests__/Icon.spec.tsx +10 -0
- package/src/scripts/components/icon/icon.scss +8 -0
- package/src/scripts/components/input/Input.tsx +137 -0
- package/src/scripts/components/input/TermSearch.tsx +101 -0
- package/src/scripts/components/input/input.scss +147 -0
- package/src/scripts/components/input/term-search.scss +68 -0
- package/src/scripts/components/json-tree/ExpandableProperty.tsx +35 -0
- package/src/scripts/components/json-tree/RecursiveProperty.tsx +67 -0
- package/src/scripts/components/json-tree/json-tree.scss +19 -0
- package/src/scripts/components/loading/Loading.tsx +19 -0
- package/src/scripts/components/loading/__tests__/Loading.spec.tsx +12 -0
- package/src/scripts/components/loading/loading.scss +141 -0
- package/src/scripts/components/logo/Logo.tsx +44 -0
- package/src/scripts/components/logo/__tests__/Logo.spec.tsx +22 -0
- package/src/scripts/components/modal/Modal.tsx +51 -0
- package/src/scripts/components/modal/ModalExample.tsx +25 -0
- package/src/scripts/components/modal/UserLoginModal.tsx +74 -0
- package/src/scripts/components/modal/__tests__/UserLoginModal.spec.tsx +37 -0
- package/src/scripts/components/modal/modal.scss +60 -0
- package/src/scripts/components/modality-cube/ModalityCube.tsx +60 -0
- package/src/scripts/components/modality-cube/modality-cube.scss +303 -0
- package/src/scripts/components/page/Page.tsx +61 -0
- package/src/scripts/components/page/page.scss +408 -0
- package/src/scripts/components/progress-bar/ProgressBar.tsx +16 -0
- package/src/scripts/components/progress-bar/progress-bar.scss +34 -0
- package/src/scripts/components/radio/Radio.tsx +33 -0
- package/src/scripts/components/radio/RadioGroup.tsx +45 -0
- package/src/scripts/components/radio/__tests__/RadioGroup.spec.tsx +31 -0
- package/src/scripts/components/radio/radio.scss +335 -0
- package/src/scripts/components/range/TwoHandleRange.scss +108 -0
- package/src/scripts/components/range/TwoHandleRange.tsx +128 -0
- package/src/scripts/components/range/__tests__/TwoHandleRange.spec.tsx +34 -0
- package/src/scripts/components/read-more/ReadMore.tsx +50 -0
- package/src/scripts/components/read-more/__tests__/ReadMore.spec.tsx +14 -0
- package/src/scripts/components/read-more/read-more.scss +79 -0
- package/src/scripts/components/scss/_flex-grid.scss +216 -0
- package/src/scripts/components/scss/_helper-classes.scss +162 -0
- package/src/scripts/components/scss/_normalize.scss +614 -0
- package/src/scripts/components/scss/_variables.scss +245 -0
- package/src/scripts/components/scss/global.scss +124 -0
- package/src/scripts/components/scss/toasts.scss +33 -0
- package/src/scripts/components/scss/upload-modal.scss +479 -0
- package/src/scripts/components/search-page/CommunityHeader.tsx +27 -0
- package/src/scripts/components/search-page/FacetBlockContainerExample.tsx +6 -0
- package/src/scripts/components/search-page/FilterDateItem.tsx +44 -0
- package/src/scripts/components/search-page/FilterListItem.tsx +62 -0
- package/src/scripts/components/search-page/FiltersBlock.tsx +277 -0
- package/src/scripts/components/search-page/ModalityHeader.tsx +64 -0
- package/src/scripts/components/search-page/NeurobagelSearch.tsx +59 -0
- package/src/scripts/components/search-page/SearchPage.tsx +114 -0
- package/src/scripts/components/search-page/SearchResultItem.tsx +417 -0
- package/src/scripts/components/search-page/SearchResultsList.tsx +48 -0
- package/src/scripts/components/search-page/SearchSort.tsx +52 -0
- package/src/scripts/components/search-page/SearchSortContainerExample.tsx +9 -0
- package/src/scripts/components/search-page/TermListItem.tsx +41 -0
- package/src/scripts/components/search-page/__tests__/NuerobagelSearch.spec.tsx +17 -0
- package/src/scripts/components/search-page/filters-block.scss +99 -0
- package/src/scripts/components/search-page/neurobagel_logo.svg +75 -0
- package/src/scripts/components/search-page/search-page.scss +505 -0
- package/src/scripts/components/search-page/search-result.scss +117 -0
- package/src/scripts/components/search-page/search-sort.scss +56 -0
- package/src/scripts/components/select/SelectGroup.tsx +41 -0
- package/src/scripts/components/select/__tests__/SelectGroup.spec.tsx +43 -0
- package/src/scripts/components/select/select.scss +40 -0
- package/src/scripts/components/textarea/Textarea.tsx +68 -0
- package/src/scripts/components/textarea/__tests__/Textarea.spec.tsx +53 -0
- package/src/scripts/components/tooltip/Tooltip.tsx +30 -0
- package/src/scripts/components/tooltip/__tests__/Tooltip.spec.tsx +14 -0
- package/src/scripts/components/tooltip/tooltip.scss +159 -0
- package/src/scripts/components/user/UserMenu.tsx +72 -0
- package/src/scripts/components/user/user-menu.scss +88 -0
- package/src/scripts/components/warn-button/WarnButton.tsx +97 -0
- package/src/scripts/components/warn-button/warn-button.scss +39 -0
- package/src/scripts/datalad/dataset/dataset-query-context.js +2 -0
- package/src/scripts/dataset/comments/comment.jsx +1 -1
- package/src/scripts/dataset/components/AnalyzeDropdown.tsx +2 -2
- package/src/scripts/dataset/components/CloneDropdown.tsx +2 -2
- package/src/scripts/dataset/components/DatasetEventItem.tsx +105 -0
- package/src/scripts/dataset/components/DatasetGitAccess.tsx +2 -2
- package/src/scripts/dataset/components/DatasetToolButton.tsx +2 -2
- package/src/scripts/dataset/components/ModalitiesMetaDataBlock.tsx +2 -10
- package/src/scripts/dataset/components/ValidationBlock.tsx +37 -2
- package/src/scripts/dataset/components/VersionList.tsx +1 -1
- package/src/scripts/dataset/components/scss/dataset-events.module.scss +41 -0
- package/src/scripts/dataset/dataset-query.jsx +12 -11
- package/src/scripts/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +7 -1
- package/src/scripts/dataset/download/__tests__/download-command-line.spec.jsx +2 -2
- package/src/scripts/dataset/download/download-command-line.jsx +17 -13
- package/src/scripts/dataset/download/download-datalad.jsx +6 -3
- package/src/scripts/dataset/download/download-link.jsx +1 -1
- package/src/scripts/dataset/download/download-s3.jsx +0 -4
- package/src/scripts/dataset/files/file-display.jsx +1 -1
- package/src/scripts/dataset/files/file-tree-unloaded-directory.jsx +1 -1
- package/src/scripts/dataset/files/file-tree.tsx +1 -1
- package/src/scripts/dataset/files/file-view.jsx +1 -1
- package/src/scripts/dataset/files/file-viewer-type.jsx +5 -1
- package/src/scripts/dataset/files/file.tsx +2 -2
- package/src/scripts/dataset/files/files.tsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-json.jsx +1 -1
- package/src/scripts/dataset/files/viewers/file-viewer-markdown.tsx +13 -0
- package/src/scripts/dataset/fragments/cancel-button.tsx +1 -1
- package/src/scripts/dataset/fragments/dataset-citation.jsx +2 -2
- package/src/scripts/dataset/fragments/edit-button.tsx +1 -1
- package/src/scripts/dataset/fragments/edit-list.jsx +1 -1
- package/src/scripts/dataset/fragments/save-button.tsx +1 -1
- package/src/scripts/dataset/mutations/admin-exports.jsx +1 -1
- package/src/scripts/dataset/mutations/cache-clear.jsx +1 -1
- package/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx +2 -2
- package/src/scripts/dataset/mutations/dataset-events.tsx +187 -0
- package/src/scripts/dataset/mutations/dataset-relations.tsx +1 -1
- package/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx +1 -1
- package/src/scripts/dataset/mutations/delete-comment.jsx +1 -1
- package/src/scripts/dataset/mutations/delete-file.jsx +1 -1
- package/src/scripts/dataset/mutations/deprecate-version.tsx +1 -1
- package/src/scripts/dataset/mutations/flag-annex-object.jsx +2 -2
- package/src/scripts/dataset/mutations/follow.tsx +1 -1
- package/src/scripts/dataset/mutations/import-dataset.tsx +1 -1
- package/src/scripts/dataset/mutations/publish.jsx +1 -1
- package/src/scripts/dataset/mutations/remove-annex-object.jsx +2 -2
- package/src/scripts/dataset/mutations/remove-permissions.tsx +1 -1
- package/src/scripts/dataset/mutations/revalidate.jsx +2 -2
- package/src/scripts/dataset/mutations/snapshot.tsx +1 -1
- package/src/scripts/dataset/mutations/star.tsx +1 -1
- package/src/scripts/dataset/mutations/submit-metadata.jsx +1 -1
- package/src/scripts/dataset/mutations/undo-deprecate-version.tsx +2 -2
- package/src/scripts/dataset/mutations/update-permissions.tsx +1 -1
- package/src/scripts/dataset/routes/admin-datalad.jsx +4 -0
- package/src/scripts/dataset/routes/dataset-default.tsx +1 -1
- package/src/scripts/dataset/routes/delete-page.tsx +7 -3
- package/src/scripts/dataset/routes/deprecate-snapshot-page.tsx +1 -1
- package/src/scripts/dataset/routes/manage-permissions.jsx +1 -1
- package/src/scripts/dataset/routes/snapshot-default.tsx +1 -1
- package/src/scripts/dataset/routes/snapshot.tsx +1 -1
- package/src/scripts/dataset/snapshot-container.tsx +14 -8
- package/src/scripts/pages/admin/flagged-files.jsx +1 -1
- package/src/scripts/pages/admin/user-tools.tsx +1 -1
- package/src/scripts/pages/admin/users.tsx +2 -2
- package/src/scripts/pages/api.jsx +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/aggregate-counts-container.tsx +6 -7
- package/src/scripts/pages/front-page/front-page.tsx +7 -9
- package/src/scripts/pages/metadata/dataset-metadata.tsx +1 -1
- package/src/scripts/search/__tests__/search-container.spec.tsx +7 -7
- package/src/scripts/search/filters-block-container.tsx +66 -9
- package/src/scripts/search/initial-search-params.tsx +7 -7
- package/src/scripts/search/inputs/__tests__/sort-by-select.spec.tsx +1 -1
- package/src/scripts/search/inputs/admin-allDatasets-toggle.tsx +1 -1
- package/src/scripts/search/inputs/age-range-input.tsx +3 -2
- package/src/scripts/search/inputs/author-input.tsx +3 -2
- package/src/scripts/search/inputs/dataset-type-select.tsx +3 -2
- package/src/scripts/search/inputs/date-radios.tsx +3 -2
- package/src/scripts/search/inputs/diagnosis-select.tsx +3 -2
- package/src/scripts/search/inputs/initiative-select.tsx +12 -6
- package/src/scripts/search/inputs/keyword-input.tsx +2 -2
- package/src/scripts/search/inputs/modality-select.tsx +28 -26
- package/src/scripts/search/inputs/pet/bodyParts_input.tsx +4 -3
- package/src/scripts/search/inputs/pet/scannerManufacturersModelNames_input.tsx +4 -3
- package/src/scripts/search/inputs/pet/scannerManufacturers_input.tsx +4 -3
- package/src/scripts/search/inputs/pet/tracerNames_input.tsx +4 -3
- package/src/scripts/search/inputs/pet/tracerRadionuclides_input.tsx +4 -3
- package/src/scripts/search/inputs/section-select.tsx +3 -2
- package/src/scripts/search/inputs/sex-radios.tsx +3 -2
- package/src/scripts/search/inputs/show-datasets-radios.tsx +4 -3
- package/src/scripts/search/inputs/sort-by-select.tsx +1 -1
- package/src/scripts/search/inputs/species-select.tsx +3 -2
- package/src/scripts/search/inputs/study-domain-input.tsx +4 -3
- package/src/scripts/search/inputs/subject-count-range-input.tsx +3 -2
- package/src/scripts/search/inputs/task-input.tsx +4 -3
- package/src/scripts/search/search-container.tsx +14 -17
- package/src/scripts/search/search-params-ctx.tsx +28 -5
- package/src/scripts/search/search-routes.tsx +2 -4
- package/src/scripts/search/use-search-results.tsx +14 -13
- package/src/scripts/uploader/upload-issues.tsx +1 -1
- package/src/scripts/uploader/upload-progress.jsx +1 -1
- package/src/scripts/uploader/uploader-modal.jsx +1 -1
- package/src/scripts/users/components/close-button.tsx +1 -1
- package/src/scripts/users/components/edit-button.tsx +1 -1
- package/src/scripts/users/components/edit-list.tsx +1 -1
- package/src/scripts/users/components/edit-string.tsx +1 -1
- package/src/scripts/users/dataset-card.tsx +2 -2
- package/src/scripts/users/user-notification-accordion.tsx +1 -1
- package/src/scripts/utils/user-login-modal-ctx.tsx +1 -1
- package/src/scripts/validation/validation-issues.tsx +2 -1
- package/src/scripts/validation/validation-panel.tsx +2 -1
- package/src/scripts/validation/validation-results.tsx +4 -3
- package/src/scripts/validation-legacy/validation-panel.jsx +2 -1
- package/src/scripts/validation-legacy/validation-results.issues.jsx +2 -3
- package/src/scripts/validation-legacy/validation-results.tsx +3 -4
- package/tsconfig.json +1 -4
|
@@ -21,7 +21,7 @@ import { ModalitiesMetaDataBlock } from "./components/ModalitiesMetaDataBlock"
|
|
|
21
21
|
import { ValidationBlock } from "./components/ValidationBlock"
|
|
22
22
|
import { VersionList } from "./components/VersionList"
|
|
23
23
|
import { Username } from "../users/username"
|
|
24
|
-
import { Loading } from "
|
|
24
|
+
import { Loading } from "../components/loading/Loading"
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
getUnexpiredProfile,
|
|
@@ -359,13 +359,17 @@ export interface SnapshotLoaderProps {
|
|
|
359
359
|
|
|
360
360
|
const SnapshotLoader: React.FC<SnapshotLoaderProps> = ({ dataset }) => {
|
|
361
361
|
const { tag } = useParams()
|
|
362
|
-
const { loading, error, data, fetchMore } =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
const { loading, error, data, fetchMore, stopPolling, startPolling } =
|
|
363
|
+
useQuery(
|
|
364
|
+
getSnapshotDetails,
|
|
365
|
+
{
|
|
366
|
+
variables: {
|
|
367
|
+
datasetId: dataset.id,
|
|
368
|
+
tag,
|
|
369
|
+
},
|
|
370
|
+
errorPolicy: "all",
|
|
371
|
+
},
|
|
372
|
+
)
|
|
369
373
|
if (loading) {
|
|
370
374
|
return (
|
|
371
375
|
<div className="loading-dataset">
|
|
@@ -382,6 +386,8 @@ const SnapshotLoader: React.FC<SnapshotLoaderProps> = ({ dataset }) => {
|
|
|
382
386
|
datasetId: dataset.id,
|
|
383
387
|
fetchMore,
|
|
384
388
|
error: null,
|
|
389
|
+
stopPolling,
|
|
390
|
+
startPolling,
|
|
385
391
|
}}
|
|
386
392
|
>
|
|
387
393
|
<SnapshotContainer
|
|
@@ -5,7 +5,7 @@ import PropTypes from "prop-types"
|
|
|
5
5
|
import { useQuery } from "@apollo/client"
|
|
6
6
|
import { gql } from "@apollo/client"
|
|
7
7
|
import Helmet from "react-helmet"
|
|
8
|
-
import { Loading } from "
|
|
8
|
+
import { Loading } from "../../components/loading/Loading"
|
|
9
9
|
import { Link } from "react-router-dom"
|
|
10
10
|
import { pageTitle } from "../../resources/strings.js"
|
|
11
11
|
|
|
@@ -2,7 +2,7 @@ import React from "react"
|
|
|
2
2
|
import type { FC, ReactElement } from "react"
|
|
3
3
|
import { gql } from "@apollo/client"
|
|
4
4
|
import { Mutation } from "@apollo/client/react/components"
|
|
5
|
-
import { WarnButton } from "
|
|
5
|
+
import { WarnButton } from "../../components/warn-button/WarnButton"
|
|
6
6
|
import { getProfile } from "../../authentication/profile"
|
|
7
7
|
import { useCookies } from "react-cookie"
|
|
8
8
|
import { USER_FRAGMENT } from "./user-fragment"
|
|
@@ -3,8 +3,8 @@ import { Query } from "@apollo/client/react/components"
|
|
|
3
3
|
import { gql } from "@apollo/client"
|
|
4
4
|
import parseISO from "date-fns/parseISO"
|
|
5
5
|
import formatDistanceToNow from "date-fns/formatDistanceToNow"
|
|
6
|
-
import { Input } from "
|
|
7
|
-
import { Loading } from "
|
|
6
|
+
import { Input } from "../../components/input/Input"
|
|
7
|
+
import { Loading } from "../../components/loading/Loading"
|
|
8
8
|
import { formatDate } from "../../utils/date.js"
|
|
9
9
|
import Helmet from "react-helmet"
|
|
10
10
|
import { pageTitle } from "../../resources/strings.js"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import { Loading } from "
|
|
2
|
+
import { Loading } from "../components/loading/Loading"
|
|
3
3
|
import { CopyToClipboard } from "react-copy-to-clipboard"
|
|
4
4
|
import Helmet from "react-helmet"
|
|
5
5
|
import { pageTitle } from "../resources/strings.js"
|
|
6
|
-
import { Button } from "
|
|
6
|
+
import { Button } from "../components/button/Button"
|
|
7
7
|
import LoggedIn from "../authentication/logged-in"
|
|
8
8
|
import LoggedOut from "../authentication/logged-out"
|
|
9
9
|
import { config } from "../config"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import useParticipantCount from "./use-participant-count"
|
|
3
3
|
import usePublicDatasetsCount from "./use-publicDatasets-count"
|
|
4
|
-
import { AggregateCount } from "
|
|
4
|
+
import { AggregateCount } from "../../../components/aggregate-count/AggregateCount"
|
|
5
5
|
|
|
6
6
|
export interface AggregateCountsContainerProps {
|
|
7
7
|
modality?: string
|
|
@@ -29,12 +29,11 @@ const AggregateCountsContainer: React.FC<AggregateCountsContainerProps> = ({
|
|
|
29
29
|
else {
|
|
30
30
|
return (
|
|
31
31
|
<>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
)}
|
|
32
|
+
<AggregateCount
|
|
33
|
+
type="participants"
|
|
34
|
+
count={participantData.participantCount}
|
|
35
|
+
/>
|
|
36
|
+
|
|
38
37
|
<AggregateCount
|
|
39
38
|
type="publicDataset"
|
|
40
39
|
count={publicDatasetsData.datasets?.pageInfo?.count ||
|
|
@@ -4,15 +4,13 @@ import { gql, useQuery } from "@apollo/client"
|
|
|
4
4
|
import { Mutation } from "@apollo/client/react/components"
|
|
5
5
|
import styled from "@emotion/styled"
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "
|
|
14
|
-
import { Loading } from "@openneuro/components/loading"
|
|
15
|
-
import { ActivitySlider } from "@openneuro/components/activity-slider"
|
|
7
|
+
import { ActivityHeader } from "../../components/front-page/ActivityHeader"
|
|
8
|
+
import { AffiliateBlock } from "../../components/front-page/AffiliateBlock"
|
|
9
|
+
import { Contributors } from "../../components/front-page/Contributors"
|
|
10
|
+
import { GetUpdates } from "../../components/front-page/GetUpdates"
|
|
11
|
+
import { Infographic } from "../../components/front-page/Infographic"
|
|
12
|
+
import { Loading } from "../../components/loading/Loading"
|
|
13
|
+
import { ActivitySlider } from "../../components/activity-slider/ActivitySlider"
|
|
16
14
|
|
|
17
15
|
const SUBSCRIBE_TO_NEWSLETTER = gql`
|
|
18
16
|
mutation subscribeToNewsletter($email: String!) {
|
|
@@ -2,7 +2,7 @@ import React from "react"
|
|
|
2
2
|
import styled from "@emotion/styled"
|
|
3
3
|
import { DataTable } from "../../components/data-table"
|
|
4
4
|
import { gql, useQuery } from "@apollo/client"
|
|
5
|
-
import { Loading } from "
|
|
5
|
+
import { Loading } from "../../components/loading/Loading"
|
|
6
6
|
import { makeCsv } from "../../utils/csv"
|
|
7
7
|
|
|
8
8
|
const MetadataPageStyle = styled.div`
|
|
@@ -4,10 +4,10 @@ import { setDefaultSearch } from "../search-container"
|
|
|
4
4
|
describe("SearchContainer component", () => {
|
|
5
5
|
describe("setDefaultSearch", () => {
|
|
6
6
|
it("updates default state when a modality is provided differing from the default", () => {
|
|
7
|
-
const context = { modality_selected: "
|
|
7
|
+
const context = { modality_selected: "mri" }
|
|
8
8
|
const setContext = vi.fn()
|
|
9
9
|
setDefaultSearch(
|
|
10
|
-
"
|
|
10
|
+
"mri",
|
|
11
11
|
"",
|
|
12
12
|
false,
|
|
13
13
|
context,
|
|
@@ -16,7 +16,7 @@ describe("SearchContainer component", () => {
|
|
|
16
16
|
)
|
|
17
17
|
expect(setContext).not.toHaveBeenCalled()
|
|
18
18
|
setDefaultSearch(
|
|
19
|
-
"
|
|
19
|
+
"pet",
|
|
20
20
|
"",
|
|
21
21
|
false,
|
|
22
22
|
context,
|
|
@@ -27,14 +27,14 @@ describe("SearchContainer component", () => {
|
|
|
27
27
|
})
|
|
28
28
|
it('sets datasetType_select to my datasets with "mydatasets" parameter', () => {
|
|
29
29
|
let context = {
|
|
30
|
-
modality_selected: "
|
|
30
|
+
modality_selected: "mri",
|
|
31
31
|
datasetType_selected: "All Public",
|
|
32
32
|
}
|
|
33
33
|
const setContext = vi.fn().mockImplementation((arg) => {
|
|
34
34
|
context = arg(context)
|
|
35
35
|
})
|
|
36
36
|
setDefaultSearch(
|
|
37
|
-
"
|
|
37
|
+
"mri",
|
|
38
38
|
"",
|
|
39
39
|
false,
|
|
40
40
|
context,
|
|
@@ -45,14 +45,14 @@ describe("SearchContainer component", () => {
|
|
|
45
45
|
})
|
|
46
46
|
it('sets datasetType_select to my datasets with "bookmarks" parameter', () => {
|
|
47
47
|
let context = {
|
|
48
|
-
modality_selected: "
|
|
48
|
+
modality_selected: "pet",
|
|
49
49
|
datasetType_selected: "All Public",
|
|
50
50
|
}
|
|
51
51
|
const setContext = vi.fn().mockImplementation((arg) => {
|
|
52
52
|
context = arg(context)
|
|
53
53
|
})
|
|
54
54
|
setDefaultSearch(
|
|
55
|
-
"
|
|
55
|
+
"pet",
|
|
56
56
|
"",
|
|
57
57
|
false,
|
|
58
58
|
context,
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React, { useContext } from "react"
|
|
2
2
|
import * as Sentry from "@sentry/react"
|
|
3
3
|
import type { FC } from "react"
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useMatch,
|
|
6
|
+
useNavigate,
|
|
7
|
+
useParams,
|
|
8
|
+
useSearchParams,
|
|
9
|
+
} from "react-router-dom"
|
|
5
10
|
import {
|
|
6
11
|
getSelectParams,
|
|
7
12
|
removeFilterItem,
|
|
8
13
|
SearchParamsCtx,
|
|
9
14
|
useCheckIfParamsAreSelected,
|
|
10
15
|
} from "./search-params-ctx"
|
|
11
|
-
import { FiltersBlock } from "
|
|
16
|
+
import { FiltersBlock } from "../components/search-page/FiltersBlock"
|
|
12
17
|
import initialSearchParams from "./initial-search-params"
|
|
13
18
|
|
|
14
19
|
interface FiltersBlockContainerProps {
|
|
@@ -25,34 +30,85 @@ const FiltersBlockContainer: FC<FiltersBlockContainerProps> = ({
|
|
|
25
30
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
26
31
|
const selectedParams = getSelectParams(searchParams)
|
|
27
32
|
|
|
28
|
-
const noFilters = !useCheckIfParamsAreSelected([
|
|
33
|
+
const noFilters = !useCheckIfParamsAreSelected([
|
|
34
|
+
"modality_selected",
|
|
35
|
+
"brain_initiative",
|
|
36
|
+
])
|
|
29
37
|
|
|
30
38
|
const navigate = useNavigate()
|
|
31
39
|
const { path } = useParams()
|
|
32
40
|
const globalSearchPath = "/search"
|
|
33
41
|
|
|
42
|
+
const isModalityPath = useMatch("/search/modality/*")
|
|
43
|
+
|
|
44
|
+
const [searchParamsObj, setSearchParamsObj] = useSearchParams()
|
|
45
|
+
|
|
34
46
|
const removeFilter =
|
|
35
47
|
(isModality?: boolean) => (param: string, value: FilterValue): void => {
|
|
36
48
|
if (isModality && param === "modality_selected") {
|
|
37
49
|
removeFilterItem(setSearchParams)(param, value)
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
|
|
51
|
+
// Remove the modality_selected filter directly
|
|
52
|
+
searchParamsObj.delete("modality_selected")
|
|
53
|
+
|
|
54
|
+
// Modify `query` if we need to remove the filter from it
|
|
55
|
+
const query = searchParamsObj.get("query")
|
|
56
|
+
if (query) {
|
|
57
|
+
try {
|
|
58
|
+
const queryObj = JSON.parse(query)
|
|
59
|
+
delete queryObj["modality_selected"]
|
|
60
|
+
searchParamsObj.set("query", JSON.stringify(queryObj))
|
|
61
|
+
} catch (error) {
|
|
62
|
+
Sentry.captureException(error)
|
|
63
|
+
// fallback
|
|
64
|
+
searchParamsObj.delete("query")
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
setSearchParamsObj(searchParamsObj)
|
|
70
|
+
navigate(`${globalSearchPath}?${searchParamsObj.toString()}`, {
|
|
71
|
+
replace: true,
|
|
72
|
+
})
|
|
73
|
+
} catch (error) {
|
|
74
|
+
Sentry.captureException(error)
|
|
75
|
+
}
|
|
76
|
+
} else if (!isModalityPath && param === "brain_initiative") {
|
|
77
|
+
removeFilterItem(setSearchParams)(param, value)
|
|
78
|
+
|
|
79
|
+
// Remove the brain_initiative filter directly
|
|
80
|
+
searchParamsObj.delete("brain_initiative")
|
|
81
|
+
|
|
82
|
+
// Modify `query` if we need to remove the filter from it
|
|
83
|
+
const query = searchParamsObj.get("query")
|
|
40
84
|
if (query) {
|
|
41
85
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
86
|
+
const queryObj = JSON.parse(query)
|
|
87
|
+
delete queryObj["brain_initiative"]
|
|
88
|
+
searchParamsObj.set("query", JSON.stringify(queryObj))
|
|
45
89
|
} catch (error) {
|
|
46
90
|
Sentry.captureException(error)
|
|
91
|
+
// fallback
|
|
92
|
+
searchParamsObj.delete("query")
|
|
47
93
|
}
|
|
48
94
|
}
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
setSearchParamsObj(searchParamsObj)
|
|
98
|
+
navigate(`${globalSearchPath}?${searchParamsObj.toString()}`, {
|
|
99
|
+
replace: true,
|
|
100
|
+
})
|
|
101
|
+
} catch (error) {
|
|
102
|
+
Sentry.captureException(error)
|
|
103
|
+
}
|
|
49
104
|
} else {
|
|
105
|
+
// For other filters, just remove them normally
|
|
50
106
|
removeFilterItem(setSearchParams)(param, value)
|
|
51
107
|
}
|
|
52
108
|
}
|
|
53
109
|
|
|
54
110
|
const removeAllFilters = (): void => {
|
|
55
|
-
//
|
|
111
|
+
// Reset params to default values, preserving other query params
|
|
56
112
|
setSearchParams((prevState) => ({
|
|
57
113
|
...prevState,
|
|
58
114
|
...getSelectParams(initialSearchParams),
|
|
@@ -68,6 +124,7 @@ const FiltersBlockContainer: FC<FiltersBlockContainerProps> = ({
|
|
|
68
124
|
numTotalResults={numTotalResults}
|
|
69
125
|
{...selectedParams}
|
|
70
126
|
loading={loading}
|
|
127
|
+
brain_initiative={searchParams.brain_initiative}
|
|
71
128
|
/>
|
|
72
129
|
)
|
|
73
130
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sortBy } from "
|
|
1
|
+
import { sortBy } from "../common/content/sortby-list"
|
|
2
2
|
|
|
3
3
|
const datasetType_available = [
|
|
4
4
|
{ label: "All Public", value: "All Public" },
|
|
@@ -24,7 +24,7 @@ type ModalityOption = {
|
|
|
24
24
|
export const modality_available: ModalityOption[] = [
|
|
25
25
|
{
|
|
26
26
|
label: "MRI",
|
|
27
|
-
value: "
|
|
27
|
+
value: "mri",
|
|
28
28
|
portalPath: "/search/modality/mri",
|
|
29
29
|
count: null,
|
|
30
30
|
// children: [
|
|
@@ -56,7 +56,7 @@ export const modality_available: ModalityOption[] = [
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
label: "PET",
|
|
59
|
-
value: "
|
|
59
|
+
value: "pet",
|
|
60
60
|
portalPath: "/search/modality/pet",
|
|
61
61
|
count: null,
|
|
62
62
|
// children: [
|
|
@@ -76,25 +76,25 @@ export const modality_available: ModalityOption[] = [
|
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
label: "EEG",
|
|
79
|
-
value: "
|
|
79
|
+
value: "eeg",
|
|
80
80
|
portalPath: "/search/modality/eeg",
|
|
81
81
|
count: null,
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
label: "iEEG",
|
|
85
|
-
value: "
|
|
85
|
+
value: "ieeg",
|
|
86
86
|
portalPath: "/search/modality/ieeg",
|
|
87
87
|
count: null,
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
label: "MEG",
|
|
91
|
-
value: "
|
|
91
|
+
value: "meg",
|
|
92
92
|
portalPath: "/search/modality/meg",
|
|
93
93
|
count: null,
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
label: "NIRS",
|
|
97
|
-
value: "
|
|
97
|
+
value: "nirs",
|
|
98
98
|
portalPath: "/search/modality/nirs",
|
|
99
99
|
count: null,
|
|
100
100
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from "react"
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
4
|
-
import { Button } from "
|
|
4
|
+
import { Button } from "../../components/button/Button"
|
|
5
5
|
import styled from "@emotion/styled"
|
|
6
6
|
|
|
7
7
|
const StyledButton = styled(Button)`
|
|
@@ -2,8 +2,9 @@ import React, { useContext } from "react"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
4
4
|
import initialSearchParams from "../initial-search-params"
|
|
5
|
-
import { FacetRange } from "
|
|
6
|
-
import { AccordionTab
|
|
5
|
+
import { FacetRange } from "../../components/facets/FacetRange"
|
|
6
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
7
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
7
8
|
|
|
8
9
|
const AgeRangeInput: FC = () => {
|
|
9
10
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -2,8 +2,9 @@ import React, { useContext } from "react"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import useState from "react-usestateref"
|
|
4
4
|
import { removeFilterItem, SearchParamsCtx } from "../search-params-ctx"
|
|
5
|
-
import { FacetSearch } from "
|
|
6
|
-
import { AccordionTab
|
|
5
|
+
import { FacetSearch } from "../../components/facets/FacetSearch"
|
|
6
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
7
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
7
8
|
|
|
8
9
|
const AuthorInput: FC = () => {
|
|
9
10
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from "react"
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
4
|
-
import { FacetSelect } from "
|
|
5
|
-
import { AccordionTab
|
|
4
|
+
import { FacetSelect } from "../../components/facets/FacetSelect"
|
|
5
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
6
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
6
7
|
|
|
7
8
|
const DatasetTypeSelect: FC = () => {
|
|
8
9
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from "react"
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
4
|
-
import { FacetRadio } from "
|
|
5
|
-
import { AccordionTab
|
|
4
|
+
import { FacetRadio } from "../../components/facets/FacetRadio"
|
|
5
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
6
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
6
7
|
|
|
7
8
|
const DateRadios: FC = () => {
|
|
8
9
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useContext } from "react"
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
4
|
-
import { FacetSelect } from "
|
|
5
|
-
import { AccordionTab
|
|
4
|
+
import { FacetSelect } from "../../components/facets/FacetSelect"
|
|
5
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
6
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
6
7
|
|
|
7
8
|
const DiagnosisSelect: FC = () => {
|
|
8
9
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -2,8 +2,9 @@ import React, { useContext, useEffect } from "react"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import { useLocation, useNavigate } from "react-router-dom"
|
|
4
4
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
5
|
-
import { AccordionTab
|
|
6
|
-
import {
|
|
5
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
6
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
7
|
+
import { SingleSelect } from "../../components/facets/SingleSelect"
|
|
7
8
|
|
|
8
9
|
interface InitiativeSelectProps {
|
|
9
10
|
label: string
|
|
@@ -19,7 +20,6 @@ const InitiativeSelect: FC<InitiativeSelectProps> = ({ label }) => {
|
|
|
19
20
|
const setBrainInitiative = (selectedValue: string): void => {
|
|
20
21
|
const newSelectedFunding = selectedValue === "NIH" ? "true" : ""
|
|
21
22
|
|
|
22
|
-
// Update only brain_initiative in the search params context
|
|
23
23
|
setSearchParams((prevState) => ({
|
|
24
24
|
...prevState,
|
|
25
25
|
brain_initiative: newSelectedFunding,
|
|
@@ -35,8 +35,10 @@ const InitiativeSelect: FC<InitiativeSelectProps> = ({ label }) => {
|
|
|
35
35
|
} else {
|
|
36
36
|
params.delete("query")
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// Check if the URL contains 'modality_selected' before navigating
|
|
39
|
+
if (!location.search.includes("modality_selected")) {
|
|
40
|
+
navigate(`/search/nih?${params.toString()}`, { replace: true })
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
useEffect(() => {
|
|
@@ -46,7 +48,11 @@ const InitiativeSelect: FC<InitiativeSelectProps> = ({ label }) => {
|
|
|
46
48
|
) {
|
|
47
49
|
const params = new URLSearchParams(location.search)
|
|
48
50
|
params.set("query", JSON.stringify({ brain_initiative: "true" }))
|
|
49
|
-
|
|
51
|
+
|
|
52
|
+
// Check if the URL contains 'modality_selected' before navigating
|
|
53
|
+
if (!location.search.includes("modality_selected")) {
|
|
54
|
+
navigate(`/search/nih?${params.toString()}`, { replace: true })
|
|
55
|
+
}
|
|
50
56
|
}
|
|
51
57
|
}, [brain_initiative, location.search, navigate])
|
|
52
58
|
|
|
@@ -2,8 +2,8 @@ import React, { useContext } from "react"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import useState from "react-usestateref"
|
|
4
4
|
import { removeFilterItem, SearchParamsCtx } from "../search-params-ctx"
|
|
5
|
-
import { TermSearch } from "
|
|
6
|
-
import { Icon } from "
|
|
5
|
+
import { TermSearch } from "../../components/input/TermSearch"
|
|
6
|
+
import { Icon } from "../../components/icon/Icon"
|
|
7
7
|
|
|
8
8
|
const KeywordInput: FC = () => {
|
|
9
9
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from "react"
|
|
2
|
-
import
|
|
3
|
-
import { useNavigate } from "react-router-dom"
|
|
2
|
+
import { useLocation, useNavigate } from "react-router-dom"
|
|
4
3
|
import { SearchParamsCtx } from "../search-params-ctx"
|
|
5
4
|
import { flattenedModalities } from "../initial-search-params"
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import initialSearchParams from "../initial-search-params"
|
|
5
|
+
import { FacetSelect } from "../../components/facets/FacetSelect"
|
|
6
|
+
import { AccordionTab } from "../../components/accordion/AccordionTab"
|
|
7
|
+
import { AccordionWrap } from "../../components/accordion/AccordionWrap"
|
|
10
8
|
|
|
11
9
|
interface ModalitySelectProps {
|
|
12
10
|
inHeader?: boolean
|
|
@@ -16,8 +14,7 @@ interface ModalitySelectProps {
|
|
|
16
14
|
dropdown?: boolean
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
const ModalitySelect: FC<ModalitySelectProps> = ({
|
|
20
|
-
inHeader = false,
|
|
17
|
+
const ModalitySelect: React.FC<ModalitySelectProps> = ({
|
|
21
18
|
startOpen = true,
|
|
22
19
|
label,
|
|
23
20
|
portalStyles = false,
|
|
@@ -25,21 +22,26 @@ const ModalitySelect: FC<ModalitySelectProps> = ({
|
|
|
25
22
|
}) => {
|
|
26
23
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
27
24
|
const navigate = useNavigate()
|
|
25
|
+
const location = useLocation()
|
|
28
26
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
const setModality = (modality_selected: string) => {
|
|
28
|
+
setSearchParams((prevState) => ({
|
|
29
|
+
...prevState,
|
|
30
|
+
modality_selected,
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
const modality_selected_path = flattenedModalities.find(
|
|
34
|
+
(modality) => modality.value === modality_selected,
|
|
35
|
+
)?.portalPath
|
|
36
|
+
|
|
37
|
+
const currentParams = new URLSearchParams(location.search)
|
|
38
|
+
currentParams.set("modality_selected", modality_selected)
|
|
39
|
+
const newQueryString = currentParams.toString()
|
|
40
|
+
|
|
41
|
+
navigate({
|
|
42
|
+
pathname: modality_selected_path,
|
|
43
|
+
search: newQueryString ? `?${newQueryString}` : "",
|
|
44
|
+
})
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
return (
|
|
@@ -49,9 +51,9 @@ const ModalitySelect: FC<ModalitySelectProps> = ({
|
|
|
49
51
|
<FacetSelect
|
|
50
52
|
className="modality-facet facet-open"
|
|
51
53
|
label={label}
|
|
52
|
-
selected={modality_selected}
|
|
54
|
+
selected={searchParams.modality_selected}
|
|
53
55
|
setSelected={setModality}
|
|
54
|
-
items={modality_available}
|
|
56
|
+
items={searchParams.modality_available}
|
|
55
57
|
/>
|
|
56
58
|
)
|
|
57
59
|
: (
|
|
@@ -63,9 +65,9 @@ const ModalitySelect: FC<ModalitySelectProps> = ({
|
|
|
63
65
|
dropdown={dropdown}
|
|
64
66
|
>
|
|
65
67
|
<FacetSelect
|
|
66
|
-
selected={modality_selected}
|
|
68
|
+
selected={searchParams.modality_selected}
|
|
67
69
|
setSelected={setModality}
|
|
68
|
-
items={modality_available}
|
|
70
|
+
items={searchParams.modality_available}
|
|
69
71
|
/>
|
|
70
72
|
</AccordionTab>
|
|
71
73
|
</AccordionWrap>
|
|
@@ -2,9 +2,10 @@ import React, { useContext } from "react"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import useState from "react-usestateref"
|
|
4
4
|
import { removeFilterItem, SearchParamsCtx } from "../../search-params-ctx"
|
|
5
|
-
import { FacetSearch } from "
|
|
6
|
-
import { Icon } from "
|
|
7
|
-
import { AccordionTab
|
|
5
|
+
import { FacetSearch } from "../../../components/facets/FacetSearch"
|
|
6
|
+
import { Icon } from "../../../components/icon/Icon"
|
|
7
|
+
import { AccordionTab } from "../../../components/accordion/AccordionTab"
|
|
8
|
+
import { AccordionWrap } from "../../../components/accordion/AccordionWrap"
|
|
8
9
|
|
|
9
10
|
const BodyPartsInput: FC = () => {
|
|
10
11
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|
|
@@ -2,9 +2,10 @@ import React, { useContext } from "react"
|
|
|
2
2
|
import type { FC } from "react"
|
|
3
3
|
import useState from "react-usestateref"
|
|
4
4
|
import { removeFilterItem, SearchParamsCtx } from "../../search-params-ctx"
|
|
5
|
-
import { FacetSearch } from "
|
|
6
|
-
import { Icon } from "
|
|
7
|
-
import { AccordionTab
|
|
5
|
+
import { FacetSearch } from "../../../components/facets/FacetSearch"
|
|
6
|
+
import { Icon } from "../../../components/icon/Icon"
|
|
7
|
+
import { AccordionTab } from "../../../components/accordion/AccordionTab"
|
|
8
|
+
import { AccordionWrap } from "../../../components/accordion/AccordionWrap"
|
|
8
9
|
|
|
9
10
|
const ScannerManufacturersModelNamesInput: FC = () => {
|
|
10
11
|
const { searchParams, setSearchParams } = useContext(SearchParamsCtx)
|