@openneuro/app 4.20.5 → 4.20.6-alpha.2
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/__mocks__/fileMock.js +1 -1
- package/package.json +5 -5
- package/pluralize-esm.js +204 -211
- package/src/@types/custom.d.ts +3 -3
- package/src/@types/react.d.ts +3 -4
- package/src/client.jsx +17 -16
- package/src/scripts/__mocks__/config.ts +6 -6
- package/src/scripts/__utils__/mock-app-shell.tsx +9 -8
- package/src/scripts/apm.js +6 -6
- package/src/scripts/app.tsx +7 -7
- package/src/scripts/authentication/__tests__/profile.spec.js +10 -10
- package/src/scripts/authentication/admin-user.jsx +2 -2
- package/src/scripts/authentication/logged-in.jsx +2 -2
- package/src/scripts/authentication/logged-out.jsx +2 -2
- package/src/scripts/authentication/loginCheck.js +2 -2
- package/src/scripts/authentication/loginUrls.ts +1 -1
- package/src/scripts/authentication/profile.ts +7 -7
- package/src/scripts/authentication/regular-user.tsx +3 -3
- package/src/scripts/authentication/signOut.ts +2 -2
- package/src/scripts/authentication/withProfile.jsx +6 -6
- package/src/scripts/common/block-navigation.jsx +3 -4
- package/src/scripts/common/containers/__tests__/header.spec.tsx +16 -16
- package/src/scripts/common/containers/footer.tsx +3 -3
- package/src/scripts/common/containers/header.tsx +30 -30
- package/src/scripts/common/forms/__tests__/warn-button.spec.jsx +6 -6
- package/src/scripts/common/forms/warn-button.jsx +21 -17
- package/src/scripts/common/partials/block-navigation.jsx +3 -4
- package/src/scripts/common/partials/freshdesk-widget.jsx +17 -20
- package/src/scripts/common/partials/toast-content.jsx +2 -2
- package/src/scripts/components/__tests__/data-table.spec.tsx +7 -7
- package/src/scripts/components/data-table.tsx +23 -22
- package/src/scripts/config.ts +2 -2
- package/src/scripts/datalad/dataset/comments-fragments.js +1 -1
- package/src/scripts/datalad/dataset/dataset-context.js +1 -1
- package/src/scripts/datalad/dataset/dataset-query-context.js +1 -1
- package/src/scripts/datalad/dataset/dataset-query-fragments.js +1 -1
- package/src/scripts/datalad/mutations/cache-clear.jsx +7 -6
- package/src/scripts/datalad/mutations/cache-id.js +2 -2
- package/src/scripts/datalad/mutations/delete-comment.jsx +13 -11
- package/src/scripts/datalad/mutations/delete.jsx +10 -9
- package/src/scripts/datalad/mutations/follow.jsx +12 -11
- package/src/scripts/datalad/mutations/publish.jsx +13 -12
- package/src/scripts/datalad/mutations/remove-permissions.jsx +8 -8
- package/src/scripts/datalad/mutations/revalidate.jsx +7 -6
- package/src/scripts/datalad/mutations/snapshot.tsx +7 -7
- package/src/scripts/datalad/mutations/star.jsx +12 -11
- package/src/scripts/datalad/mutations/submit-metadata.jsx +14 -12
- package/src/scripts/datalad/mutations/update-permissions.jsx +14 -13
- package/src/scripts/datalad/mutations/update-ref.jsx +7 -6
- package/src/scripts/datalad/routes/dataset-redirect.tsx +49 -49
- package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +32 -32
- package/src/scripts/datalad/subscriptions/files-subscription.jsx +16 -16
- package/src/scripts/datalad/subscriptions/useDatasetDeletedSubscription.jsx +4 -4
- package/src/scripts/datalad/subscriptions/useDraftSubscription.js +4 -4
- package/src/scripts/datalad/subscriptions/usePermissionsSubscription.js +4 -4
- package/src/scripts/datalad/subscriptions/useSnapshotsUpdatedSubscriptions.js +3 -3
- package/src/scripts/dataset/__tests__/__snapshots__/snapshot-container.spec.tsx.snap +2 -2
- package/src/scripts/dataset/__tests__/snapshot-container.spec.tsx +12 -12
- package/src/scripts/dataset/comments/__tests__/comment.spec.jsx +21 -21
- package/src/scripts/dataset/comments/__tests__/comments.spec.jsx +10 -10
- package/src/scripts/dataset/comments/block-style-controls.jsx +15 -15
- package/src/scripts/dataset/comments/comment-editor.jsx +31 -31
- package/src/scripts/dataset/comments/comment.jsx +50 -50
- package/src/scripts/dataset/comments/comments.jsx +24 -22
- package/src/scripts/dataset/comments/inline-style-controls.jsx +9 -9
- package/src/scripts/dataset/comments/style-button.jsx +8 -9
- package/src/scripts/dataset/common/follow-toggles.tsx +3 -3
- package/src/scripts/dataset/dataset-query-context.js +1 -1
- package/src/scripts/dataset/dataset-query.jsx +34 -31
- package/src/scripts/dataset/dataset-routes.jsx +5 -5
- package/src/scripts/dataset/download/__tests__/download-command-line.spec.jsx +13 -13
- package/src/scripts/dataset/download/__tests__/download-link.spec.jsx +10 -10
- package/src/scripts/dataset/download/__tests__/download-native.spec.js +7 -7
- package/src/scripts/dataset/download/__tests__/shell-example.spec.jsx +5 -5
- package/src/scripts/dataset/download/download-command-line.jsx +9 -7
- package/src/scripts/dataset/download/download-datalad.jsx +22 -20
- package/src/scripts/dataset/download/download-derivative-datalad.tsx +2 -2
- package/src/scripts/dataset/download/download-derivative-s3.tsx +2 -2
- package/src/scripts/dataset/download/download-link.jsx +6 -6
- package/src/scripts/dataset/download/download-native.js +20 -19
- package/src/scripts/dataset/download/download-query.js +2 -3
- package/src/scripts/dataset/download/download-s3.jsx +8 -8
- package/src/scripts/dataset/download/download-script.tsx +23 -20
- package/src/scripts/dataset/download/native-file-toast.jsx +13 -11
- package/src/scripts/dataset/download/shell-example.jsx +1 -1
- package/src/scripts/dataset/download/track-download.js +5 -5
- package/src/scripts/dataset/draft-container.tsx +104 -102
- package/src/scripts/dataset/draft-snapshot-routes.tsx +3 -3
- package/src/scripts/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +23 -23
- package/src/scripts/dataset/files/__tests__/file-tree.spec.jsx +57 -58
- package/src/scripts/dataset/files/__tests__/file-viewer-type.spec.jsx +6 -6
- package/src/scripts/dataset/files/__tests__/file.spec.jsx +15 -15
- package/src/scripts/dataset/files/file-display.jsx +11 -11
- package/src/scripts/dataset/files/file-tree-unloaded-directory.jsx +10 -10
- package/src/scripts/dataset/files/file-tree.tsx +27 -27
- package/src/scripts/dataset/files/file-view.jsx +4 -4
- package/src/scripts/dataset/files/file-viewer-type.jsx +21 -21
- package/src/scripts/dataset/files/file.tsx +85 -80
- package/src/scripts/dataset/files/files.tsx +41 -40
- package/src/scripts/dataset/files/index.tsx +2 -2
- package/src/scripts/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +0 -24
- package/src/scripts/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +9 -9
- package/src/scripts/dataset/files/viewers/__tests__/parse-tabular.spec.js +8 -8
- package/src/scripts/dataset/files/viewers/file-viewer-csv.jsx +5 -5
- package/src/scripts/dataset/files/viewers/file-viewer-html.jsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-json.jsx +4 -4
- package/src/scripts/dataset/files/viewers/file-viewer-nifti.tsx +4 -4
- package/src/scripts/dataset/files/viewers/file-viewer-table.tsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-text.jsx +3 -3
- package/src/scripts/dataset/files/viewers/file-viewer-tsv.jsx +5 -5
- package/src/scripts/dataset/files/viewers/parse-tabular.js +4 -4
- package/src/scripts/dataset/fragments/__tests__/cancel-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/dataset-alert-draft.spec.tsx +9 -9
- package/src/scripts/dataset/fragments/__tests__/dataset-citation.spec.jsx +10 -10
- package/src/scripts/dataset/fragments/__tests__/doi-link.spec.tsx +29 -29
- package/src/scripts/dataset/fragments/__tests__/edit-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/edit-list.spec.jsx +13 -13
- package/src/scripts/dataset/fragments/__tests__/save-button.spec.tsx +5 -5
- package/src/scripts/dataset/fragments/__tests__/select-input.spec.tsx +26 -26
- package/src/scripts/dataset/fragments/cancel-button.tsx +2 -2
- package/src/scripts/dataset/fragments/comments-fragments.js +1 -1
- package/src/scripts/dataset/fragments/copyable-tooltip.jsx +14 -13
- package/src/scripts/dataset/fragments/dataset-alert-draft.tsx +17 -13
- package/src/scripts/dataset/fragments/dataset-alert-version.tsx +5 -4
- package/src/scripts/dataset/fragments/dataset-citation.jsx +23 -21
- package/src/scripts/dataset/fragments/dataset-history.jsx +12 -12
- package/src/scripts/dataset/fragments/dataset-reviewers.ts +1 -1
- package/src/scripts/dataset/fragments/doi-link.tsx +6 -6
- package/src/scripts/dataset/fragments/edit-button.tsx +2 -2
- package/src/scripts/dataset/fragments/edit-description-field.jsx +23 -21
- package/src/scripts/dataset/fragments/edit-description-list.jsx +8 -8
- package/src/scripts/dataset/fragments/edit-list.jsx +8 -8
- package/src/scripts/dataset/fragments/number-input.tsx +36 -35
- package/src/scripts/dataset/fragments/save-button.tsx +2 -2
- package/src/scripts/dataset/fragments/select-input.tsx +87 -86
- package/src/scripts/dataset/fragments/text-array-input.tsx +38 -37
- package/src/scripts/dataset/fragments/text-input.tsx +79 -78
- package/src/scripts/dataset/mutations/__tests__/cache-id.spec.js +5 -5
- package/src/scripts/dataset/mutations/__tests__/delete-file.spec.jsx +85 -83
- package/src/scripts/dataset/mutations/__tests__/delete.spec.jsx +8 -8
- package/src/scripts/dataset/mutations/__tests__/deprecate-snapshot.spec.tsx +17 -17
- package/src/scripts/dataset/mutations/__tests__/deprecate-version.spec.tsx +19 -19
- package/src/scripts/dataset/mutations/__tests__/description.spec.jsx +51 -51
- package/src/scripts/dataset/mutations/__tests__/remove-permissions.spec.tsx +9 -9
- package/src/scripts/dataset/mutations/__tests__/update-permissions.spec.jsx +7 -7
- package/src/scripts/dataset/mutations/admin-exports.jsx +13 -12
- package/src/scripts/dataset/mutations/cache-clear.jsx +6 -6
- package/src/scripts/dataset/mutations/cache-id.js +2 -2
- package/src/scripts/dataset/mutations/comment.jsx +25 -23
- package/src/scripts/dataset/mutations/create-anonymous-reviewer.tsx +36 -30
- package/src/scripts/dataset/mutations/dataset-relations.tsx +28 -29
- package/src/scripts/dataset/mutations/delete-anonymous-reviewer.tsx +7 -8
- package/src/scripts/dataset/mutations/delete-comment.jsx +14 -12
- package/src/scripts/dataset/mutations/delete-dataset-form.jsx +20 -22
- package/src/scripts/dataset/mutations/delete-file.jsx +8 -8
- package/src/scripts/dataset/mutations/delete.jsx +10 -9
- package/src/scripts/dataset/mutations/deprecate-version.tsx +5 -6
- package/src/scripts/dataset/mutations/description.jsx +21 -20
- package/src/scripts/dataset/mutations/flag-annex-object.jsx +10 -9
- package/src/scripts/dataset/mutations/follow.tsx +15 -14
- package/src/scripts/dataset/mutations/import-dataset.tsx +5 -5
- package/src/scripts/dataset/mutations/metadata-form.jsx +94 -97
- package/src/scripts/dataset/mutations/publish.jsx +13 -13
- package/src/scripts/dataset/mutations/readme.jsx +12 -11
- package/src/scripts/dataset/mutations/remove-annex-object.jsx +10 -9
- package/src/scripts/dataset/mutations/remove-permissions.tsx +5 -6
- package/src/scripts/dataset/mutations/revalidate.jsx +7 -7
- package/src/scripts/dataset/mutations/snapshot.tsx +8 -8
- package/src/scripts/dataset/mutations/star.tsx +14 -13
- package/src/scripts/dataset/mutations/submit-metadata.jsx +12 -11
- package/src/scripts/dataset/mutations/undo-deprecate-version.tsx +5 -6
- package/src/scripts/dataset/mutations/update-file.jsx +6 -6
- package/src/scripts/dataset/mutations/update-permissions.tsx +9 -9
- package/src/scripts/dataset/mutations/update-ref.jsx +7 -7
- package/src/scripts/dataset/routes/__tests__/deprecate-snapshot-page.spec.tsx +5 -5
- package/src/scripts/dataset/routes/add-metadata.jsx +19 -20
- package/src/scripts/dataset/routes/admin-datalad.jsx +7 -7
- package/src/scripts/dataset/routes/dataset-default.tsx +12 -10
- package/src/scripts/dataset/routes/delete-page.tsx +12 -12
- package/src/scripts/dataset/routes/deprecate-snapshot-page.tsx +8 -8
- package/src/scripts/dataset/routes/derivatives.tsx +10 -10
- package/src/scripts/dataset/routes/download-dataset.tsx +20 -20
- package/src/scripts/dataset/routes/manage-anonymous-reviewers.tsx +37 -35
- package/src/scripts/dataset/routes/manage-permissions.jsx +22 -22
- package/src/scripts/dataset/routes/publish.jsx +32 -30
- package/src/scripts/dataset/routes/snapshot-default.tsx +7 -7
- package/src/scripts/dataset/routes/snapshot.tsx +44 -43
- package/src/scripts/dataset/routes/styles/dataset-page-border.tsx +3 -3
- package/src/scripts/dataset/routes/styles/dataset-page-tab-container.tsx +3 -3
- package/src/scripts/dataset/routes/styles/header-row.tsx +3 -3
- package/src/scripts/dataset/routes/tab-routes-draft.tsx +12 -12
- package/src/scripts/dataset/routes/tab-routes-snapshot.tsx +8 -8
- package/src/scripts/dataset/snapshot-container.tsx +78 -86
- package/src/scripts/errors/403page.tsx +11 -11
- package/src/scripts/errors/404page.tsx +12 -12
- package/src/scripts/errors/errorBoundary.jsx +13 -12
- package/src/scripts/errors/errorRoute.jsx +6 -6
- package/src/scripts/errors/freshdesk-widget.jsx +17 -20
- package/src/scripts/errors/freshdeskInterface.jsx +9 -9
- package/src/scripts/errors/orcid/email.jsx +3 -3
- package/src/scripts/errors/orcid/family.jsx +4 -4
- package/src/scripts/errors/orcid/general.jsx +1 -1
- package/src/scripts/errors/orcid/given.jsx +4 -4
- package/src/scripts/fixtures/dataset-query.ts +119 -119
- package/src/scripts/fixtures/mock-app-wrapper.tsx +4 -4
- package/src/scripts/index.tsx +9 -9
- package/src/scripts/pages/admin/admin.jsx +5 -5
- package/src/scripts/pages/admin/flagged-files.jsx +33 -31
- package/src/scripts/pages/admin/user-fragment.ts +1 -1
- package/src/scripts/pages/admin/user-tools.tsx +13 -11
- package/src/scripts/pages/admin/users.jsx +38 -39
- package/src/scripts/pages/api.jsx +20 -19
- package/src/scripts/pages/citation-page.tsx +4 -4
- package/src/scripts/pages/faq/faq.tsx +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/aggregate-counts-container.tsx +6 -5
- package/src/scripts/pages/front-page/aggregate-queries/use-participant-count.ts +2 -2
- package/src/scripts/pages/front-page/aggregate-queries/use-publicDatasets-count.ts +2 -2
- package/src/scripts/pages/front-page/front-page-content.ts +42 -42
- package/src/scripts/pages/front-page/front-page.tsx +18 -14
- package/src/scripts/pages/front-page-comp.tsx +3 -3
- package/src/scripts/pages/import-dataset.tsx +10 -10
- package/src/scripts/pages/metadata/dataset-metadata.tsx +15 -14
- package/src/scripts/pages/pet-redirect.tsx +2 -2
- package/src/scripts/queries/dataset.ts +3 -3
- package/src/scripts/resources/__tests__/kibana.spec.js +9 -9
- package/src/scripts/resources/kibana.js +3 -3
- package/src/scripts/resources/strings.js +2 -2
- package/src/scripts/routes.tsx +14 -14
- package/src/scripts/search/__helpers__/search-render.tsx +3 -3
- package/src/scripts/search/__tests__/search-container.spec.tsx +22 -22
- package/src/scripts/search/__tests__/search-params-ctx.spec.tsx +20 -20
- package/src/scripts/search/es-query-builders.ts +21 -5
- package/src/scripts/search/filters-block-container.tsx +14 -16
- package/src/scripts/search/initial-search-params.tsx +45 -45
- package/src/scripts/search/inputs/__tests__/sort-by-select.spec.tsx +23 -23
- package/src/scripts/search/inputs/admin-allDatasets-toggle.tsx +12 -12
- package/src/scripts/search/inputs/age-range-input.tsx +9 -8
- package/src/scripts/search/inputs/author-input.tsx +14 -11
- package/src/scripts/search/inputs/date-radios.tsx +8 -7
- package/src/scripts/search/inputs/diagnosis-select.tsx +6 -6
- package/src/scripts/search/inputs/index.ts +33 -33
- package/src/scripts/search/inputs/keyword-input.tsx +13 -13
- package/src/scripts/search/inputs/modality-select.tsx +33 -30
- package/src/scripts/search/inputs/pet/bodyParts_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/scannerManufacturersModelNames_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/scannerManufacturers_input.tsx +18 -16
- package/src/scripts/search/inputs/pet/tracerNames_input.tsx +16 -15
- package/src/scripts/search/inputs/pet/tracerRadionuclides_input.tsx +18 -16
- package/src/scripts/search/inputs/section-select.tsx +6 -6
- package/src/scripts/search/inputs/sex-radios.tsx +6 -6
- package/src/scripts/search/inputs/show-datasets-radios.tsx +31 -29
- package/src/scripts/search/inputs/sort-by-select.tsx +10 -11
- package/src/scripts/search/inputs/species-select.tsx +6 -6
- package/src/scripts/search/inputs/study-domain-input.tsx +18 -16
- package/src/scripts/search/inputs/subject-count-range-input.tsx +8 -7
- package/src/scripts/search/inputs/task-input.tsx +18 -16
- package/src/scripts/search/search-container.tsx +83 -85
- package/src/scripts/search/search-params-ctx.tsx +40 -38
- package/src/scripts/search/search-routes.tsx +4 -4
- package/src/scripts/search/use-search-results.tsx +125 -99
- package/src/scripts/styles/media.tsx +3 -3
- package/src/scripts/styles/support-modal.jsx +2 -2
- package/src/scripts/sw.ts +12 -11
- package/src/scripts/test-utils.js +4 -4
- package/src/scripts/uploader/add-path-to-files.js +7 -7
- package/src/scripts/uploader/file-select.tsx +3 -3
- package/src/scripts/uploader/file-upload.js +13 -12
- package/src/scripts/uploader/input.jsx +8 -7
- package/src/scripts/uploader/upload-button.jsx +3 -3
- package/src/scripts/uploader/upload-disclaimer-input.tsx +66 -66
- package/src/scripts/uploader/upload-disclaimer.jsx +6 -5
- package/src/scripts/uploader/upload-file-status.jsx +4 -4
- package/src/scripts/uploader/upload-issues.jsx +32 -29
- package/src/scripts/uploader/upload-metadata.jsx +18 -17
- package/src/scripts/uploader/upload-mutation.js +17 -20
- package/src/scripts/uploader/upload-progress-button.jsx +5 -4
- package/src/scripts/uploader/upload-progress.jsx +3 -3
- package/src/scripts/uploader/upload-rename.jsx +6 -5
- package/src/scripts/uploader/upload-resume.jsx +26 -24
- package/src/scripts/uploader/upload-select.jsx +10 -9
- package/src/scripts/uploader/upload-status.jsx +5 -5
- package/src/scripts/uploader/upload-step.jsx +9 -9
- package/src/scripts/uploader/uploader-context.js +1 -1
- package/src/scripts/uploader/uploader-location.js +1 -1
- package/src/scripts/uploader/uploader-modal.jsx +8 -7
- package/src/scripts/uploader/uploader-setup-routes.jsx +10 -10
- package/src/scripts/uploader/uploader-status-routes.jsx +6 -6
- package/src/scripts/uploader/uploader-view.jsx +4 -4
- package/src/scripts/uploader/uploader.jsx +50 -48
- package/src/scripts/users/username.tsx +3 -3
- package/src/scripts/utils/__tests__/csv.spec.ts +16 -16
- package/src/scripts/utils/__tests__/date.spec.js +4 -4
- package/src/scripts/utils/__tests__/json-ld.spec.js +12 -12
- package/src/scripts/utils/__tests__/newid.spec.js +9 -9
- package/src/scripts/utils/__tests__/userNotify.spec.js +10 -10
- package/src/scripts/utils/analytics.tsx +3 -3
- package/src/scripts/utils/cookies.js +1 -1
- package/src/scripts/utils/csv.ts +13 -15
- package/src/scripts/utils/datalad.js +1 -1
- package/src/scripts/utils/dataset-url.js +2 -2
- package/src/scripts/utils/date.js +2 -2
- package/src/scripts/utils/global-polyfill.ts +2 -2
- package/src/scripts/utils/gtag.js +6 -6
- package/src/scripts/utils/json-ld.js +13 -13
- package/src/scripts/utils/newid.js +1 -1
- package/src/scripts/utils/user-login-modal-ctx.tsx +4 -4
- package/src/scripts/utils/userNotify.js +2 -2
- package/src/scripts/validation/validation-panel.jsx +3 -3
- package/src/scripts/validation/validation-results.issues.issue.jsx +9 -9
- package/src/scripts/validation/validation-results.issues.jsx +19 -17
- package/src/scripts/validation/validation-results.jsx +10 -10
- package/src/scripts/validation/validation-status.jsx +19 -17
- package/src/scripts/validation/validation.jsx +5 -5
- package/src/scripts/workers/schema.ts +2 -2
- package/src/scripts/workers/schema.worker.ts +4 -4
- package/src/scripts/workers/validate.ts +2 -2
- package/src/scripts/workers/validate.worker.ts +7 -5
- package/vite.config.js +17 -17
- package/src/dist/assets/activity-icon.9ab0c828.png +0 -0
- package/src/dist/assets/bids.da8810b3.jpg +0 -0
- package/src/dist/assets/brand_mark.28e7645d.png +0 -0
- package/src/dist/assets/close-button.21e700a6.png +0 -0
- package/src/dist/assets/cube-get.39ed5636.png +0 -0
- package/src/dist/assets/cube-share.9b558c29.png +0 -0
- package/src/dist/assets/cube-use.ccf2ddc5.png +0 -0
- package/src/dist/assets/datalad.a35b15b8.jpg +0 -0
- package/src/dist/assets/eeg.1dc1dc54.jpg +0 -0
- package/src/dist/assets/email-header.1cb8bf76.png +0 -0
- package/src/dist/assets/ieeg.f91deb0a.jpg +0 -0
- package/src/dist/assets/index.3db805fb.js +0 -23127
- package/src/dist/assets/index.3db805fb.js.map +0 -1
- package/src/dist/assets/index.5eb79d2c.css +0 -1
- package/src/dist/assets/ljaf.567e9566.png +0 -0
- package/src/dist/assets/logo_app.8c986cf9.png +0 -0
- package/src/dist/assets/logo_cube.5224b745.png +0 -0
- package/src/dist/assets/logo_data.3e1d5743.png +0 -0
- package/src/dist/assets/logo_users.a84a265a.png +0 -0
- package/src/dist/assets/meg.1e1928f8.jpg +0 -0
- package/src/dist/assets/mri.b01e4f42.jpg +0 -0
- package/src/dist/assets/nih-bi-logo.80d76e1d.png +0 -0
- package/src/dist/assets/nih-stanford.2a7c496e.jpg +0 -0
- package/src/dist/assets/nih.78a64d38.png +0 -0
- package/src/dist/assets/nimh.0ec775d8.png +0 -0
- package/src/dist/assets/nru-logo.f3097dc5.png +0 -0
- package/src/dist/assets/nsf.eee1d3f7.png +0 -0
- package/src/dist/assets/nsf.f87e96e7.png +0 -0
- package/src/dist/assets/on-dark-horz.e1f213d0.svg +0 -1
- package/src/dist/assets/on-dark.12f4e2ce.svg +0 -1
- package/src/dist/assets/on-light-horz.23ff22c3.svg +0 -1
- package/src/dist/assets/on-light.50592f7f.svg +0 -1
- package/src/dist/assets/pet-scan.21d98a3d.jpg +0 -0
- package/src/dist/assets/revicons.4ca02b8a.ttf +0 -0
- package/src/dist/assets/revicons.9e4d4c68.eot +0 -0
- package/src/dist/assets/revicons.f7b9c306.woff +0 -0
- package/src/dist/assets/sqm-logo.9cd0cca5.png +0 -0
- package/src/dist/assets/squishymedia.fa3c5919.png +0 -0
- package/src/dist/assets/stanford.5f245936.png +0 -0
- package/src/dist/index.html +0 -25
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { formatCitation } from
|
|
1
|
+
import { formatCitation } from "../dataset-citation.jsx"
|
|
2
2
|
|
|
3
3
|
const snapshot = {
|
|
4
|
-
id:
|
|
5
|
-
created:
|
|
4
|
+
id: "ds999999:1.0.2",
|
|
5
|
+
created: "2020-12-15T18:32:51.679Z",
|
|
6
6
|
description: {
|
|
7
|
-
Authors: [
|
|
8
|
-
Name:
|
|
9
|
-
DatasetDOI:
|
|
7
|
+
Authors: ["Jane Doe", "Doe, John"],
|
|
8
|
+
Name: "A Test Dataset",
|
|
9
|
+
DatasetDOI: "doinumbersgohere",
|
|
10
10
|
},
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
describe(
|
|
13
|
+
describe("formatCitation", () => {
|
|
14
14
|
it('should work with "Text" input', () => {
|
|
15
|
-
expect(formatCitation(snapshot,
|
|
16
|
-
|
|
15
|
+
expect(formatCitation(snapshot, "Text")).toEqual(
|
|
16
|
+
"Jane Doe and Doe, John (2020). A Test Dataset. OpenNeuro. [Dataset] doi: doinumbersgohere",
|
|
17
17
|
)
|
|
18
18
|
})
|
|
19
19
|
it('should work with "BibTeX" input', () => {
|
|
20
|
-
expect(formatCitation(snapshot,
|
|
20
|
+
expect(formatCitation(snapshot, "BibTeX")).toEqual(`@dataset{ds999999:1.0.2,
|
|
21
21
|
author = {Jane Doe and Doe, John},
|
|
22
22
|
title = {"A Test Dataset"},
|
|
23
23
|
year = {2020},
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render, screen } from
|
|
3
|
-
import { DOILink } from
|
|
4
|
-
import { MemoryRouter } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render, screen } from "@testing-library/react"
|
|
3
|
+
import { DOILink } from "../doi-link"
|
|
4
|
+
import { MemoryRouter } from "react-router-dom"
|
|
5
5
|
|
|
6
|
-
describe(
|
|
7
|
-
it(
|
|
6
|
+
describe("DoiLink component", () => {
|
|
7
|
+
it("Renders usable link with raw DOI value", () => {
|
|
8
8
|
render(
|
|
9
9
|
<DOILink DOI="10.18112/openneuro.ds000001.v1.0.0" datasetId="ds000001" />,
|
|
10
10
|
{
|
|
11
11
|
wrapper: MemoryRouter,
|
|
12
12
|
},
|
|
13
13
|
)
|
|
14
|
-
expect(screen.getByRole(
|
|
15
|
-
|
|
14
|
+
expect(screen.getByRole("link")).toHaveTextContent(
|
|
15
|
+
"doi:10.18112/openneuro.ds000001.v1.0.0",
|
|
16
16
|
)
|
|
17
|
-
expect(screen.getByRole(
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
expect(screen.getByRole("link")).toHaveAttribute(
|
|
18
|
+
"href",
|
|
19
|
+
"https://doi.org/10.18112/openneuro.ds000001.v1.0.0",
|
|
20
20
|
)
|
|
21
21
|
})
|
|
22
|
-
it(
|
|
22
|
+
it("Renders usable link with URI DOI value", () => {
|
|
23
23
|
render(
|
|
24
24
|
<DOILink
|
|
25
25
|
DOI="doi:10.18112/openneuro.ds000001.v1.0.0"
|
|
@@ -29,11 +29,11 @@ describe('DoiLink component', () => {
|
|
|
29
29
|
wrapper: MemoryRouter,
|
|
30
30
|
},
|
|
31
31
|
)
|
|
32
|
-
expect(screen.getByRole(
|
|
33
|
-
|
|
32
|
+
expect(screen.getByRole("link")).toHaveTextContent(
|
|
33
|
+
"doi:10.18112/openneuro.ds000001.v1.0.0",
|
|
34
34
|
)
|
|
35
35
|
})
|
|
36
|
-
it(
|
|
36
|
+
it("Renders usage link with URL DOI value", () => {
|
|
37
37
|
render(
|
|
38
38
|
<DOILink
|
|
39
39
|
DOI="https://doi.org/10.18112/openneuro.ds000001.v1.0.0"
|
|
@@ -41,32 +41,32 @@ describe('DoiLink component', () => {
|
|
|
41
41
|
/>,
|
|
42
42
|
{ wrapper: MemoryRouter },
|
|
43
43
|
)
|
|
44
|
-
expect(screen.getByRole(
|
|
45
|
-
|
|
44
|
+
expect(screen.getByRole("link")).toHaveTextContent(
|
|
45
|
+
"doi:10.18112/openneuro.ds000001.v1.0.0",
|
|
46
46
|
)
|
|
47
47
|
})
|
|
48
|
-
it(
|
|
48
|
+
it("Renders fallback link with invalid DOI value", () => {
|
|
49
49
|
render(<DOILink DOI="doi:x" datasetId="ds000001" />, {
|
|
50
50
|
wrapper: MemoryRouter,
|
|
51
51
|
})
|
|
52
|
-
expect(screen.getByRole(
|
|
53
|
-
|
|
52
|
+
expect(screen.getByRole("link")).toHaveTextContent(
|
|
53
|
+
"Create a new snapshot to obtain a DOI for the snapshot.",
|
|
54
54
|
)
|
|
55
|
-
expect(screen.getByRole(
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
expect(screen.getByRole("link")).toHaveAttribute(
|
|
56
|
+
"href",
|
|
57
|
+
"/datasets/ds000001/snapshot",
|
|
58
58
|
)
|
|
59
59
|
})
|
|
60
|
-
it(
|
|
60
|
+
it("Renders fallback text if no valid DOI string is found", () => {
|
|
61
61
|
render(<DOILink DOI={null} datasetId="ds000001" />, {
|
|
62
62
|
wrapper: MemoryRouter,
|
|
63
63
|
})
|
|
64
|
-
expect(screen.getByRole(
|
|
65
|
-
|
|
64
|
+
expect(screen.getByRole("link")).toHaveTextContent(
|
|
65
|
+
"Create a new snapshot to obtain a DOI for the snapshot.",
|
|
66
66
|
)
|
|
67
|
-
expect(screen.getByRole(
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
expect(screen.getByRole("link")).toHaveAttribute(
|
|
68
|
+
"href",
|
|
69
|
+
"/datasets/ds000001/snapshot",
|
|
70
70
|
)
|
|
71
71
|
})
|
|
72
72
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { EditButton } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import { EditButton } from "../edit-button"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("EditButton component", () => {
|
|
6
|
+
it("renders with default props", () => {
|
|
7
7
|
const { asFragment } = render(<EditButton action={() => {}} />)
|
|
8
8
|
expect(asFragment()).toMatchSnapshot()
|
|
9
9
|
})
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
import EditList from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react"
|
|
3
|
+
import EditList from "../edit-list.jsx"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("EditList component", () => {
|
|
6
|
+
it("renders with default props", () => {
|
|
7
7
|
const { asFragment } = render(<EditList />)
|
|
8
8
|
expect(asFragment()).toMatchSnapshot()
|
|
9
9
|
})
|
|
10
|
-
it(
|
|
11
|
-
const testText =
|
|
10
|
+
it("calls setElements when an item is added", () => {
|
|
11
|
+
const testText = "this is a test entry"
|
|
12
12
|
const setElements = vi.fn()
|
|
13
13
|
render(<EditList setElements={setElements} />)
|
|
14
|
-
fireEvent.change(screen.getByRole(
|
|
14
|
+
fireEvent.change(screen.getByRole("textbox"), {
|
|
15
15
|
target: { value: testText },
|
|
16
16
|
})
|
|
17
|
-
fireEvent.click(screen.getByLabelText(
|
|
17
|
+
fireEvent.click(screen.getByLabelText("Add"))
|
|
18
18
|
// Added an empty string to an empty list
|
|
19
19
|
expect(setElements).toHaveBeenCalledWith([testText])
|
|
20
20
|
})
|
|
21
|
-
it(
|
|
22
|
-
render(<EditList elements={[
|
|
23
|
-
expect(screen.getByText(
|
|
24
|
-
expect(screen.getByText(
|
|
21
|
+
it("renders any elements", () => {
|
|
22
|
+
render(<EditList elements={["One", "Two"]} />)
|
|
23
|
+
expect(screen.getByText("One")).toBeVisible()
|
|
24
|
+
expect(screen.getByText("Two")).toBeVisible()
|
|
25
25
|
})
|
|
26
26
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { SaveButton } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { render } from "@testing-library/react"
|
|
3
|
+
import { SaveButton } from "../save-button"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("SaveButton component", () => {
|
|
6
|
+
it("renders with default props", () => {
|
|
7
7
|
const { asFragment } = render(<SaveButton action={() => {}} />)
|
|
8
8
|
expect(asFragment()).toMatchSnapshot()
|
|
9
9
|
})
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
import SelectInput from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react"
|
|
3
|
+
import SelectInput from "../select-input"
|
|
4
4
|
|
|
5
|
-
describe(
|
|
6
|
-
it(
|
|
5
|
+
describe("SelectInput", () => {
|
|
6
|
+
it("handles display as disabled", () => {
|
|
7
7
|
const { asFragment } = render(
|
|
8
8
|
<SelectInput
|
|
9
9
|
{...{
|
|
10
|
-
name:
|
|
11
|
-
label:
|
|
12
|
-
value:
|
|
13
|
-
options: [{ value:
|
|
10
|
+
name: "Expected name",
|
|
11
|
+
label: "Expected label",
|
|
12
|
+
value: "hi",
|
|
13
|
+
options: [{ value: "hi" }, { value: "bye" }],
|
|
14
14
|
disabled: true,
|
|
15
15
|
annotated: true,
|
|
16
16
|
}}
|
|
@@ -18,14 +18,14 @@ describe('SelectInput', () => {
|
|
|
18
18
|
)
|
|
19
19
|
expect(asFragment()).toMatchSnapshot()
|
|
20
20
|
})
|
|
21
|
-
it(
|
|
21
|
+
it("handles display as not disabled", () => {
|
|
22
22
|
const { asFragment } = render(
|
|
23
23
|
<SelectInput
|
|
24
24
|
{...{
|
|
25
|
-
name:
|
|
26
|
-
label:
|
|
27
|
-
value:
|
|
28
|
-
options: [{ value:
|
|
25
|
+
name: "Expected name",
|
|
26
|
+
label: "Expected label",
|
|
27
|
+
value: "hi",
|
|
28
|
+
options: [{ value: "hi" }, { value: "bye" }],
|
|
29
29
|
disabled: false,
|
|
30
30
|
annotated: false,
|
|
31
31
|
}}
|
|
@@ -33,16 +33,16 @@ describe('SelectInput', () => {
|
|
|
33
33
|
)
|
|
34
34
|
expect(asFragment()).toMatchSnapshot()
|
|
35
35
|
})
|
|
36
|
-
it(
|
|
36
|
+
it("handles boolean display", () => {
|
|
37
37
|
const { asFragment } = render(
|
|
38
38
|
<SelectInput
|
|
39
39
|
{...{
|
|
40
|
-
name:
|
|
41
|
-
label:
|
|
40
|
+
name: "Expected name",
|
|
41
|
+
label: "Expected label",
|
|
42
42
|
value: true,
|
|
43
43
|
options: [
|
|
44
|
-
{ value: true, text:
|
|
45
|
-
{ value: false, text:
|
|
44
|
+
{ value: true, text: "true-label" },
|
|
45
|
+
{ value: false, text: "false-label" },
|
|
46
46
|
],
|
|
47
47
|
hasBooleanValues: true,
|
|
48
48
|
disabled: true,
|
|
@@ -52,18 +52,18 @@ describe('SelectInput', () => {
|
|
|
52
52
|
)
|
|
53
53
|
expect(asFragment()).toMatchSnapshot()
|
|
54
54
|
})
|
|
55
|
-
it(
|
|
55
|
+
it("handles boolean values", () => {
|
|
56
56
|
let _, value
|
|
57
57
|
const onChange = (...args) => ([_, value] = args)
|
|
58
58
|
render(
|
|
59
59
|
<SelectInput
|
|
60
60
|
{...{
|
|
61
|
-
name:
|
|
62
|
-
label:
|
|
61
|
+
name: "Expected name",
|
|
62
|
+
label: "Expected label",
|
|
63
63
|
value: true,
|
|
64
64
|
options: [
|
|
65
|
-
{ value: true, text:
|
|
66
|
-
{ value: false, text:
|
|
65
|
+
{ value: true, text: "true-label" },
|
|
66
|
+
{ value: false, text: "false-label" },
|
|
67
67
|
],
|
|
68
68
|
hasBooleanValues: true,
|
|
69
69
|
disabled: true,
|
|
@@ -76,9 +76,9 @@ describe('SelectInput', () => {
|
|
|
76
76
|
preventDefault() {
|
|
77
77
|
null
|
|
78
78
|
},
|
|
79
|
-
target: { value:
|
|
79
|
+
target: { value: "false" },
|
|
80
80
|
}
|
|
81
|
-
fireEvent.change(screen.getByRole(
|
|
81
|
+
fireEvent.change(screen.getByRole("combobox"), event)
|
|
82
82
|
expect(value).toBe(false)
|
|
83
83
|
})
|
|
84
84
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import styled from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import styled from "@emotion/styled"
|
|
4
4
|
|
|
5
5
|
export const TooltipSpan = styled.span`
|
|
6
6
|
&::before {
|
|
@@ -31,25 +31,25 @@ export const TooltipSpan = styled.span`
|
|
|
31
31
|
background-color: white;
|
|
32
32
|
}
|
|
33
33
|
`
|
|
34
|
-
const CopyButton = styled(
|
|
35
|
-
cursor:
|
|
34
|
+
const CopyButton = styled("i")({
|
|
35
|
+
cursor: "copy",
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
function fallbackCopyTextToClipboard(text) {
|
|
39
|
-
const textArea = document.createElement(
|
|
39
|
+
const textArea = document.createElement("textarea")
|
|
40
40
|
textArea.value = text
|
|
41
|
-
textArea.style.position =
|
|
41
|
+
textArea.style.position = "fixed"
|
|
42
42
|
document.body.appendChild(textArea)
|
|
43
43
|
textArea.focus()
|
|
44
44
|
textArea.select()
|
|
45
45
|
|
|
46
46
|
try {
|
|
47
|
-
const success = document.execCommand(
|
|
47
|
+
const success = document.execCommand("copy")
|
|
48
48
|
console.log(
|
|
49
|
-
`Copying text command was ${success ?
|
|
49
|
+
`Copying text command was ${success ? "successful!" : "unsuccessful."}`,
|
|
50
50
|
)
|
|
51
51
|
} catch (err) {
|
|
52
|
-
console.error(
|
|
52
|
+
console.error("Could not copy text: ", err)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
document.body.removeChild(textArea)
|
|
@@ -57,11 +57,12 @@ function fallbackCopyTextToClipboard(text) {
|
|
|
57
57
|
|
|
58
58
|
function copyTextToClipboard(text) {
|
|
59
59
|
if (!navigator.clipboard) fallbackCopyTextToClipboard(text)
|
|
60
|
-
else
|
|
60
|
+
else {
|
|
61
61
|
navigator.clipboard.writeText(text).then(
|
|
62
|
-
() => console.log(
|
|
63
|
-
err => console.error(
|
|
62
|
+
() => console.log("Copying to clipboard was successful!"),
|
|
63
|
+
(err) => console.error("Could not copy text: ", err),
|
|
64
64
|
)
|
|
65
|
+
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
const Tooltip = ({ text, tip }) => (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Link } from
|
|
3
|
-
import { DatasetAlert } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { Link } from "react-router-dom"
|
|
3
|
+
import { DatasetAlert } from "@openneuro/components/dataset"
|
|
4
4
|
|
|
5
5
|
export interface DatasetAlertDraftProps {
|
|
6
6
|
isPrivate: boolean
|
|
@@ -20,15 +20,15 @@ export const DatasetAlertDraft: React.FC<DatasetAlertDraftProps> = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<DatasetAlert
|
|
22
22
|
alert="This dataset has not been published!"
|
|
23
|
-
footer={
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
level="warning">
|
|
23
|
+
footer={hasDraftChanges &&
|
|
24
|
+
"* There have been changes to the draft since your last version"}
|
|
25
|
+
level="warning"
|
|
26
|
+
>
|
|
28
27
|
<>
|
|
29
28
|
<Link
|
|
30
29
|
className="dataset-tool"
|
|
31
|
-
to={
|
|
30
|
+
to={"/datasets/" + datasetId + "/publish"}
|
|
31
|
+
>
|
|
32
32
|
Publish this dataset
|
|
33
33
|
</Link>
|
|
34
34
|
  to make all versions available publicly.
|
|
@@ -39,11 +39,13 @@ export const DatasetAlertDraft: React.FC<DatasetAlertDraftProps> = ({
|
|
|
39
39
|
return (
|
|
40
40
|
<DatasetAlert
|
|
41
41
|
alert="This dataset has not been published!"
|
|
42
|
-
level="warning"
|
|
42
|
+
level="warning"
|
|
43
|
+
>
|
|
43
44
|
Before it can be published, please 
|
|
44
45
|
<Link
|
|
45
46
|
className="dataset-tool"
|
|
46
|
-
to={
|
|
47
|
+
to={"/datasets/" + datasetId + "/snapshot"}
|
|
48
|
+
>
|
|
47
49
|
create a version
|
|
48
50
|
</Link>
|
|
49
51
|
</DatasetAlert>
|
|
@@ -57,7 +59,8 @@ export const DatasetAlertDraft: React.FC<DatasetAlertDraftProps> = ({
|
|
|
57
59
|
become public when you 
|
|
58
60
|
<Link
|
|
59
61
|
className="dataset-tool"
|
|
60
|
-
to={
|
|
62
|
+
to={"/datasets/" + datasetId + "/snapshot"}
|
|
63
|
+
>
|
|
61
64
|
create a new version.
|
|
62
65
|
</Link>
|
|
63
66
|
</DatasetAlert>
|
|
@@ -68,7 +71,8 @@ export const DatasetAlertDraft: React.FC<DatasetAlertDraftProps> = ({
|
|
|
68
71
|
You can make changes to this Draft page, then 
|
|
69
72
|
<Link
|
|
70
73
|
className="dataset-tool"
|
|
71
|
-
to={
|
|
74
|
+
to={"/datasets/" + datasetId + "/snapshot"}
|
|
75
|
+
>
|
|
72
76
|
create a new version
|
|
73
77
|
</Link>
|
|
74
78
|
 to make them public.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DatasetAlert } from
|
|
3
|
-
import { UndoDeprecateVersion } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { DatasetAlert } from "@openneuro/components/dataset"
|
|
3
|
+
import { UndoDeprecateVersion } from "../mutations/undo-deprecate-version"
|
|
4
4
|
|
|
5
5
|
export interface DatasetAlertVersionProps {
|
|
6
6
|
datasetId: string
|
|
@@ -18,7 +18,8 @@ export const DatasetAlertVersion: React.FC<DatasetAlertVersionProps> = ({
|
|
|
18
18
|
<DatasetAlert
|
|
19
19
|
alert="This version has been deprecated!"
|
|
20
20
|
level="error"
|
|
21
|
-
footer={reason}
|
|
21
|
+
footer={reason}
|
|
22
|
+
>
|
|
22
23
|
{hasEdit && <UndoDeprecateVersion datasetId={datasetId} tag={tag} />}
|
|
23
24
|
</DatasetAlert>
|
|
24
25
|
)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import getYear from
|
|
4
|
-
import parseISO from
|
|
5
|
-
import { CopyToClipboard } from
|
|
6
|
-
import { Button } from
|
|
7
|
-
import { Tooltip } from
|
|
1
|
+
import React, { useState } from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import getYear from "date-fns/getYear"
|
|
4
|
+
import parseISO from "date-fns/parseISO"
|
|
5
|
+
import { CopyToClipboard } from "react-copy-to-clipboard"
|
|
6
|
+
import { Button } from "@openneuro/components/button"
|
|
7
|
+
import { Tooltip } from "@openneuro/components/tooltip"
|
|
8
8
|
|
|
9
9
|
export const formatCitation = (snapshot, style) => {
|
|
10
10
|
const year = getYear(parseISO(snapshot.created))
|
|
11
11
|
const authors = snapshot.description.Authors
|
|
12
|
-
? snapshot.description.Authors.join(
|
|
13
|
-
:
|
|
14
|
-
if (style ===
|
|
12
|
+
? snapshot.description.Authors.join(" and ")
|
|
13
|
+
: "NO AUTHORS FOUND"
|
|
14
|
+
if (style === "Text") {
|
|
15
15
|
return `${authors} (${year}). ${snapshot.description.Name}. OpenNeuro. [Dataset] doi: ${snapshot.description.DatasetDOI}`
|
|
16
|
-
} else if (style ===
|
|
16
|
+
} else if (style === "BibTeX") {
|
|
17
17
|
return `@dataset{${snapshot.id},
|
|
18
18
|
author = {${authors}},
|
|
19
19
|
title = {"${snapshot.description.Name}"},
|
|
@@ -25,7 +25,7 @@ export const formatCitation = (snapshot, style) => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const DatasetCitation = ({ snapshot }) => {
|
|
28
|
-
const [style, setStyle] = useState(
|
|
28
|
+
const [style, setStyle] = useState("Text")
|
|
29
29
|
const [copied, setCopied] = useState(false)
|
|
30
30
|
const copiedTimeout = () => {
|
|
31
31
|
setCopied(true)
|
|
@@ -43,10 +43,10 @@ const DatasetCitation = ({ snapshot }) => {
|
|
|
43
43
|
label="Text"
|
|
44
44
|
size="xsmall"
|
|
45
45
|
onClick={() => {
|
|
46
|
-
setStyle(
|
|
46
|
+
setStyle("Text")
|
|
47
47
|
setCopied(false)
|
|
48
48
|
}}
|
|
49
|
-
className={style ===
|
|
49
|
+
className={style === "Text" ? "active" : ""}
|
|
50
50
|
/>
|
|
51
51
|
|
|
52
52
|
<Button
|
|
@@ -54,27 +54,29 @@ const DatasetCitation = ({ snapshot }) => {
|
|
|
54
54
|
label="BibTeX"
|
|
55
55
|
size="xsmall"
|
|
56
56
|
onClick={() => {
|
|
57
|
-
setStyle(
|
|
57
|
+
setStyle("BibTeX")
|
|
58
58
|
setCopied(false)
|
|
59
59
|
}}
|
|
60
|
-
className={style ===
|
|
60
|
+
className={style === "BibTeX" ? "active" : ""}
|
|
61
61
|
/>
|
|
62
62
|
<Tooltip
|
|
63
|
-
tooltip={
|
|
64
|
-
className="tooltip"
|
|
63
|
+
tooltip={"Copy " + style + " to clipboard"}
|
|
64
|
+
className="tooltip"
|
|
65
|
+
>
|
|
65
66
|
<CopyToClipboard
|
|
66
67
|
text={citation}
|
|
67
68
|
onCopy={() => copiedTimeout()}
|
|
68
|
-
className="on-button on-button--small on-button--nobg "
|
|
69
|
+
className="on-button on-button--small on-button--nobg "
|
|
70
|
+
>
|
|
69
71
|
<span className="copy-key">
|
|
70
|
-
<i className="fa fa-link" aria-hidden="true" />{
|
|
72
|
+
<i className="fa fa-link" aria-hidden="true" />{" "}
|
|
71
73
|
{copied ? <span>Copied to clipboard</span> : <span>Copy</span>}
|
|
72
74
|
</span>
|
|
73
75
|
</CopyToClipboard>
|
|
74
76
|
</Tooltip>
|
|
75
77
|
</div>
|
|
76
78
|
<h5 className="cite-content-block">
|
|
77
|
-
{style ===
|
|
79
|
+
{style === "BibTeX" ? <pre>{citation}</pre> : citation}
|
|
78
80
|
</h5>
|
|
79
81
|
</div>
|
|
80
82
|
</>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import PropTypes from
|
|
3
|
-
import styled from
|
|
4
|
-
import { gql, useQuery } from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import PropTypes from "prop-types"
|
|
3
|
+
import styled from "@emotion/styled"
|
|
4
|
+
import { gql, useQuery } from "@apollo/client"
|
|
5
5
|
|
|
6
|
-
import Revalidate from
|
|
7
|
-
import UpdateRef from
|
|
6
|
+
import Revalidate from "../mutations/revalidate.jsx"
|
|
7
|
+
import UpdateRef from "../mutations/update-ref.jsx"
|
|
8
8
|
|
|
9
9
|
const GET_HISTORY = gql`
|
|
10
10
|
query getHistory($datasetId: ID!) {
|
|
@@ -42,7 +42,7 @@ const DatasetHistoryTable = styled.div`
|
|
|
42
42
|
const DatasetHistory = ({ datasetId }) => {
|
|
43
43
|
const { loading, data } = useQuery(GET_HISTORY, {
|
|
44
44
|
variables: { datasetId },
|
|
45
|
-
errorPolicy:
|
|
45
|
+
errorPolicy: "all",
|
|
46
46
|
})
|
|
47
47
|
if (loading) {
|
|
48
48
|
return <div className="dataset-history">Loading...</div>
|
|
@@ -59,23 +59,23 @@ const DatasetHistory = ({ datasetId }) => {
|
|
|
59
59
|
<h4 className="col-lg col col-2">References</h4>
|
|
60
60
|
<h4 className="col-lg col col-2 text--right">Action</h4>
|
|
61
61
|
</div>
|
|
62
|
-
{data.dataset.history.map(commit => (
|
|
62
|
+
{data.dataset.history.map((commit) => (
|
|
63
63
|
<React.Fragment key={commit.id}>
|
|
64
64
|
<div className="grid faux-table">
|
|
65
65
|
<div className="commit col-lg col col-2">
|
|
66
|
-
<label>Commit
|
|
66
|
+
<label>Commit:</label>
|
|
67
67
|
{commit.id.slice(0, 8)}
|
|
68
68
|
</div>
|
|
69
69
|
<div className="col-lg col col-3">
|
|
70
|
-
<label>Date
|
|
70
|
+
<label>Date:</label>
|
|
71
71
|
{commit.date}
|
|
72
72
|
</div>
|
|
73
73
|
<div className="col-lg col col-3">
|
|
74
|
-
<label>Author
|
|
74
|
+
<label>Author:</label>
|
|
75
75
|
{commit.authorName} <{commit.authorEmail}>
|
|
76
76
|
</div>
|
|
77
77
|
<div className="col-lg col col-2">
|
|
78
|
-
<label>References
|
|
78
|
+
<label>References:</label>
|
|
79
79
|
{commit.references}
|
|
80
80
|
</div>
|
|
81
81
|
<div className="col-lg col col-2 grid actions">
|