@openneuro/app 4.18.1 → 4.19.0-alpha.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/app",
3
- "version": "4.18.1",
3
+ "version": "4.19.0-alpha.1",
4
4
  "description": "React JS web frontend for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "public/client.js",
@@ -19,9 +19,9 @@
19
19
  "@elastic/apm-rum": "5.11.0",
20
20
  "@emotion/react": "11.6.0",
21
21
  "@emotion/styled": "11.6.0",
22
- "@niivue/niivue": "0.33.1",
23
- "@openneuro/client": "^4.18.1",
24
- "@openneuro/components": "^4.18.1",
22
+ "@niivue/niivue": "0.34.0",
23
+ "@openneuro/client": "^4.19.0-alpha.1",
24
+ "@openneuro/components": "^4.19.0-alpha.1",
25
25
  "bids-validator": "1.10.0",
26
26
  "bytes": "^3.0.0",
27
27
  "comlink": "^4.0.5",
@@ -75,11 +75,11 @@
75
75
  "sass": "^1.32.8",
76
76
  "stream-browserify": "^3.0.0",
77
77
  "typescript": "4.5.4",
78
- "vite": "3.2.3",
78
+ "vite": "^3.2.7",
79
79
  "vitest": "^0.25.2"
80
80
  },
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "fbd8afe9033abf11e39e17968b3e9f60261a9c01"
84
+ "gitHead": "42250552695e01915a37f3d00fe6c3476d1661c0"
85
85
  }
@@ -3,6 +3,7 @@ import Helmet from 'react-helmet'
3
3
  import { frontPage } from './pages/front-page/front-page-content'
4
4
  import { CookiesProvider, Cookies } from 'react-cookie'
5
5
  import { ToastContainer } from 'react-toastify'
6
+ import 'react-toastify/dist/ReactToastify.css'
6
7
  import { MediaContextProvider } from './styles/media'
7
8
 
