Skip to content

Commit 58d5787

Browse files
committed
Add current progress
1 parent 95bf092 commit 58d5787

18 files changed

+590
-721
lines changed

package-lock.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"file-saver": "^2.0.5",
7676
"framer-motion": "^12.4.7",
7777
"github-markdown-css": "^5.8.1",
78+
"h5wasm": "^0.7.9",
7879
"input-otp": "^1.4.2",
7980
"jotai": "^2.7.2",
8081
"jotai-devtools": "^0.10.0",

src/components/explore-section/EphysViewerContainer/EphysPlot.tsx

Lines changed: 0 additions & 166 deletions
This file was deleted.

src/components/explore-section/EphysViewerContainer/GraphViewComponent.tsx

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/components/explore-section/EphysViewerContainer/GraphViewContainer.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/components/explore-section/EphysViewerContainer/ImageViewContainer.tsx

Lines changed: 23 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,41 @@
1-
import { Button, Spin } from 'antd';
2-
import { useEffect, useMemo, useState } from 'react';
3-
import { loadable } from 'jotai/utils';
4-
import { useAtomValue } from 'jotai';
5-
61
import { NexusImage } from './NexusImage';
7-
import ImageViewComponent, { ImageCollection } from './ImageViewComponent';
8-
import { ExperimentalTrace } from '@/types/explore-section/delta-experiment';
9-
import createImageCollectionDataAtom from '@/components/explore-section/EphysViewerContainer/state/ImageCollectionDataAtom';
10-
11-
// Only fetch three traces at a time.
12-
const PAGINATION_OFFSET = 5;
2+
import ImageViewComponent from './ImageViewComponent';
3+
import NWBTrace from './nwb-trace';
134

145
interface ImageViewContainerProps {
15-
resource: ExperimentalTrace;
16-
stimulusTypeMap: Map<string, number>;
6+
trace: NWBTrace;
177
stimulusType: string;
188
onStimulusChange: (value: string) => void;
199
onRepetitionClicked: (stimulusType: string, rep: string) => () => void;
2010
}
2111

2212
function ImageViewContainer({
13+
trace,
2314
stimulusType,
24-
resource,
25-
stimulusTypeMap,
2615
onRepetitionClicked,
2716
onStimulusChange,
2817
}: ImageViewContainerProps) {
29-
const [page, setPage] = useState<number>(0);
30-
const imageCollectionAtom = useMemo(
31-
() => loadable(createImageCollectionDataAtom(resource, page, stimulusType, stimulusTypeMap)),
32-
[page, resource, stimulusType, stimulusTypeMap]
33-
);
34-
const imageCollectionData = useAtomValue(imageCollectionAtom);
35-
const [localImageCollectionData, setLocalImageCollectionData] = useState<ImageCollection>();
36-
37-
const isLastPage = useMemo(() => {
38-
if (stimulusType !== 'All') {
39-
return true;
40-
}
41-
if (imageCollectionData.state === 'hasData' && imageCollectionData.data) {
42-
const totalStimulus = Array.from(stimulusTypeMap.keys()).length;
43-
return totalStimulus - page * PAGINATION_OFFSET - PAGINATION_OFFSET <= 0;
44-
}
45-
return false;
46-
}, [page, stimulusType, stimulusTypeMap, imageCollectionData]);
47-
48-
useEffect(() => {
49-
if (imageCollectionData.state !== 'hasData' || !imageCollectionData.data) return;
50-
51-
setLocalImageCollectionData(imageCollectionData.data);
52-
}, [imageCollectionData]);
53-
54-
const [projectLabel, orgLabel] = resource._project.split('/').reverse();
55-
5618
return (
5719
<>
58-
{localImageCollectionData && (
59-
<ImageViewComponent
60-
{...{
61-
stimulusTypeMap,
62-
stimulusType,
63-
imageCollectionData: localImageCollectionData,
64-
onStimulusChange,
65-
onRepetitionClicked,
66-
// eslint-disable-next-line react/no-unstable-nested-components
67-
imagePreview: ({ imageUrl }) => (
68-
// We need to put this as a prop because it contains effects (container, not component)
69-
<NexusImage
70-
{...{
71-
imageUrl,
72-
org: orgLabel,
73-
project: projectLabel,
74-
}}
75-
/>
76-
),
77-
}}
78-
/>
79-
)}
80-
81-
{!isLastPage && (
82-
<Spin spinning={imageCollectionData.state === 'loading'}>
83-
<Button
84-
onClick={() => {
85-
setPage(page + 1);
86-
}}
87-
>
88-
Load More
89-
</Button>
90-
</Spin>
91-
)}
20+
<ImageViewComponent
21+
{...{
22+
trace,
23+
stimulusType,
24+
onStimulusChange,
25+
onRepetitionClicked,
26+
// eslint-disable-next-line react/no-unstable-nested-components
27+
imagePreview: ({ imageUrl }) => (
28+
// We need to put this as a prop because it contains effects (container, not component)
29+
<NexusImage
30+
{...{
31+
imageUrl,
32+
org: orgLabel,
33+
project: projectLabel,
34+
}}
35+
/>
36+
),
37+
}}
38+
/>
9239
</>
9340
);
9441
}

0 commit comments

Comments
 (0)