@openneuro/app 4.1.1 → 4.2.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/package.json +9 -18
- package/src/scripts/common/forms/warn-button.jsx +1 -1
- package/src/scripts/{redesign.tsx → index.tsx} +4 -4
- package/src/scripts/pages/citation-page.tsx +41 -0
- package/src/scripts/refactor_2021/admin/admin.jsx +1 -1
- package/src/scripts/refactor_2021/admin/flagged-files.jsx +2 -1
- package/src/scripts/refactor_2021/admin/user-tools.tsx +3 -5
- package/src/scripts/refactor_2021/admin/users.jsx +7 -10
- package/src/scripts/{authentication → refactor_2021/authentication}/__tests__/profile.spec.js +1 -1
- package/src/scripts/refactor_2021/containers/footer.tsx +1 -3
- package/src/scripts/{datalad/dataset → refactor_2021/dataset/comments}/__tests__/__snapshots__/comment.spec.jsx.snap +0 -8
- package/src/scripts/refactor_2021/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +129 -0
- package/src/scripts/{datalad/dataset → refactor_2021/dataset/comments}/__tests__/comment.spec.jsx +0 -0
- package/src/scripts/{datalad/dataset → refactor_2021/dataset/comments}/__tests__/comments.spec.jsx +0 -0
- package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +14 -4
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/__snapshots__/download-link.spec.jsx.snap +645 -105
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +6 -3
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/download-command-line.spec.jsx +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/download-link.spec.jsx +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/download-native.spec.js +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/download/__tests__/shell-example.spec.jsx +0 -0
- package/src/scripts/refactor_2021/dataset/download/download-datalad.jsx +45 -10
- package/src/scripts/refactor_2021/dataset/draft-container.tsx +20 -35
- package/src/scripts/refactor_2021/dataset/files/file-tree.jsx +3 -2
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +10 -0
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +10 -0
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-list.spec.jsx.snap +24 -0
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +10 -0
- package/src/scripts/{datalad/fragments/__tests__/__snapshots__/select-input.spec.jsx.snap → refactor_2021/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap} +0 -0
- package/src/scripts/{datalad/fragments/__tests__/cancel-button.spec.jsx → refactor_2021/dataset/fragments/__tests__/cancel-button.spec.tsx} +2 -2
- package/src/scripts/{datalad → refactor_2021/dataset}/fragments/__tests__/dataset-citation.spec.jsx +0 -0
- package/src/scripts/{datalad/fragments/__tests__/edit-button.spec.jsx → refactor_2021/dataset/fragments/__tests__/edit-button.spec.tsx} +2 -2
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-list.spec.jsx +27 -0
- package/src/scripts/{datalad/fragments/__tests__/save-button.spec.jsx → refactor_2021/dataset/fragments/__tests__/save-button.spec.tsx} +2 -2
- package/src/scripts/{datalad/fragments/__tests__/select-input.spec.jsx → refactor_2021/dataset/fragments/__tests__/select-input.spec.tsx} +0 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/delete.spec.jsx.snap +50 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/__snapshots__/description.spec.jsx.snap +0 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/update-permissions.spec.jsx.snap +27 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/cache-id.spec.js +0 -0
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/delete.spec.jsx +8 -8
- package/src/scripts/{datalad → refactor_2021/dataset}/mutations/__tests__/description.spec.jsx +0 -0
- package/src/scripts/{datalad/mutations/__tests__/remove-permissions.spec.jsx → refactor_2021/dataset/mutations/__tests__/remove-permissions.spec.tsx} +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/update-permissions.spec.jsx +28 -0
- package/src/scripts/refactor_2021/dataset/mutations/update-file.jsx +2 -2
- package/src/scripts/refactor_2021/dataset/routes/download-dataset.tsx +76 -0
- package/src/scripts/refactor_2021/dataset/snapshot-container.tsx +10 -4
- package/src/scripts/refactor_2021/routes.tsx +1 -1
- package/src/scripts/refactor_2021/search/__tests__/search-params-ctx.spec.tsx +20 -0
- package/src/scripts/refactor_2021/search/initial-search-params.tsx +7 -7
- package/src/scripts/refactor_2021/search/inputs/__tests__/sort-by-select.spec.tsx +83 -0
- package/src/scripts/refactor_2021/search/inputs/index.ts +2 -2
- package/src/scripts/refactor_2021/search/inputs/{gender-radios.tsx → sex-radios.tsx} +10 -10
- package/src/scripts/refactor_2021/search/inputs/sort-by-select.tsx +38 -8
- package/src/scripts/refactor_2021/search/search-container.tsx +3 -3
- package/src/scripts/refactor_2021/search/search-params-ctx.tsx +3 -3
- package/src/scripts/refactor_2021/search/use-search-results.tsx +4 -3
- package/src/scripts/refactor_2021/user/api.jsx +11 -6
- package/src/server.jsx +1 -5
- package/src/ssr.ts +0 -1
- package/src/sass/_bootstrap-compass.scss +0 -9
- package/src/sass/_bootstrap-mincer.scss +0 -19
- package/src/sass/_bootstrap-sprockets.scss +0 -9
- package/src/sass/_bootstrap.scss +0 -50
- package/src/sass/animate/_attention-seekers/_bounce.scss +0 -15
- package/src/sass/animate/_attention-seekers/_flash.scss +0 -14
- package/src/sass/animate/_attention-seekers/_pulse.scss +0 -17
- package/src/sass/animate/_attention-seekers/_rubberBand.scss +0 -19
- package/src/sass/animate/_attention-seekers/_shake.scss +0 -15
- package/src/sass/animate/_attention-seekers/_swing.scss +0 -19
- package/src/sass/animate/_attention-seekers/_tada.scss +0 -17
- package/src/sass/animate/_attention-seekers/_wobble.scss +0 -21
- package/src/sass/animate/_attention-seekers/attention-seekers.scss +0 -12
- package/src/sass/animate/_bouncing-entrances/_bounceIn.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInDown.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInLeft.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInRight.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/_bounceInUp.scss +0 -26
- package/src/sass/animate/_bouncing-entrances/bouncing-entrances.scss +0 -9
- package/src/sass/animate/_bouncing-exits/_bounceOut.scss +0 -26
- package/src/sass/animate/_bouncing-exits/_bounceOutDown.scss +0 -23
- package/src/sass/animate/_bouncing-exits/_bounceOutLeft.scss +0 -23
- package/src/sass/animate/_bouncing-exits/_bounceOutRight.scss +0 -23
- package/src/sass/animate/_bouncing-exits/_bounceOutUp.scss +0 -23
- package/src/sass/animate/_bouncing-exits/bouncing-exits.scss +0 -4
- package/src/sass/animate/_fading-entrances/_fadeIn.scss +0 -14
- package/src/sass/animate/_fading-entrances/_fadeInDown.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInDownBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInLeft.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInLeftBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInRight.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInRightBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/_fadeInUp.scss +0 -19
- package/src/sass/animate/_fading-entrances/_fadeInUpBig.scss +0 -20
- package/src/sass/animate/_fading-entrances/fading-entrances.scss +0 -5
- package/src/sass/animate/_fading-exits/_fadeOut.scss +0 -14
- package/src/sass/animate/_fading-exits/_fadeOutDown.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutDownBig.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutLeft.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutLeftBig.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutRight.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutRightBig.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutUp.scss +0 -20
- package/src/sass/animate/_fading-exits/_fadeOutUpBig.scss +0 -20
- package/src/sass/animate/_fading-exits/fading-exits.scss +0 -5
- package/src/sass/animate/_flippers/_flip.scss +0 -33
- package/src/sass/animate/_flippers/_flipInX.scss +0 -26
- package/src/sass/animate/_flippers/_flipInY.scss +0 -26
- package/src/sass/animate/_flippers/_flipOutX.scss +0 -20
- package/src/sass/animate/_flippers/_flipOutY.scss +0 -20
- package/src/sass/animate/_flippers/flippers.scss +0 -8
- package/src/sass/animate/_lightspeed/_lightSpeedIn.scss +0 -29
- package/src/sass/animate/_lightspeed/_lightSpeedOut.scss +0 -21
- package/src/sass/animate/_lightspeed/lightspeed.scss +0 -3
- package/src/sass/animate/_properties.scss +0 -119
- package/src/sass/animate/_rotating-entrances/_rotateIn.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInDownLeft.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInDownRight.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInUpLeft.scss +0 -22
- package/src/sass/animate/_rotating-entrances/_rotateInUpRight.scss +0 -22
- package/src/sass/animate/_rotating-entrances/rotating-entrances.scss +0 -8
- package/src/sass/animate/_rotating-exits/_rotateOut.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutDownLeft.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutDownRight.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutUpLeft.scss +0 -22
- package/src/sass/animate/_rotating-exits/_rotateOutUpRight.scss +0 -22
- package/src/sass/animate/_rotating-exits/rotating-exits.scss +0 -8
- package/src/sass/animate/_sliding-entrances/_slideInDown.scss +0 -19
- package/src/sass/animate/_sliding-entrances/_slideInLeft.scss +0 -19
- package/src/sass/animate/_sliding-entrances/_slideInRight.scss +0 -42
- package/src/sass/animate/_sliding-entrances/_slideInUp.scss +0 -19
- package/src/sass/animate/_sliding-entrances/sliding-entrances.scss +0 -7
- package/src/sass/animate/_sliding-exits/_slideOutDown.scss +0 -19
- package/src/sass/animate/_sliding-exits/_slideOutLeft.scss +0 -19
- package/src/sass/animate/_sliding-exits/_slideOutRight.scss +0 -19
- package/src/sass/animate/_sliding-exits/_slideOutUp.scss +0 -19
- package/src/sass/animate/_sliding-exits/sliding-exits.scss +0 -7
- package/src/sass/animate/_specials/_hinge.scss +0 -37
- package/src/sass/animate/_specials/_rollIn.scss +0 -20
- package/src/sass/animate/_specials/_rollOut.scss +0 -22
- package/src/sass/animate/_specials/specials.scss +0 -6
- package/src/sass/animate/_zooming-entrances/_zoomIn.scss +0 -19
- package/src/sass/animate/_zooming-entrances/_zoomInDown.scss +0 -22
- package/src/sass/animate/_zooming-entrances/_zoomInLeft.scss +0 -22
- package/src/sass/animate/_zooming-entrances/_zoomInRight.scss +0 -22
- package/src/sass/animate/_zooming-entrances/_zoomInUp.scss +0 -22
- package/src/sass/animate/_zooming-entrances/zooming-entrances.scss +0 -4
- package/src/sass/animate/_zooming-exits/_zoomOut.scss +0 -22
- package/src/sass/animate/_zooming-exits/_zoomOutDown.scss +0 -23
- package/src/sass/animate/_zooming-exits/_zoomOutLeft.scss +0 -21
- package/src/sass/animate/_zooming-exits/_zoomOutRight.scss +0 -21
- package/src/sass/animate/_zooming-exits/_zoomOutUp.scss +0 -23
- package/src/sass/animate/_zooming-exits/zooming-exits.scss +0 -4
- package/src/sass/animate/animate.css +0 -7497
- package/src/sass/animate/animate.css.map +0 -7
- package/src/sass/animate/animate.min.css +0 -2
- package/src/sass/animate/animate.min.css.map +0 -7
- package/src/sass/animate/animate.scss +0 -30
- package/src/sass/animate/bower.json +0 -22
- package/src/sass/bootstrap/_alerts.scss +0 -70
- package/src/sass/bootstrap/_badges.scss +0 -68
- package/src/sass/bootstrap/_breadcrumbs.scss +0 -26
- package/src/sass/bootstrap/_button-groups.scss +0 -243
- package/src/sass/bootstrap/_buttons.scss +0 -160
- package/src/sass/bootstrap/_carousel.scss +0 -269
- package/src/sass/bootstrap/_close.scss +0 -36
- package/src/sass/bootstrap/_code.scss +0 -69
- package/src/sass/bootstrap/_component-animations.scss +0 -37
- package/src/sass/bootstrap/_dropdowns.scss +0 -223
- package/src/sass/bootstrap/_forms.scss +0 -613
- package/src/sass/bootstrap/_grid.scss +0 -84
- package/src/sass/bootstrap/_input-groups.scss +0 -166
- package/src/sass/bootstrap/_jumbotron.scss +0 -50
- package/src/sass/bootstrap/_labels.scss +0 -66
- package/src/sass/bootstrap/_list-group.scss +0 -124
- package/src/sass/bootstrap/_media.scss +0 -61
- package/src/sass/bootstrap/_mixins.scss +0 -39
- package/src/sass/bootstrap/_modals.scss +0 -150
- package/src/sass/bootstrap/_navbar.scss +0 -647
- package/src/sass/bootstrap/_navs.scss +0 -243
- package/src/sass/bootstrap/_normalize.scss +0 -427
- package/src/sass/bootstrap/_pager.scss +0 -54
- package/src/sass/bootstrap/_pagination.scss +0 -88
- package/src/sass/bootstrap/_panels.scss +0 -265
- package/src/sass/bootstrap/_popovers.scss +0 -135
- package/src/sass/bootstrap/_print.scss +0 -107
- package/src/sass/bootstrap/_progress-bars.scss +0 -87
- package/src/sass/bootstrap/_responsive-embed.scss +0 -35
- package/src/sass/bootstrap/_responsive-utilities.scss +0 -177
- package/src/sass/bootstrap/_scaffolding.scss +0 -162
- package/src/sass/bootstrap/_tables.scss +0 -234
- package/src/sass/bootstrap/_theme.scss +0 -273
- package/src/sass/bootstrap/_thumbnails.scss +0 -38
- package/src/sass/bootstrap/_tooltip.scss +0 -102
- package/src/sass/bootstrap/_type.scss +0 -298
- package/src/sass/bootstrap/_utilities.scss +0 -55
- package/src/sass/bootstrap/_variables.scss +0 -866
- package/src/sass/bootstrap/_wells.scss +0 -29
- package/src/sass/bootstrap/float-label.scss +0 -70
- package/src/sass/bootstrap/mixins/_alerts.scss +0 -14
- package/src/sass/bootstrap/mixins/_background-variant.scss +0 -11
- package/src/sass/bootstrap/mixins/_border-radius.scss +0 -18
- package/src/sass/bootstrap/mixins/_buttons.scss +0 -52
- package/src/sass/bootstrap/mixins/_center-block.scss +0 -7
- package/src/sass/bootstrap/mixins/_clearfix.scss +0 -22
- package/src/sass/bootstrap/mixins/_forms.scss +0 -88
- package/src/sass/bootstrap/mixins/_gradients.scss +0 -58
- package/src/sass/bootstrap/mixins/_grid-framework.scss +0 -81
- package/src/sass/bootstrap/mixins/_grid.scss +0 -122
- package/src/sass/bootstrap/mixins/_hide-text.scss +0 -21
- package/src/sass/bootstrap/mixins/_image.scss +0 -33
- package/src/sass/bootstrap/mixins/_labels.scss +0 -12
- package/src/sass/bootstrap/mixins/_list-group.scss +0 -31
- package/src/sass/bootstrap/mixins/_nav-divider.scss +0 -10
- package/src/sass/bootstrap/mixins/_nav-vertical-align.scss +0 -9
- package/src/sass/bootstrap/mixins/_opacity.scss +0 -8
- package/src/sass/bootstrap/mixins/_pagination.scss +0 -23
- package/src/sass/bootstrap/mixins/_panels.scss +0 -24
- package/src/sass/bootstrap/mixins/_progress-bar.scss +0 -10
- package/src/sass/bootstrap/mixins/_reset-filter.scss +0 -8
- package/src/sass/bootstrap/mixins/_resize.scss +0 -6
- package/src/sass/bootstrap/mixins/_responsive-visibility.scss +0 -21
- package/src/sass/bootstrap/mixins/_size.scss +0 -10
- package/src/sass/bootstrap/mixins/_tab-focus.scss +0 -9
- package/src/sass/bootstrap/mixins/_table-row.scss +0 -28
- package/src/sass/bootstrap/mixins/_text-emphasis.scss +0 -11
- package/src/sass/bootstrap/mixins/_text-overflow.scss +0 -8
- package/src/sass/bootstrap/mixins/_vendor-prefixes.scss +0 -222
- package/src/sass/crn_app/_admin.admin.scss +0 -205
- package/src/sass/crn_app/_admin.graphs.scss +0 -51
- package/src/sass/crn_app/_admin.tools.scss +0 -24
- package/src/sass/crn_app/_api.scss +0 -65
- package/src/sass/crn_app/_bootstrap.overrides.scss +0 -54
- package/src/sass/crn_app/_colors.scss +0 -88
- package/src/sass/crn_app/_common.click-to-edit.scss +0 -187
- package/src/sass/crn_app/_common.modals.scss +0 -686
- package/src/sass/crn_app/_common.pagination.scss +0 -41
- package/src/sass/crn_app/_common.papaya.scss +0 -348
- package/src/sass/crn_app/_common.progress-bar.scss +0 -26
- package/src/sass/crn_app/_common.spinner.scss +0 -63
- package/src/sass/crn_app/_common.status.scss +0 -103
- package/src/sass/crn_app/_common.tooltip.scss +0 -22
- package/src/sass/crn_app/_common.typeahead.scss +0 -31
- package/src/sass/crn_app/_common.variables.scss +0 -16
- package/src/sass/crn_app/_dashboard.datasets.scss +0 -588
- package/src/sass/crn_app/_dataset.comments.scss +0 -201
- package/src/sass/crn_app/_dataset.dataset.scss +0 -161
- package/src/sass/crn_app/_dataset.file-tree.scss +0 -277
- package/src/sass/crn_app/_dataset.jobs.scss +0 -701
- package/src/sass/crn_app/_dataset.sidebar.scss +0 -265
- package/src/sass/crn_app/_dataset.tools.scss +0 -118
- package/src/sass/crn_app/_elements-wrappers.scss +0 -870
- package/src/sass/crn_app/_faq.scss +0 -37
- package/src/sass/crn_app/_frontPage.scss +0 -569
- package/src/sass/crn_app/_nav.navbar.scss +0 -387
- package/src/sass/crn_app/_theme.scss +0 -87
- package/src/sass/crn_app/_upload.upload.scss +0 -393
- package/src/sass/crn_app/_upload.validation.scss +0 -210
- package/src/sass/draft/draft.scss +0 -11
- package/src/sass/draft/rich-editor.scss +0 -73
- package/src/sass/font-awesome/_animated.scss +0 -34
- package/src/sass/font-awesome/_bordered-pulled.scss +0 -25
- package/src/sass/font-awesome/_core.scss +0 -12
- package/src/sass/font-awesome/_fixed-width.scss +0 -6
- package/src/sass/font-awesome/_font-awesome.scss +0 -17
- package/src/sass/font-awesome/_icons.scss +0 -697
- package/src/sass/font-awesome/_larger.scss +0 -13
- package/src/sass/font-awesome/_list.scss +0 -19
- package/src/sass/font-awesome/_mixins.scss +0 -26
- package/src/sass/font-awesome/_path.scss +0 -15
- package/src/sass/font-awesome/_rotated-flipped.scss +0 -20
- package/src/sass/font-awesome/_stacked.scss +0 -20
- package/src/sass/font-awesome/_variables.scss +0 -713
- package/src/sass/main.scss +0 -317
- package/src/sass/pre-refactor-with-wrapper-main.scss +0 -1549
- package/src/scripts/admin/__tests__/__snapshots__/exports.spec.jsx.snap +0 -112
- package/src/scripts/admin/__tests__/exports.spec.jsx +0 -15
- package/src/scripts/admin/__tests__/users.spec.jsx +0 -15
- package/src/scripts/admin/admin.jsx +0 -53
- package/src/scripts/admin/flagged-files.jsx +0 -178
- package/src/scripts/admin/user-fragment.ts +0 -14
- package/src/scripts/admin/user-tools.tsx +0 -83
- package/src/scripts/admin/users.jsx +0 -224
- package/src/scripts/authentication/admin-user.jsx +0 -23
- package/src/scripts/authentication/buttons.jsx +0 -26
- package/src/scripts/authentication/globus-button.jsx +0 -39
- package/src/scripts/authentication/google-button.jsx +0 -32
- package/src/scripts/authentication/logged-in.jsx +0 -12
- package/src/scripts/authentication/logged-out.jsx +0 -12
- package/src/scripts/authentication/loginCheck.js +0 -7
- package/src/scripts/authentication/orcid-button.jsx +0 -32
- package/src/scripts/authentication/withProfile.jsx +0 -22
- package/src/scripts/classic.tsx +0 -18
- package/src/scripts/common/forms/file-select.tsx +0 -71
- package/src/scripts/common/partials/__tests__/__snapshots__/footer.spec.jsx.snap +0 -42
- package/src/scripts/common/partials/__tests__/__snapshots__/metric.spec.jsx.snap +0 -101
- package/src/scripts/common/partials/__tests__/footer.spec.jsx +0 -10
- package/src/scripts/common/partials/__tests__/metric.spec.jsx +0 -31
- package/src/scripts/common/partials/footer.jsx +0 -40
- package/src/scripts/common/partials/login.jsx +0 -99
- package/src/scripts/common/partials/metric.jsx +0 -73
- package/src/scripts/common/partials/spinner.jsx +0 -34
- package/src/scripts/common/partials/status.jsx +0 -96
- package/src/scripts/common/partials/timeout.jsx +0 -47
- package/src/scripts/common/partials/tooltip.jsx +0 -36
- package/src/scripts/components/__tests__/dropdown-button.spec.tsx +0 -49
- package/src/scripts/components/dropdown-button.tsx +0 -42
- package/src/scripts/components/feature-toggle.tsx +0 -19
- package/src/scripts/components/panel-group.tsx +0 -24
- package/src/scripts/components/panel.tsx +0 -42
- package/src/scripts/datalad/__tests__/snapshotVersion.spec.js +0 -21
- package/src/scripts/datalad/comments/__tests__/comment-editor.spec.jsx +0 -19
- package/src/scripts/datalad/comments/block-style-controls.jsx +0 -46
- package/src/scripts/datalad/comments/comment-editor.jsx +0 -79
- package/src/scripts/datalad/comments/inline-style-controls.jsx +0 -34
- package/src/scripts/datalad/comments/style-button.jsx +0 -28
- package/src/scripts/datalad/dashboard/__tests__/__snapshots__/dashboard.spec.jsx.snap +0 -163
- package/src/scripts/datalad/dashboard/__tests__/dashboard.spec.jsx +0 -21
- package/src/scripts/datalad/dashboard/dashboard.jsx +0 -54
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-filter.spec.jsx.snap +0 -20
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-row-skeleton.spec.jsx.snap +0 -13
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-row.spec.jsx.snap +0 -65
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-sorter.spec.jsx.snap +0 -14
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/dataset-virtual-scroller.spec.jsx.snap +0 -17
- package/src/scripts/datalad/dashboard/datasets/__tests__/__snapshots__/uploaded.spec.jsx.snap +0 -27
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-filter.spec.jsx +0 -67
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-query.spec.jsx +0 -72
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-row-skeleton.spec.jsx +0 -9
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-row.spec.jsx +0 -53
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-sorter.spec.jsx +0 -69
- package/src/scripts/datalad/dashboard/datasets/__tests__/dataset-virtual-scroller.spec.jsx +0 -65
- package/src/scripts/datalad/dashboard/datasets/__tests__/uploaded.spec.jsx +0 -17
- package/src/scripts/datalad/dashboard/datasets/dataset-filter.jsx +0 -78
- package/src/scripts/datalad/dashboard/datasets/dataset-query.jsx +0 -102
- package/src/scripts/datalad/dashboard/datasets/dataset-row-error-boundary.jsx +0 -52
- package/src/scripts/datalad/dashboard/datasets/dataset-row-skeleton.jsx +0 -10
- package/src/scripts/datalad/dashboard/datasets/dataset-row.jsx +0 -58
- package/src/scripts/datalad/dashboard/datasets/dataset-sorter.jsx +0 -148
- package/src/scripts/datalad/dashboard/datasets/dataset-statuses.jsx +0 -44
- package/src/scripts/datalad/dashboard/datasets/dataset-tab.jsx +0 -192
- package/src/scripts/datalad/dashboard/datasets/dataset-virtual-scroller.jsx +0 -126
- package/src/scripts/datalad/dashboard/datasets/row-height.jsx +0 -7
- package/src/scripts/datalad/dashboard/datasets/uploaded.jsx +0 -33
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/comments.spec.jsx.snap +0 -137
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/dataset-page.spec.jsx.snap +0 -69
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/dataset-query.spec.jsx.snap +0 -15
- package/src/scripts/datalad/dataset/__tests__/__snapshots__/left-siderbar.spec.jsx.snap +0 -85
- package/src/scripts/datalad/dataset/__tests__/dataset-page.spec.jsx +0 -33
- package/src/scripts/datalad/dataset/__tests__/dataset-query.spec.jsx +0 -20
- package/src/scripts/datalad/dataset/__tests__/left-siderbar.spec.jsx +0 -106
- package/src/scripts/datalad/dataset/comment.jsx +0 -90
- package/src/scripts/datalad/dataset/comments.jsx +0 -83
- package/src/scripts/datalad/dataset/dataset-description.jsx +0 -111
- package/src/scripts/datalad/dataset/dataset-main.jsx +0 -29
- package/src/scripts/datalad/dataset/dataset-page.jsx +0 -63
- package/src/scripts/datalad/dataset/dataset-query.jsx +0 -192
- package/src/scripts/datalad/dataset/dataset.jsx +0 -22
- package/src/scripts/datalad/dataset/delete-page.tsx +0 -92
- package/src/scripts/datalad/dataset/left-sidebar.jsx +0 -109
- package/src/scripts/datalad/download/__tests__/__snapshots__/download-dataset.spec.jsx.snap +0 -7
- package/src/scripts/datalad/download/__tests__/__snapshots__/download-tool.spec.jsx.snap +0 -26
- package/src/scripts/datalad/download/__tests__/download-dataset.spec.jsx +0 -19
- package/src/scripts/datalad/download/__tests__/download-tool.spec.jsx +0 -19
- package/src/scripts/datalad/download/download-command-line.jsx +0 -43
- package/src/scripts/datalad/download/download-datalad.jsx +0 -58
- package/src/scripts/datalad/download/download-dataset.jsx +0 -61
- package/src/scripts/datalad/download/download-link.jsx +0 -41
- package/src/scripts/datalad/download/download-native.js +0 -118
- package/src/scripts/datalad/download/download-query.js +0 -22
- package/src/scripts/datalad/download/download-s3.jsx +0 -46
- package/src/scripts/datalad/download/download-tool.jsx +0 -44
- package/src/scripts/datalad/download/native-file-toast.jsx +0 -90
- package/src/scripts/datalad/download/shell-example.jsx +0 -9
- package/src/scripts/datalad/download/track-download.js +0 -15
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/cancel-button.spec.jsx.snap +0 -21
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-analytics.spec.jsx.snap +0 -41
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-authors.spec.jsx.snap +0 -13
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-readme.spec.jsx.snap +0 -49
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-title.spec.jsx.snap +0 -7
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-tools.spec.jsx.snap +0 -346
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/dataset-uploaded.spec.jsx.snap +0 -7
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/edit-button.spec.jsx.snap +0 -21
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/edit-list.spec.jsx.snap +0 -34
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/edit-readme.spec.jsx.snap +0 -3
- package/src/scripts/datalad/fragments/__tests__/__snapshots__/save-button.spec.jsx.snap +0 -21
- package/src/scripts/datalad/fragments/__tests__/dataset-analytics.spec.jsx +0 -16
- package/src/scripts/datalad/fragments/__tests__/dataset-authors.spec.jsx +0 -22
- package/src/scripts/datalad/fragments/__tests__/dataset-prominent-links.spec.jsx +0 -32
- package/src/scripts/datalad/fragments/__tests__/dataset-readme.spec.jsx +0 -10
- package/src/scripts/datalad/fragments/__tests__/dataset-summary.spec.jsx +0 -55
- package/src/scripts/datalad/fragments/__tests__/dataset-title.spec.jsx +0 -10
- package/src/scripts/datalad/fragments/__tests__/dataset-tools.spec.jsx +0 -55
- package/src/scripts/datalad/fragments/__tests__/dataset-uploaded.spec.jsx +0 -16
- package/src/scripts/datalad/fragments/__tests__/edit-list.spec.jsx +0 -25
- package/src/scripts/datalad/fragments/__tests__/edit-readme.spec.jsx +0 -10
- package/src/scripts/datalad/fragments/cancel-button.jsx +0 -24
- package/src/scripts/datalad/fragments/copyable-tooltip.jsx +0 -82
- package/src/scripts/datalad/fragments/dataset-analytics.jsx +0 -27
- package/src/scripts/datalad/fragments/dataset-authors.jsx +0 -16
- package/src/scripts/datalad/fragments/dataset-citation.jsx +0 -77
- package/src/scripts/datalad/fragments/dataset-files.jsx +0 -50
- package/src/scripts/datalad/fragments/dataset-git-access.jsx +0 -56
- package/src/scripts/datalad/fragments/dataset-git-hash.jsx +0 -27
- package/src/scripts/datalad/fragments/dataset-history.jsx +0 -95
- package/src/scripts/datalad/fragments/dataset-modified.jsx +0 -17
- package/src/scripts/datalad/fragments/dataset-prominent-links.jsx +0 -129
- package/src/scripts/datalad/fragments/dataset-readme.jsx +0 -42
- package/src/scripts/datalad/fragments/dataset-summary.jsx +0 -230
- package/src/scripts/datalad/fragments/dataset-title.jsx +0 -10
- package/src/scripts/datalad/fragments/dataset-tools.jsx +0 -190
- package/src/scripts/datalad/fragments/dataset-uploaded.jsx +0 -25
- package/src/scripts/datalad/fragments/edit-button.jsx +0 -24
- package/src/scripts/datalad/fragments/edit-description-field.jsx +0 -54
- package/src/scripts/datalad/fragments/edit-description-list.jsx +0 -49
- package/src/scripts/datalad/fragments/edit-list.jsx +0 -82
- package/src/scripts/datalad/fragments/edit-readme.jsx +0 -44
- package/src/scripts/datalad/fragments/incomplete-dataset.jsx +0 -23
- package/src/scripts/datalad/fragments/metadata-tool.jsx +0 -34
- package/src/scripts/datalad/fragments/number-input.tsx +0 -126
- package/src/scripts/datalad/fragments/save-button.jsx +0 -24
- package/src/scripts/datalad/fragments/select-input.tsx +0 -247
- package/src/scripts/datalad/fragments/share-dataset-button.jsx +0 -32
- package/src/scripts/datalad/fragments/text-array-input.tsx +0 -119
- package/src/scripts/datalad/fragments/text-input.tsx +0 -206
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/comment.spec.jsx.snap +0 -5
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/delete.spec.jsx.snap +0 -181
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/manage-permissions.spec.jsx.snap +0 -361
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/subscribe-to-newsletter.spec.jsx.snap +0 -83
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/update-file.spec.jsx.snap +0 -25
- package/src/scripts/datalad/mutations/__tests__/__snapshots__/update-permissions.spec.jsx.snap +0 -361
- package/src/scripts/datalad/mutations/__tests__/comment.spec.jsx +0 -154
- package/src/scripts/datalad/mutations/__tests__/manage-permissions.spec.jsx +0 -21
- package/src/scripts/datalad/mutations/__tests__/subscribe-to-newsletter.spec.jsx +0 -10
- package/src/scripts/datalad/mutations/__tests__/update-file.spec.jsx +0 -15
- package/src/scripts/datalad/mutations/__tests__/update-permissions.spec.jsx +0 -21
- package/src/scripts/datalad/mutations/add-metadata.jsx +0 -164
- package/src/scripts/datalad/mutations/comment.jsx +0 -164
- package/src/scripts/datalad/mutations/delete-dataset-form.jsx +0 -82
- package/src/scripts/datalad/mutations/description.jsx +0 -129
- package/src/scripts/datalad/mutations/flag-annex-object.jsx +0 -62
- package/src/scripts/datalad/mutations/metadata-form.jsx +0 -388
- package/src/scripts/datalad/mutations/readme.jsx +0 -53
- package/src/scripts/datalad/mutations/remove-annex-object.jsx +0 -71
- package/src/scripts/datalad/mutations/subscribe-to-newsletter.jsx +0 -26
- package/src/scripts/datalad/mutations/update-file.jsx +0 -51
- package/src/scripts/datalad/routes/__tests__/__snapshots__/manage-permissions.spec.jsx.snap +0 -159
- package/src/scripts/datalad/routes/__tests__/__snapshots__/snapshot.spec.jsx.snap +0 -31
- package/src/scripts/datalad/routes/__tests__/dataset-content.spec.jsx +0 -108
- package/src/scripts/datalad/routes/__tests__/file-display.spec.jsx +0 -22
- package/src/scripts/datalad/routes/__tests__/manage-permissions.spec.jsx +0 -101
- package/src/scripts/datalad/routes/__tests__/snapshot.spec.jsx +0 -49
- package/src/scripts/datalad/routes/admin-datalad.jsx +0 -45
- package/src/scripts/datalad/routes/admin-exports.jsx +0 -125
- package/src/scripts/datalad/routes/dataset-content.jsx +0 -198
- package/src/scripts/datalad/routes/dataset-routes.jsx +0 -162
- package/src/scripts/datalad/routes/file-display.jsx +0 -84
- package/src/scripts/datalad/routes/manage-permissions.jsx +0 -128
- package/src/scripts/datalad/routes/snapshot-content.jsx +0 -135
- package/src/scripts/datalad/routes/snapshot.jsx +0 -131
- package/src/scripts/datalad/snapshotVersion.js +0 -7
- package/src/scripts/datalad/validation/validation-panel.jsx +0 -48
- package/src/scripts/datalad/validation/validation-status.jsx +0 -120
- package/src/scripts/datalad/validation/validation.jsx +0 -40
- package/src/scripts/dataset/dataset.metrics.jsx +0 -61
- package/src/scripts/file-tree/__tests__/__snapshots__/file-tree-unloaded-directory.spec.jsx.snap +0 -26
- package/src/scripts/file-tree/__tests__/__snapshots__/file-tree.spec.jsx.snap +0 -18
- package/src/scripts/file-tree/__tests__/__snapshots__/file.spec.jsx.snap +0 -81
- package/src/scripts/file-tree/__tests__/file-tree-loading.spec.jsx +0 -18
- package/src/scripts/file-tree/__tests__/file-tree-unloaded-directory.spec.jsx +0 -74
- package/src/scripts/file-tree/__tests__/file-tree.spec.jsx +0 -94
- package/src/scripts/file-tree/__tests__/file-viewer-type.spec.jsx +0 -15
- package/src/scripts/file-tree/__tests__/file.spec.jsx +0 -44
- package/src/scripts/file-tree/__tests__/flat-to-tree.spec.js +0 -55
- package/src/scripts/file-tree/file-tree-loading.jsx +0 -64
- package/src/scripts/file-tree/file-tree-unloaded-directory.jsx +0 -108
- package/src/scripts/file-tree/file-tree.jsx +0 -133
- package/src/scripts/file-tree/file-view.jsx +0 -31
- package/src/scripts/file-tree/file-viewer-type.jsx +0 -45
- package/src/scripts/file-tree/file.jsx +0 -123
- package/src/scripts/file-tree/files.jsx +0 -126
- package/src/scripts/file-tree/flat-to-tree.js +0 -49
- package/src/scripts/file-tree/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +0 -51
- package/src/scripts/file-tree/viewers/__tests__/file-viewer-json.spec.jsx +0 -15
- package/src/scripts/file-tree/viewers/__tests__/parse-tabular.spec.js +0 -24
- package/src/scripts/file-tree/viewers/file-viewer-csv.jsx +0 -16
- package/src/scripts/file-tree/viewers/file-viewer-html.jsx +0 -20
- package/src/scripts/file-tree/viewers/file-viewer-json.jsx +0 -50
- package/src/scripts/file-tree/viewers/file-viewer-nifti.jsx +0 -11
- package/src/scripts/file-tree/viewers/file-viewer-table.jsx +0 -34
- package/src/scripts/file-tree/viewers/file-viewer-text.jsx +0 -13
- package/src/scripts/file-tree/viewers/file-viewer-tsv.jsx +0 -16
- package/src/scripts/file-tree/viewers/parse-tabular.js +0 -18
- package/src/scripts/front-page/__tests__/__snapshots__/email-subscription-box.spec.jsx.snap +0 -190
- package/src/scripts/front-page/__tests__/__snapshots__/front-page-stats.spec.jsx.snap +0 -29
- package/src/scripts/front-page/__tests__/__snapshots__/front-page-top-datasets.spec.jsx.snap +0 -464
- package/src/scripts/front-page/__tests__/dataset-count.spec.jsx +0 -33
- package/src/scripts/front-page/__tests__/email-subscription-box.spec.jsx +0 -57
- package/src/scripts/front-page/__tests__/front-page-stats.spec.jsx +0 -10
- package/src/scripts/front-page/__tests__/front-page-top-datasets.spec.jsx +0 -27
- package/src/scripts/front-page/__tests__/participant-count.spec.jsx +0 -31
- package/src/scripts/front-page/dataset-count.jsx +0 -29
- package/src/scripts/front-page/email-subscription-box.jsx +0 -131
- package/src/scripts/front-page/front-page-additional-info.jsx +0 -15
- package/src/scripts/front-page/front-page-collaborators.jsx +0 -117
- package/src/scripts/front-page/front-page-stats.jsx +0 -71
- package/src/scripts/front-page/front-page-support.jsx +0 -30
- package/src/scripts/front-page/front-page-tabs.jsx +0 -166
- package/src/scripts/front-page/front-page-top-datasets.jsx +0 -203
- package/src/scripts/front-page/front-page.jsx +0 -95
- package/src/scripts/front-page/participant-count.jsx +0 -25
- package/src/scripts/hooks/use-measure.js +0 -15
- package/src/scripts/hooks/use-previous.js +0 -7
- package/src/scripts/index.jsx +0 -16
- package/src/scripts/nav/assets/brand_mark.png +0 -0
- package/src/scripts/nav/assets/favicon-upload.png +0 -0
- package/src/scripts/nav/assets/logo_app.png +0 -0
- package/src/scripts/nav/navbar.jsx +0 -144
- package/src/scripts/nav/navbar.navmenu.jsx +0 -106
- package/src/scripts/nav/navbar.usermenu.jsx +0 -52
- package/src/scripts/pages/citation-page.jsx +0 -43
- package/src/scripts/pet/__tests__/__snapshots__/dummy.spec.jsx.snap +0 -70
- package/src/scripts/pet/__tests__/dummy.spec.jsx +0 -10
- package/src/scripts/pet/dummy.jsx +0 -61
- package/src/scripts/refactor_2021/dataset/dataset-pre-refactor-container.tsx +0 -12
- package/src/scripts/refactor_2021/dataset/routes/download-dataset.jsx +0 -70
- package/src/scripts/refactor_2021/redesign-form.jsx +0 -427
- package/src/scripts/routes.tsx +0 -36
- package/src/scripts/search/search-input.tsx +0 -42
- package/src/scripts/search/search-results.tsx +0 -114
- package/src/scripts/styles/capitalized.jsx +0 -6
- package/src/scripts/styles/uppercase.jsx +0 -6
- package/src/scripts/uploader/__tests__/add-path-to-files.spec.js +0 -29
- package/src/scripts/uploader/__tests__/file-upload.spec.js +0 -116
- package/src/scripts/uploader/__tests__/upload-disclaimer.spec.jsx +0 -67
- package/src/scripts/uploader/__tests__/upload-mutation.spec.js +0 -57
- package/src/scripts/uploader/__tests__/uploader.spec.js +0 -31
- package/src/scripts/uploader/add-path-to-files.js +0 -19
- package/src/scripts/uploader/file-upload.js +0 -88
- package/src/scripts/uploader/upload-button.jsx +0 -18
- package/src/scripts/uploader/upload-disclaimer.jsx +0 -92
- package/src/scripts/uploader/upload-file-status.jsx +0 -20
- package/src/scripts/uploader/upload-issues.jsx +0 -131
- package/src/scripts/uploader/upload-metadata.jsx +0 -59
- package/src/scripts/uploader/upload-mutation.js +0 -111
- package/src/scripts/uploader/upload-progress-button.jsx +0 -20
- package/src/scripts/uploader/upload-progress-class.js +0 -36
- package/src/scripts/uploader/upload-progress.jsx +0 -15
- package/src/scripts/uploader/upload-rename.jsx +0 -33
- package/src/scripts/uploader/upload-resume.jsx +0 -35
- package/src/scripts/uploader/upload-select.jsx +0 -29
- package/src/scripts/uploader/upload-status.jsx +0 -23
- package/src/scripts/uploader/upload-step.jsx +0 -48
- package/src/scripts/uploader/uploader-context.js +0 -6
- package/src/scripts/uploader/uploader-location.js +0 -5
- package/src/scripts/uploader/uploader-modal.jsx +0 -27
- package/src/scripts/uploader/uploader-setup-routes.jsx +0 -52
- package/src/scripts/uploader/uploader-status-routes.jsx +0 -30
- package/src/scripts/uploader/uploader-view.jsx +0 -45
- package/src/scripts/uploader/uploader.jsx +0 -388
- package/src/scripts/user/__mocks__/user.store.js +0 -1
- package/src/scripts/user/api.jsx +0 -132
- package/src/scripts/user/avatar.jsx +0 -40
- package/src/scripts/utils/crn.js +0 -15
- package/src/scripts/utils/request.js +0 -107
- package/src/scripts/utils/user.js +0 -18
- package/src/scripts/validation/validation-results.issues.issue.jsx +0 -90
- package/src/scripts/validation/validation-results.issues.jsx +0 -79
- package/src/scripts/validation/validation-results.jsx +0 -96
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// dependencies --------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import PropTypes from 'prop-types'
|
|
5
|
-
import Tooltip from './tooltip.jsx'
|
|
6
|
-
|
|
7
|
-
// component setup -----------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
class Metric extends React.PureComponent {
|
|
10
|
-
// lifecycle events ----------------------------------------------------------
|
|
11
|
-
render() {
|
|
12
|
-
if (!this.props.display) {
|
|
13
|
-
return false
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let spanClass, tip, iconClass
|
|
17
|
-
const value = this.props.value ? this.props.value : 0
|
|
18
|
-
const noun = this.props.snapshot ? 'snapshot' : 'dataset'
|
|
19
|
-
|
|
20
|
-
switch (this.props.type) {
|
|
21
|
-
case 'stars':
|
|
22
|
-
spanClass = 'dataset-status ds-primary'
|
|
23
|
-
iconClass = 'fa fa-star'
|
|
24
|
-
tip = `This ${noun} has ${value} likes.`
|
|
25
|
-
break
|
|
26
|
-
case 'downloads':
|
|
27
|
-
spanClass = 'dataset-status ds-primary'
|
|
28
|
-
iconClass = 'fa fa-download'
|
|
29
|
-
tip = `This ${noun} has ${value} downloads.`
|
|
30
|
-
break
|
|
31
|
-
case 'followers':
|
|
32
|
-
spanClass = 'dataset-status ds-primary'
|
|
33
|
-
iconClass = 'fa fa-users'
|
|
34
|
-
tip = `This ${noun} has ${value} followers.`
|
|
35
|
-
break
|
|
36
|
-
case 'views':
|
|
37
|
-
spanClass = 'dataset-status ds-primary'
|
|
38
|
-
iconClass = 'fa fa-eye'
|
|
39
|
-
tip = `This ${noun} has ${value} views.`
|
|
40
|
-
break
|
|
41
|
-
default:
|
|
42
|
-
throw new Error('Invalid type provided')
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
let content = (
|
|
46
|
-
<span className="icon-wrap">
|
|
47
|
-
<i className={iconClass} />
|
|
48
|
-
{value}
|
|
49
|
-
</span>
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
if (tip) {
|
|
53
|
-
content = <Tooltip tooltip={tip}>{content}</Tooltip>
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<span className="metric">
|
|
58
|
-
<span>
|
|
59
|
-
<span className={spanClass}>{content}</span>
|
|
60
|
-
</span>
|
|
61
|
-
</span>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
Metric.propTypes = {
|
|
67
|
-
type: PropTypes.string,
|
|
68
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
69
|
-
display: PropTypes.bool,
|
|
70
|
-
snapshot: PropTypes.bool,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default Metric
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// dependencies ------------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import PropTypes from 'prop-types'
|
|
5
|
-
|
|
6
|
-
// component setup ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
class Spinner extends React.Component {
|
|
9
|
-
// life cycle events -------------------------------------------------------------------------
|
|
10
|
-
|
|
11
|
-
render() {
|
|
12
|
-
const spinner = (
|
|
13
|
-
<div className="loading-wrap fade-in">
|
|
14
|
-
<div className="spinner">
|
|
15
|
-
<div className="spinnerinner" />
|
|
16
|
-
</div>
|
|
17
|
-
<span>{this.props.text}</span>
|
|
18
|
-
</div>
|
|
19
|
-
)
|
|
20
|
-
return this.props.active ? spinner : null
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
Spinner.propTypes = {
|
|
25
|
-
text: PropTypes.string,
|
|
26
|
-
active: PropTypes.bool,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
Spinner.defaultProps = {
|
|
30
|
-
text: 'Loading',
|
|
31
|
-
active: false,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default Spinner
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// dependencies --------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import PropTypes from 'prop-types'
|
|
5
|
-
import Tooltip from './tooltip.jsx'
|
|
6
|
-
import UploadResume from '../../uploader/upload-resume.jsx'
|
|
7
|
-
|
|
8
|
-
// component setup -----------------------------------------------------------
|
|
9
|
-
|
|
10
|
-
class Status extends React.PureComponent {
|
|
11
|
-
// lifecycle events ----------------------------------------------------------
|
|
12
|
-
render() {
|
|
13
|
-
if (!this.props.display) {
|
|
14
|
-
return false
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let spanClass, tip, iconClass, fileSelect
|
|
18
|
-
let title = this.props.title ? this.props.title : null
|
|
19
|
-
const minimal = this.props.minimal
|
|
20
|
-
|
|
21
|
-
switch (this.props.type) {
|
|
22
|
-
case 'public':
|
|
23
|
-
spanClass = 'dataset-status ds-success'
|
|
24
|
-
tip = minimal ? 'Viewable to all visitors' : null
|
|
25
|
-
title = 'Published'
|
|
26
|
-
iconClass = 'fa fa-globe'
|
|
27
|
-
break
|
|
28
|
-
case 'incomplete':
|
|
29
|
-
spanClass = 'dataset-status ds-warning'
|
|
30
|
-
tip = 'Click resume to try again'
|
|
31
|
-
title = 'Incomplete'
|
|
32
|
-
iconClass = 'fa fa-warning'
|
|
33
|
-
fileSelect = minimal ? (
|
|
34
|
-
<span className="file-wrap clearfix">
|
|
35
|
-
<UploadResume datasetId={this.props.dataset.id} />
|
|
36
|
-
</span>
|
|
37
|
-
) : null
|
|
38
|
-
break
|
|
39
|
-
case 'shared':
|
|
40
|
-
spanClass = 'dataset-status ds-info'
|
|
41
|
-
tip = minimal ? 'Shared with me' : null
|
|
42
|
-
title = 'Shared with me'
|
|
43
|
-
iconClass = 'fa fa-user'
|
|
44
|
-
break
|
|
45
|
-
case 'inProgress':
|
|
46
|
-
spanClass = 'dataset-status ds-primary'
|
|
47
|
-
tip = minimal ? 'Upload in progress' : null
|
|
48
|
-
title = 'In progress'
|
|
49
|
-
iconClass = 'fa fa-spin fa-circle-o-notch'
|
|
50
|
-
break
|
|
51
|
-
case 'invalid':
|
|
52
|
-
spanClass = 'dataset-status ds-danger'
|
|
53
|
-
tip = minimal ? 'Invalid' : null
|
|
54
|
-
title = 'Invalid'
|
|
55
|
-
iconClass = 'fa fa-exclamation-circle'
|
|
56
|
-
break
|
|
57
|
-
case 'monitored':
|
|
58
|
-
spanClass = 'dataset-status ds-primary'
|
|
59
|
-
tip =
|
|
60
|
-
'The person who uploaded this dataset will be notified of all new comments posted here.'
|
|
61
|
-
title = 'Uploader is Following'
|
|
62
|
-
iconClass = 'fa fa-user'
|
|
63
|
-
break
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let content = (
|
|
67
|
-
<span className="icon-wrap">
|
|
68
|
-
<i className={iconClass} />
|
|
69
|
-
{minimal ? null : title}
|
|
70
|
-
</span>
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
if (tip) {
|
|
74
|
-
content = <Tooltip tooltip={tip}>{content}</Tooltip>
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<span className="clearfix status">
|
|
79
|
-
{fileSelect}
|
|
80
|
-
<span>
|
|
81
|
-
<span className={spanClass}>{content}</span>
|
|
82
|
-
</span>
|
|
83
|
-
</span>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
Status.propTypes = {
|
|
89
|
-
display: PropTypes.bool,
|
|
90
|
-
minimal: PropTypes.bool,
|
|
91
|
-
type: PropTypes.string,
|
|
92
|
-
dataset: PropTypes.object,
|
|
93
|
-
title: PropTypes.string,
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export default Status
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// dependencies ------------------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import PropTypes from 'prop-types'
|
|
5
|
-
|
|
6
|
-
// component setup ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
class Timeout extends React.Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props)
|
|
11
|
-
this.state = { timedOut: false }
|
|
12
|
-
}
|
|
13
|
-
// life cycle events -------------------------------------------------------------------------
|
|
14
|
-
componentDidMount() {
|
|
15
|
-
const timeoutId = setTimeout(() => {
|
|
16
|
-
this.setState({ timedOut: true })
|
|
17
|
-
}, this.props.timeout)
|
|
18
|
-
this.timeoutId = timeoutId
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
componentWillUnmount() {
|
|
22
|
-
clearTimeout(this.timeoutId)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
render() {
|
|
26
|
-
if (!this.state.timedOut) {
|
|
27
|
-
return this.props.children
|
|
28
|
-
} else {
|
|
29
|
-
throw new Error(
|
|
30
|
-
'The component has been loading for too long. Reverting render to component error boundary.',
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
Timeout.propTypes = {
|
|
37
|
-
timeout: PropTypes.number,
|
|
38
|
-
timeoutId: PropTypes.number,
|
|
39
|
-
children: PropTypes.object,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Timeout.defaultProps = {
|
|
43
|
-
timeout: null,
|
|
44
|
-
timeoutId: null,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default Timeout
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// dependencies ------------------------------------------------------------------
|
|
2
|
-
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import PropTypes from 'prop-types'
|
|
5
|
-
import { Tooltip, OverlayTrigger } from 'react-bootstrap'
|
|
6
|
-
import newId from '../../utils/newid'
|
|
7
|
-
|
|
8
|
-
class TooltipTop extends React.PureComponent {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props)
|
|
11
|
-
this.id = newId('tooltip-id-')
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
render() {
|
|
15
|
-
const tooltip = <Tooltip id={this.id}>{this.props.tooltip}</Tooltip>
|
|
16
|
-
|
|
17
|
-
return this.props.tooltip ? (
|
|
18
|
-
<OverlayTrigger
|
|
19
|
-
placement="top"
|
|
20
|
-
overlay={tooltip}
|
|
21
|
-
delayShow={300}
|
|
22
|
-
delayHide={150}>
|
|
23
|
-
{this.props.children}
|
|
24
|
-
</OverlayTrigger>
|
|
25
|
-
) : (
|
|
26
|
-
this.props.children
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
TooltipTop.propTypes = {
|
|
32
|
-
tooltip: PropTypes.string,
|
|
33
|
-
children: PropTypes.object,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default TooltipTop
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render, screen, fireEvent } from '@testing-library/react'
|
|
3
|
-
import { DropdownButton } from '../dropdown-button'
|
|
4
|
-
|
|
5
|
-
const titleid = 'test-title'
|
|
6
|
-
const dropdownid = 'test-dropdown'
|
|
7
|
-
function renderDropdownButton() {
|
|
8
|
-
const title = <i className="fa fa-gear" data-testid={titleid} />
|
|
9
|
-
render(
|
|
10
|
-
<DropdownButton id="user-menu" title={title}>
|
|
11
|
-
<ul data-testid={dropdownid}>
|
|
12
|
-
<li>Menu Item 1</li>
|
|
13
|
-
<li>Menu Item 2</li>
|
|
14
|
-
<li>Menu Item 3</li>
|
|
15
|
-
</ul>
|
|
16
|
-
</DropdownButton>,
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
describe('DropdownButton component', () => {
|
|
21
|
-
it('does not open on hover', async () => {
|
|
22
|
-
renderDropdownButton()
|
|
23
|
-
|
|
24
|
-
fireEvent.mouseOver(screen.getByTestId(titleid))
|
|
25
|
-
|
|
26
|
-
expect(screen.queryByText('Menu Item 1')).not.toBeInTheDocument()
|
|
27
|
-
expect(screen.queryByText('Menu Item 2')).not.toBeInTheDocument()
|
|
28
|
-
expect(screen.queryByText('Menu Item 3')).not.toBeInTheDocument()
|
|
29
|
-
})
|
|
30
|
-
it('toggle expands the dropdown menu (children) on click', async () => {
|
|
31
|
-
renderDropdownButton()
|
|
32
|
-
|
|
33
|
-
expect(screen.queryByText('Menu Item 1')).not.toBeInTheDocument()
|
|
34
|
-
expect(screen.queryByText('Menu Item 2')).not.toBeInTheDocument()
|
|
35
|
-
expect(screen.queryByText('Menu Item 3')).not.toBeInTheDocument()
|
|
36
|
-
|
|
37
|
-
fireEvent.click(screen.getByTestId(titleid))
|
|
38
|
-
|
|
39
|
-
expect(screen.getByText('Menu Item 1')).toBeInTheDocument()
|
|
40
|
-
expect(screen.getByText('Menu Item 2')).toBeInTheDocument()
|
|
41
|
-
expect(screen.getByText('Menu Item 3')).toBeInTheDocument()
|
|
42
|
-
|
|
43
|
-
fireEvent.click(screen.getByTestId(titleid))
|
|
44
|
-
|
|
45
|
-
expect(screen.queryByText('Menu Item 1')).not.toBeInTheDocument()
|
|
46
|
-
expect(screen.queryByText('Menu Item 2')).not.toBeInTheDocument()
|
|
47
|
-
expect(screen.queryByText('Menu Item 3')).not.toBeInTheDocument()
|
|
48
|
-
})
|
|
49
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { FC, ReactElement, ReactNode, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
interface DropdownButtonProps {
|
|
4
|
-
id: string
|
|
5
|
-
title: string | ReactNode
|
|
6
|
-
children: ReactNode
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Replacement for react-bootstrap 0.31.0 DropdownButton
|
|
11
|
-
* Only covers the OpenNeuro use case
|
|
12
|
-
*/
|
|
13
|
-
export const DropdownButton: FC<DropdownButtonProps> = ({
|
|
14
|
-
id,
|
|
15
|
-
title,
|
|
16
|
-
children,
|
|
17
|
-
}): ReactElement => {
|
|
18
|
-
const [open, setOpen] = useState(false)
|
|
19
|
-
const onClick = (): void => {
|
|
20
|
-
setOpen(!open)
|
|
21
|
-
}
|
|
22
|
-
const computedClasses = `dropdown btn-group${open ? ' open' : ''}`
|
|
23
|
-
return (
|
|
24
|
-
<div className={computedClasses}>
|
|
25
|
-
<button
|
|
26
|
-
id={id}
|
|
27
|
-
className="dropdown-toggle btn btn-default"
|
|
28
|
-
role="button"
|
|
29
|
-
aria-haspopup
|
|
30
|
-
aria-expanded={open}
|
|
31
|
-
type="button"
|
|
32
|
-
onClick={onClick}>
|
|
33
|
-
{title}
|
|
34
|
-
</button>
|
|
35
|
-
{open && (
|
|
36
|
-
<ul className="dropdown-menu" aria-labelledby={id} role="menu">
|
|
37
|
-
{children}
|
|
38
|
-
</ul>
|
|
39
|
-
)}
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { FC, ReactElement } from 'react'
|
|
2
|
-
import { useCookies } from 'react-cookie'
|
|
3
|
-
|
|
4
|
-
interface FeatureToggleProps {
|
|
5
|
-
feature: string
|
|
6
|
-
renderOnEnabled: ReactElement
|
|
7
|
-
renderOnDisabled: ReactElement
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const FeatureToggle: FC<FeatureToggleProps> = ({
|
|
11
|
-
feature,
|
|
12
|
-
renderOnEnabled,
|
|
13
|
-
renderOnDisabled,
|
|
14
|
-
}) => {
|
|
15
|
-
const [cookies] = useCookies()
|
|
16
|
-
return <>{cookies[feature] ? renderOnEnabled : renderOnDisabled}</>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default FeatureToggle
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React, { FC, ReactElement, ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
interface PanelGroupProps {
|
|
4
|
-
children: ReactNode
|
|
5
|
-
accordion?: boolean
|
|
6
|
-
activeKey?: string
|
|
7
|
-
className?: string
|
|
8
|
-
onSelect?: () => void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Replacement for react-bootstrap 0.31.0 Panel
|
|
13
|
-
* Only covers OpenNeuro use case
|
|
14
|
-
*/
|
|
15
|
-
export const PanelGroup: FC<PanelGroupProps> = ({
|
|
16
|
-
children,
|
|
17
|
-
className,
|
|
18
|
-
}): ReactElement => {
|
|
19
|
-
return (
|
|
20
|
-
<div className={`panel-group ${className}`} role="tablist">
|
|
21
|
-
{children}
|
|
22
|
-
</div>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React, { FC, ReactElement, ReactNode, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
interface PanelProps {
|
|
4
|
-
children: ReactNode
|
|
5
|
-
header?: ReactNode
|
|
6
|
-
eventKey?: string
|
|
7
|
-
className?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Replacement for react-bootstrap 0.31.0 Panel
|
|
12
|
-
* Only covers OpenNeuro use case
|
|
13
|
-
*/
|
|
14
|
-
export const Panel: FC<PanelProps> = ({
|
|
15
|
-
header,
|
|
16
|
-
className,
|
|
17
|
-
children,
|
|
18
|
-
}): ReactElement => {
|
|
19
|
-
const [expanded, setExpanded] = useState(false)
|
|
20
|
-
return (
|
|
21
|
-
<div className={`panel panel-default ${className}`}>
|
|
22
|
-
<div className="panel-heading">
|
|
23
|
-
<div className="panel-title">
|
|
24
|
-
<a
|
|
25
|
-
role="tab"
|
|
26
|
-
className={expanded ? null : 'collapsed'}
|
|
27
|
-
aria-expanded={expanded}
|
|
28
|
-
aria-selected={expanded}
|
|
29
|
-
onClick={(): void => {
|
|
30
|
-
setExpanded(!expanded)
|
|
31
|
-
}}>
|
|
32
|
-
{header}
|
|
33
|
-
</a>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
<div
|
|
37
|
-
className={`panel-collapse ${expanded ? 'collapse in' : 'collapse'}`}>
|
|
38
|
-
<div className="panel-body">{children}</div>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import snapshotVersion from '../snapshotVersion.js'
|
|
2
|
-
|
|
3
|
-
describe('LeftSidebar', () => {
|
|
4
|
-
describe('snapshotVersion', () => {
|
|
5
|
-
it('matches a draft URL', () => {
|
|
6
|
-
expect(snapshotVersion({ pathname: '/datasets/ds00001' })).toBe(null)
|
|
7
|
-
})
|
|
8
|
-
it('matches a versioned URL', () => {
|
|
9
|
-
expect(
|
|
10
|
-
snapshotVersion({ pathname: '/datasets/ds001079/versions/1.0.0' }),
|
|
11
|
-
).toBe('1.0.0')
|
|
12
|
-
})
|
|
13
|
-
it('matches correctly with dataset action routes', () => {
|
|
14
|
-
expect(
|
|
15
|
-
snapshotVersion({
|
|
16
|
-
pathname: '/datasets/ds001079/versions/1.0.0/publish',
|
|
17
|
-
}),
|
|
18
|
-
).toBe('1.0.0')
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { mount } from 'enzyme'
|
|
3
|
-
import CommentEditor from '../comment-editor.jsx'
|
|
4
|
-
|
|
5
|
-
describe('CommentEditor component', () => {
|
|
6
|
-
it('renders with default props', () => {
|
|
7
|
-
const wrapper = mount(<CommentEditor />)
|
|
8
|
-
// No snapshot since EditorState is not stable
|
|
9
|
-
expect(wrapper).toBeTruthy()
|
|
10
|
-
})
|
|
11
|
-
it('renders edit mutation when commentId is specified', () => {
|
|
12
|
-
const wrapper = mount(<CommentEditor commentId="1" />)
|
|
13
|
-
expect(wrapper.find('CommentEditMutation')).toBeTruthy()
|
|
14
|
-
})
|
|
15
|
-
it('renders new comment mutation when commentId is not specified', () => {
|
|
16
|
-
const wrapper = mount(<CommentEditor commentId="1" />)
|
|
17
|
-
expect(wrapper.find('CommentMutation')).toBeTruthy()
|
|
18
|
-
})
|
|
19
|
-
})
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import StyleButton from './style-button.jsx'
|
|
4
|
-
|
|
5
|
-
const BLOCK_TYPES = [
|
|
6
|
-
{ label: 'H1', style: 'header-one' },
|
|
7
|
-
{ label: 'H2', style: 'header-two' },
|
|
8
|
-
{ label: 'H3', style: 'header-three' },
|
|
9
|
-
{ label: 'H4', style: 'header-four' },
|
|
10
|
-
{ label: 'H5', style: 'header-five' },
|
|
11
|
-
{ label: 'H6', style: 'header-six' },
|
|
12
|
-
{ label: 'Blockquote', style: 'blockquote' },
|
|
13
|
-
{ label: 'UL', style: 'unordered-list-item' },
|
|
14
|
-
{ label: 'OL', style: 'ordered-list-item' },
|
|
15
|
-
{ label: 'Code Block', style: 'code-block' },
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
const BlockStyleControls = props => {
|
|
19
|
-
const { editorState } = props
|
|
20
|
-
const selection = editorState.getSelection()
|
|
21
|
-
const blockType = editorState
|
|
22
|
-
.getCurrentContent()
|
|
23
|
-
.getBlockForKey(selection.getStartKey())
|
|
24
|
-
.getType()
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div className="RichEditor-controls">
|
|
28
|
-
{BLOCK_TYPES.map(type => (
|
|
29
|
-
<StyleButton
|
|
30
|
-
key={type.label}
|
|
31
|
-
active={type.style === blockType}
|
|
32
|
-
label={type.label}
|
|
33
|
-
onToggle={props.onToggle}
|
|
34
|
-
style={type.style}
|
|
35
|
-
/>
|
|
36
|
-
))}
|
|
37
|
-
</div>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
BlockStyleControls.propTypes = {
|
|
42
|
-
editorState: PropTypes.object,
|
|
43
|
-
onToggle: PropTypes.func,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default BlockStyleControls
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import { Editor, EditorState, RichUtils } from 'draft-js'
|
|
4
|
-
import CommentMutation from '../mutations/comment.jsx'
|
|
5
|
-
import BlockStyleControls from './block-style-controls.jsx'
|
|
6
|
-
import InlineStyleControls from './inline-style-controls.jsx'
|
|
7
|
-
|
|
8
|
-
const getBlockStyle = block =>
|
|
9
|
-
block.getType() === 'blockquote' ? 'RichEditor-blockquote' : null
|
|
10
|
-
|
|
11
|
-
const CommentEditor = ({
|
|
12
|
-
datasetId,
|
|
13
|
-
parentId = null,
|
|
14
|
-
commentId = null,
|
|
15
|
-
state = null,
|
|
16
|
-
done,
|
|
17
|
-
}) => {
|
|
18
|
-
const [editorState, setEditorState] = useState(
|
|
19
|
-
state || EditorState.createEmpty(),
|
|
20
|
-
)
|
|
21
|
-
const doAfterSubmit = () => {
|
|
22
|
-
setEditorState(EditorState.createEmpty())
|
|
23
|
-
done && done()
|
|
24
|
-
}
|
|
25
|
-
const disabled = editorState.getUndoStack().size === 0
|
|
26
|
-
return (
|
|
27
|
-
<div className="RichEditor-root">
|
|
28
|
-
<BlockStyleControls
|
|
29
|
-
editorState={editorState}
|
|
30
|
-
onToggle={blockType =>
|
|
31
|
-
setEditorState(RichUtils.toggleBlockType(editorState, blockType))
|
|
32
|
-
}
|
|
33
|
-
/>
|
|
34
|
-
<InlineStyleControls
|
|
35
|
-
editorState={editorState}
|
|
36
|
-
onToggle={inlineStyle =>
|
|
37
|
-
setEditorState(RichUtils.toggleInlineStyle(editorState, inlineStyle))
|
|
38
|
-
}
|
|
39
|
-
/>
|
|
40
|
-
<div className="RichEditor-editor">
|
|
41
|
-
<Editor
|
|
42
|
-
editorKey={commentId}
|
|
43
|
-
blockStyleFn={getBlockStyle}
|
|
44
|
-
editorState={editorState}
|
|
45
|
-
onChange={setEditorState}
|
|
46
|
-
placeholder="Type your comment here..."
|
|
47
|
-
spellCheck
|
|
48
|
-
/>
|
|
49
|
-
{commentId ? (
|
|
50
|
-
<CommentMutation
|
|
51
|
-
datasetId={datasetId}
|
|
52
|
-
commentId={commentId}
|
|
53
|
-
comment={editorState.getCurrentContent()}
|
|
54
|
-
disabled={disabled}
|
|
55
|
-
done={doAfterSubmit}
|
|
56
|
-
/>
|
|
57
|
-
) : (
|
|
58
|
-
<CommentMutation
|
|
59
|
-
datasetId={datasetId}
|
|
60
|
-
parentId={parentId}
|
|
61
|
-
comment={editorState.getCurrentContent()}
|
|
62
|
-
disabled={disabled}
|
|
63
|
-
done={doAfterSubmit}
|
|
64
|
-
/>
|
|
65
|
-
)}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
CommentEditor.propTypes = {
|
|
72
|
-
datasetId: PropTypes.string,
|
|
73
|
-
parentId: PropTypes.string,
|
|
74
|
-
commentId: PropTypes.string,
|
|
75
|
-
state: PropTypes.object,
|
|
76
|
-
done: PropTypes.func,
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export default CommentEditor
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import StyleButton from './style-button.jsx'
|
|
4
|
-
|
|
5
|
-
const INLINE_STYLES = [
|
|
6
|
-
{ label: 'Bold', style: 'BOLD' },
|
|
7
|
-
{ label: 'Italic', style: 'ITALIC' },
|
|
8
|
-
{ label: 'Underline', style: 'UNDERLINE' },
|
|
9
|
-
{ label: 'Monospace', style: 'CODE' },
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
const InlineStyleControls = props => {
|
|
13
|
-
const currentStyle = props.editorState.getCurrentInlineStyle()
|
|
14
|
-
return (
|
|
15
|
-
<div className="RichEditor-controls">
|
|
16
|
-
{INLINE_STYLES.map(type => (
|
|
17
|
-
<StyleButton
|
|
18
|
-
key={type.label}
|
|
19
|
-
active={currentStyle.has(type.style)}
|
|
20
|
-
label={type.label}
|
|
21
|
-
onToggle={props.onToggle}
|
|
22
|
-
style={type.style}
|
|
23
|
-
/>
|
|
24
|
-
))}
|
|
25
|
-
</div>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
InlineStyleControls.propTypes = {
|
|
30
|
-
editorState: PropTypes.object,
|
|
31
|
-
onToggle: PropTypes.func,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default InlineStyleControls
|