8
9
  interface AppProps {
@@ -94,15 +94,16 @@ const DraftContainer: React.FC<DraftContainerProps> = ({ dataset }) => {
94
94
  {description.Name} - {pageTitle}
95
95
  </title>
96
96
  </Helmet>
97
- {dataset.snapshots && !hasEdit && (
98
- <Navigate
99
- to={`/datasets/${dataset.id}/versions/${
100
- dataset.snapshots.length &&
101
- dataset.snapshots[dataset.snapshots.length - 1].tag
102
- }`}
103
- replace
104
- />
105
- )}
97
+ {dataset.snapshots.length !== 0 &&
98
+ dataset.snapshots[dataset.snapshots.length - 1].tag &&
99
+ !hasEdit && (
100
+ <Navigate
101
+ to={`/datasets/${dataset.id}/versions/${
102
+ dataset.snapshots[dataset.snapshots.length - 1].tag
103
+ }`}
104
+ replace
105
+ />
106
+ )}
106
107
  <div
107
108
  className={`dataset dataset-draft dataset-page dataset-page-${modality?.toLowerCase()}`}>
108
109
  <DatasetHeader
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import FileViewerText from './viewers/file-viewer-text.jsx'
4
- import FileViewerNifti from './viewers/file-viewer-nifti.jsx'
4
+ import FileViewerNifti from './viewers/file-viewer-nifti'
5
5
  import FileViewerJson from './viewers/file-viewer-json.jsx'
6
6
  import FileViewerTsv from './viewers/file-viewer-tsv.jsx'
7
7
  import FileViewerCsv from './viewers/file-viewer-csv.jsx'
@@ -19,7 +19,12 @@ const FileViewerType = ({ path, url, data }) => {
19
19
  path.endsWith('.txt')
20
20
  ) {
21
21
  return <FileViewerText data={data} />
22
- } else if (path.endsWith('.nii.gz') || path.endsWith('.nii') || path.endsWith('.mgh') || path.endsWith('.mgz')) {
22
+ } else if (
23
+ path.endsWith('.nii.gz') ||
24
+ path.endsWith('.nii') ||
25
+ path.endsWith('.mgh') ||
26
+ path.endsWith('.mgz')
27
+ ) {
23
28
  return <FileViewerNifti imageUrl={url} />
24
29
  } else if (path.endsWith('.json')) {
25
30
  return <FileViewerJson data={data} />
@@ -2,7 +2,11 @@ import React, { useEffect, useRef } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import { Niivue } from '@niivue/niivue'
4
4
 
5
- const FileViewerNifti = ({ imageUrl }) => {
5
+ const FileViewerNifti = ({
6
+ imageUrl,
7
+ }: {
8
+ imageUrl: string
9
+ }): React.ReactElement => {
6
10
  const canvas = useRef()
7
11
  useEffect(() => {
8
12
  const volumeList = [
@@ -11,9 +15,11 @@ const FileViewerNifti = ({ imageUrl }) => {
11
15
  colorMap: 'gray',
12
16
  opacity: 1,
13
17
  visible: true,
18
+ limitFrames4D: 5,
14
19
  },
15
20
  ]
16
21
  const nv = new Niivue({ dragAndDropEnabled: false })
22
+ ;(window as any).niivue = nv
17
23
  nv.attachToCanvas(canvas.current)
18
24
  nv.loadVolumes(volumeList) // press the "v" key to cycle through volumes
19
25
  }, [imageUrl])
@@ -53,7 +53,7 @@ export const DatasetAlertDraft: React.FC<DatasetAlertDraftProps> = ({
53
53
  if (hasDraftChanges) {
54
54
  return (
55
55
  <DatasetAlert alert="This dataset has been published!" level="warning">
56
- There are currently unsaved changes to this Draft. Changes made here
56
+ There are currently unsaved changes to this draft. Changes made here
57
57
  become public when you&#32;
58
58
  <Link
59
59
  className="dataset-tool"
@@ -13,11 +13,13 @@ interface AnonymousReviewerProps {
13
13
  id: string
14
14
  expiration: Date
15
15
  }[]
16
+ hasSnapshot: boolean
16
17
  }
17
18
 
18
19
  export const AnonymousReviewer: FC<AnonymousReviewerProps> = ({
19
20
  datasetId,
20
21
  reviewers,
22
+ hasSnapshot,
21
23
  }) => {
22
24
  return (
23
25
  <div className="dataset-anonymous-form">
@@ -30,7 +32,13 @@ export const AnonymousReviewer: FC<AnonymousReviewerProps> = ({
30
32
  one year or until they are removed.
31
33
  </p>
32
34
  </div>
33
- <CreateReviewLink datasetId={datasetId} />
35
+ {hasSnapshot ? (
36
+ <CreateReviewLink datasetId={datasetId} />
37
+ ) : (
38
+ <p className="text-danger">
39
+ Please create a dataset version before generating a reviewer link.
40
+ </p>
41
+ )}
34
42
  {reviewers.length ? (
35
43
  <div className="dataset-form-body">
36
44
  <h3>Previous Review Links: </h3>
@@ -64,7 +64,7 @@ ShareTable.propTypes = {
64
64
  permissions: PropTypes.object,
65
65
  }
66
66
 
67
- const Share = ({ datasetId, permissions, reviewers }) => {
67
+ const Share = ({ datasetId, permissions, reviewers, hasSnapshot }) => {
68
68
  const [userEmail, setUserEmail] = useState('')
69
69
  const [access, setAccess] = useState('ro')
70
70
 
@@ -127,7 +127,11 @@ const Share = ({ datasetId, permissions, reviewers }) => {
127
127
  </div>
128
128
  </div>
129
129
  <hr />
130
- <AnonymousReviewer datasetId={datasetId} reviewers={reviewers} />
130
+ <AnonymousReviewer
131
+ datasetId={datasetId}
132
+ reviewers={reviewers}
133
+ hasSnapshot={hasSnapshot}
134
+ />
131
135
  </DatasetPageBorder>
132
136
  )
133
137
  }
@@ -135,6 +139,8 @@ const Share = ({ datasetId, permissions, reviewers }) => {
135
139
  Share.propTypes = {
136
140
  datasetId: PropTypes.string,
137
141
  permissions: PropTypes.object,
142
+ reviewers: PropTypes.array,
143
+ hasSnapshot: PropTypes.boolean,
138
144
  }
139
145
 
140
146
  export default Share
@@ -63,9 +63,9 @@ const SnapshotRoute = ({ datasetId, snapshots, issues, description }) => {
63
63
  {updateToCC0 && (
64
64
  <p>
65
65
  <strong>Notice:</strong> The current license{' '}
66
- <i>&quote;{draftLicense}&quote;</i> will be updated to
67
- &quote;CC0&quote; when the version is created. Please see FAQ item
68
- &quote;Are there any restrictions on the uploaded data?&quote; for
66
+ <i>&quot;{draftLicense}&quot;</i> will be updated to
67
+ &quot;CC0&quot; when the version is created. Please see FAQ item
68
+ &quot;Are there any restrictions on the uploaded data?&quot; for
69
69
  details.
70
70
  </p>
71
71
  )}
@@ -55,6 +55,7 @@ export const TabRoutesDraft = ({ dataset, hasEdit }) => {
55
55
  datasetId={dataset.id}
56
56
  permissions={dataset.permissions}
57
57
  reviewers={dataset.reviewers}
58
+ hasSnapshot={dataset.snapshots.length}
58
59
  />
59
60
  }
60
61
  />