Skip to content

Commit ab7734d

Browse files
committed
fix: fixed redirection state
1 parent 3199dda commit ab7734d

File tree

3 files changed

+23
-59
lines changed

3 files changed

+23
-59
lines changed

compose/neurosynth-frontend/src/pages/BaseNavigation/BaseNavigation.tsx

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,13 @@ const BaseNavigation: React.FC = (_props) => {
8080
</ProtectedProjectRoute>
8181
}
8282
children={[
83-
<Route
84-
key="project-id-project"
85-
path="project"
86-
element={<ProjectEditMetaAnalyses />}
87-
/>,
83+
<Route key="project-id-project" path="project" element={<ProjectEditMetaAnalyses />} />,
8884
<Route
8985
key="project-id-meta-analyses"
9086
path="meta-analyses"
9187
element={<ProjectViewMetaAnalyses />}
9288
/>,
93-
<Route
94-
key="project-id-index"
95-
index
96-
element={<Navigate replace to="project" />}
97-
/>,
98-
<Route
99-
key="project-id-*"
100-
path="*"
101-
element={<Navigate replace to="project" />}
102-
/>,
89+
<Route key="project-id-index" index element={<Navigate replace to="project" />} />,
10390
]}
10491
/>
10592
<Route
@@ -138,10 +125,7 @@ const BaseNavigation: React.FC = (_props) => {
138125
<Route
139126
path="/projects/:projectId/extraction/studies/:studyId/edit"
140127
element={
141-
<ProtectedProjectRoute
142-
onlyOwnerCanAccess
143-
errorMessage="You do not have access to this project"
144-
>
128+
<ProtectedProjectRoute onlyOwnerCanAccess errorMessage="You do not have access to this project">
145129
<Box sx={BaseNavigationStyles.pagesContainer}>
146130
<EditStudyPage />
147131
</Box>
@@ -196,19 +180,17 @@ const BaseNavigation: React.FC = (_props) => {
196180
</Box>
197181
}
198182
/>
199-
{['/base-studies/:baseStudyId', '/base-studies/:baseStudyId/:studyVersionId'].map(
200-
(path) => (
201-
<Route
202-
key={path}
203-
path={path}
204-
element={
205-
<Box sx={BaseNavigationStyles.pagesContainer}>
206-
<BaseStudyPage />
207-
</Box>
208-
}
209-
/>
210-
)
211-
)}
183+
{['/base-studies/:baseStudyId', '/base-studies/:baseStudyId/:studyVersionId'].map((path) => (
184+
<Route
185+
key={path}
186+
path={path}
187+
element={
188+
<Box sx={BaseNavigationStyles.pagesContainer}>
189+
<BaseStudyPage />
190+
</Box>
191+
}
192+
/>
193+
))}
212194
<Route
213195
path="/meta-analyses"
214196
element={

compose/neurosynth-frontend/src/pages/Curation/CurationPage.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { useState } from 'react';
2121
import { useNavigate, useParams } from 'react-router-dom';
2222
import CurationDownloadIncludedStudiesButton from './components/CurationDownloadIncludedStudiesButton';
2323

24-
const CurationPage: React.FC = (props) => {
24+
const CurationPage: React.FC = () => {
2525
const [prismaIsOpen, setPrismaIsOpen] = useState(false);
2626
const { projectId } = useParams<{ projectId: string | undefined }>();
2727
const projectUser = useProjectUser();
@@ -38,14 +38,13 @@ const CurationPage: React.FC = (props) => {
3838
const { included, uncategorized } = useGetCurationSummary();
3939
const { data: studyset } = useGetStudysetById(studysetId || '', false);
4040

41-
const extractionStepInitialized =
42-
studysetId && annotationId && (studyset?.studies?.length || 0) > 0;
41+
const extractionStepInitialized = studysetId && annotationId && (studyset?.studies?.length || 0) > 0;
4342

4443
const handleMoveToExtractionPhase = () => {
4544
if (extractionStepInitialized) {
4645
navigate(`/projects/${projectId}/extraction`);
4746
} else {
48-
navigate(`/projects/${projectId}`, {
47+
navigate(`/projects/${projectId}/project`, {
4948
state: {
5049
projectPage: {
5150
openCurationDialog: true,
@@ -93,10 +92,7 @@ const CurationPage: React.FC = (props) => {
9392
<CurationDownloadIncludedStudiesButton />
9493
{isPrisma && (
9594
<>
96-
<PrismaDialog
97-
onCloseDialog={() => setPrismaIsOpen(false)}
98-
isOpen={prismaIsOpen}
99-
/>
95+
<PrismaDialog onCloseDialog={() => setPrismaIsOpen(false)} isOpen={prismaIsOpen} />
10096
<Button
10197
onClick={() => setPrismaIsOpen(true)}
10298
variant="outlined"

compose/neurosynth-frontend/src/pages/Project/components/MoveToExtractionDialog.tsx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
7373
});
7474

7575
const newStudysetId = newStudyset.data.id;
76-
if (!newStudysetId)
77-
throw new Error('expected a studyset id but did not receive one');
76+
if (!newStudysetId) throw new Error('expected a studyset id but did not receive one');
7877

7978
tempStudysetId = newStudysetId;
8079

@@ -114,8 +113,7 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
114113
});
115114

116115
const newAnnotationId = newAnnotation.data.id;
117-
if (!newAnnotationId)
118-
throw new Error('expected a studyset id but did not receive one');
116+
if (!newAnnotationId) throw new Error('expected a studyset id but did not receive one');
119117

120118
tempAnnotationId = newAnnotationId;
121119
updateExtractionMetadata({
@@ -140,15 +138,7 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
140138
const stubsToBaseStudies: Array<
141139
Pick<
142140
BaseStudy,
143-
| 'name'
144-
| 'doi'
145-
| 'pmid'
146-
| 'pmcid'
147-
| 'year'
148-
| 'description'
149-
| 'publication'
150-
| 'authors'
151-
| 'level'
141+
'name' | 'doi' | 'pmid' | 'pmcid' | 'year' | 'description' | 'publication' | 'authors' | 'level'
152142
>
153143
> = includedStubs.map((stub) => ({
154144
name: stub.title,
@@ -252,14 +242,10 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
252242
value={progress}
253243
/>
254244
</Box>
255-
<Box
256-
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}
257-
>
245+
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
258246
<CircularProgress />
259247
<Typography>{progressText}</Typography>
260-
<Typography sx={{ marginTop: '1rem' }}>
261-
(This may take a minute)
262-
</Typography>
248+
<Typography sx={{ marginTop: '1rem' }}>(This may take a minute)</Typography>
263249
</Box>
264250
{/* need this empty div to space out elements properly */}
265251
<div></div>

0 commit comments

Comments
 (0)