@openneuro/app 4.29.1 → 4.29.3

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.29.1",
3
+ "version": "4.29.3",
4
4
  "description": "React JS web frontend for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "public/client.js",
@@ -20,7 +20,7 @@
20
20
  "@emotion/react": "11.11.1",
21
21
  "@emotion/styled": "11.11.0",
22
22
  "@niivue/niivue": "0.45.1",
23
- "@openneuro/components": "^4.29.1",
23
+ "@openneuro/components": "^4.29.3",
24
24
  "@sentry/react": "^8.25.0",
25
25
  "@tanstack/react-table": "^8.9.3",
26
26
  "buffer": "^6.0.3",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "a6bde4b8754b5e146be5c6b7983c86bee0b0d2c5"
77
+ "gitHead": "0d85976853b055988c1e2f9b7c8239e983f306d7"
78
78
  }
package/src/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <script src="/crn/config.js" type="module"></script>
6
6
  <script async src="https://www.googletagmanager.com/gtag/js"></script>
7
- <script src="https://kit.fontawesome.com/dbe89e3d01.js" crossorigin="anonymous"></script>
7
+ <script src="https://kit.fontawesome.com/fa7ae96ba1.js" crossorigin="anonymous"></script>
8
8
  <meta http-equiv="expires" content="0" />
9
9
  <meta charset="utf-8" />
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -82,7 +82,7 @@ const downloadTree = async (
82
82
  // Skip files which are already complete
83
83
  if (fileHandle.size == file.size) continue
84
84
  const writable = await fileHandle.createWritable()
85
- const { body, status, statusText } = await fetch(file.urls.pop())
85
+ const { body, status, statusText } = await fetch(file.urls[0])
86
86
  let loaded = 0
87
87
  const progress = new TransformStream({
88
88
  transform(chunk, controller) {
@@ -0,0 +1,15 @@
1
+ import { isNifti, isNwb } from "../file-types"
2
+
3
+ describe("isNifti()", () => {
4
+ it("detects nifti files", () => {
5
+ expect(isNifti("sub-01/anat/sub-01_T1w.nii.gz")).toBeTruthy()
6
+ expect(isNifti("dataset_description.json")).toBeFalsy()
7
+ })
8
+ })
9
+ describe("isNwb()", () => {
10
+ it("detects nwb/edf files", () => {
11
+ expect(isNwb("eeg/sub-5_task-oa_eeg.edf")).toBeTruthy()
12
+ expect(isNwb("eeg/sub-cbm009_task-protmap_eeg.edf")).toBeTruthy()
13
+ expect(isNwb("sub-01/anat/sub-01_T1w.nii.gz")).toBeFalsy()
14
+ })
15
+ })
@@ -0,0 +1,10 @@
1
+ export function isNifti(path) {
2
+ return path.endsWith(".nii.gz") ||
3
+ path.endsWith(".nii") ||
4
+ path.endsWith(".mgh") ||
5
+ path.endsWith(".mgz")
6
+ }
7
+
8
+ export function isNwb(path) {
9
+ return path.endsWith(".edf") || path.endsWith(".nwb")
10
+ }
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useState } from "react"
2
2
  import { Loading } from "@openneuro/components/loading"
3
3
  import FileViewerType from "./file-viewer-type.jsx"
4
+ import { isNifti, isNwb } from "./file-types"
4
5
 
5
6
  const FileView = ({ url, path }) => {
6
7
  const [data, setData] = useState(new ArrayBuffer(0))
@@ -15,7 +16,12 @@ const FileView = ({ url, path }) => {
15
16
 
16
17
  useEffect(() => {
17
18
  if (loading) {
18
- fetchUrl()
19
+ // These viewers load their own data
20
+ if (isNifti(path) || isNwb(path)) {
21
+ setLoading(false)
22
+ } else {
23
+ fetchUrl()
24
+ }
19
25
  }
20
26
  })
21
27
 
@@ -7,6 +7,7 @@ import FileViewerTsv from "./viewers/file-viewer-tsv.jsx"
7
7
  import FileViewerCsv from "./viewers/file-viewer-csv.jsx"
8
8
  import FileViewerHtml from "./viewers/file-viewer-html.jsx"
9
9
  import { FileViewerNeurosift } from "./viewers/file-viewer-neurosift"
10
+ import { isNifti } from "./file-types"
10
11
 
11
12
  /**
12
13
  * Choose the right viewer for each file type
@@ -21,10 +22,7 @@ const FileViewerType = ({ path, url, data }) => {
21
22
  ) {
22
23
  return <FileViewerText data={data} />
23
24
  } else if (
24
- path.endsWith(".nii.gz") ||
25
- path.endsWith(".nii") ||
26
- path.endsWith(".mgh") ||
27
- path.endsWith(".mgz")
25
+ isNifti(path)
28
26
  ) {
29
27
  return <FileViewerNifti imageUrl={url} />
30
28
  } else if (path.endsWith(".json")) {
@@ -49,18 +49,22 @@
49
49
  display: flex;
50
50
  justify-content: space-between;
51
51
  align-content: center;
52
- @media (max-width: 767px) {
52
+ @media (max-width: 990px) {
53
53
  flex-wrap: wrap;
54
54
  }
55
55
  > span {
56
56
  display: block;
57
- min-width: 25%;
57
+ min-width: 23.333333%;
58
58
  margin-bottom: 11px;
59
+ &:nth-child(2){
60
+ min-width: 30%;
61
+ word-wrap: break-word;
62
+ }
59
63
  label {
60
64
  font-weight: bold;
61
65
  font-size: 14px;
62
66
  display: none;
63
- @media (max-width: 767px) {
67
+ @media (max-width: 990px) {
64
68
  display: block;
65
69
  }
66
70
  }
@@ -75,7 +79,7 @@
75
79
  .data-table-header {
76
80
  font-weight: bold;
77
81
  font-size: 14px;
78
- @media (max-width: 767px) {
82
+ @media (max-width: 990px) {
79
83
  display: none;
80
84
  }
81
85
  }