-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): Add Neurosift viewer for EDF and NWB files
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/openneuro-app/src/scripts/dataset/files/viewers/__tests__/file-viewer-edf.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react" | ||
import { render, screen } from "@testing-library/react" | ||
import { FileViewerEdf } from "../file-viewer-edf" | ||
|
||
describe("File Viewer - EDF", () => { | ||
it("renders an iframe with a src value", () => { | ||
render(<FileViewerEdf url="https://example.com/example.edf" />) | ||
expect(screen.getByTitle("Neurosift viewer")).toBeInTheDocument() | ||
}) | ||
}) |
22 changes: 22 additions & 0 deletions
22
packages/openneuro-app/src/scripts/dataset/files/viewers/file-viewer-edf.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react" | ||
import styled from "@emotion/styled" | ||
|
||
const ScaledIframe = styled.iframe` | ||
width: 100%; | ||
height: 50vh; | ||
border: none; | ||
` | ||
|
||
interface FileViewerEdfProps { | ||
url: string | ||
} | ||
|
||
/** | ||
* Viewer embedding Neurosift for EDF and NWB data | ||
*/ | ||
export const FileViewerEdf = ({ url }: FileViewerEdfProps) => { | ||
const viewerUrl = `https://neurosift.app/?p=/edf&embedded=1&url=${url}` | ||
return <ScaledIframe src={viewerUrl} title="Neurosift viewer" /> | ||
} | ||
|
||
export default FileViewerEdf |