Skip to content

Commit 925aa56

Browse files
committed
chore: update staging with annotations hot table update
2 parents 9a59b62 + e181aa2 commit 925aa56

16 files changed

+4481
-4807
lines changed

compose/neurosynth-frontend/cypress/e2e/workflows/Curation/CurationAIInterface.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ describe('CurationAIInterface', () => {
185185
});
186186

187187
describe('table mode', () => {
188-
it('should only show the basic, non-AI options in the manage columns dropdown for the identification phase', () => {
188+
it.only('should only show the basic, non-AI options in the manage columns dropdown for the identification phase', () => {
189189
cy.contains('button', 'Manually review').click();
190190
cy.contains('button', 'Columns').click();
191-
cy.get('.base-Popper-root').should('exist').and('not.contain', 'AI');
191+
cy.get('.MuiPopper-root').should('exist').and('not.contain', 'AI');
192192
});
193193

194194
it('should show the correct button options when a row is selected', () => {

compose/neurosynth-frontend/package-lock.json

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

compose/neurosynth-frontend/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@sentry/react": "^7.119.2",
2525
"@tanstack/react-table": "^8.20.5",
2626
"@tanstack/react-virtual": "^3.13.8",
27-
"axios": "^1.8.4",
27+
"axios": "^1.12.2",
2828
"fast-xml-parser": "^4.4.1",
2929
"handsontable": "^12.3.3",
3030
"html-to-image": "^1.11.11",
@@ -37,7 +37,7 @@
3737
"react-window": "^1.8.8",
3838
"reactflow": "^11.5.3",
3939
"uuid": "^9.0.0",
40-
"vite": "^6.3.5",
40+
"vite": "^6.3.7",
4141
"web-vitals": "^1.1.2",
4242
"zustand": "^4.3.3"
4343
},
@@ -75,7 +75,7 @@
7575
"devDependencies": {
7676
"@eslint/js": "^9.14.0",
7777
"@sentry/vite-plugin": "^4.0.0",
78-
"@testing-library/dom": "^8.3.0",
78+
"@testing-library/dom": "^10.4.1",
7979
"@testing-library/jest-dom": "^5.14.1",
8080
"@testing-library/react": "^11.2.7",
8181
"@testing-library/react-hooks": "^8.0.1",
@@ -104,7 +104,10 @@
104104
"ts-node": "^10.9.2",
105105
"typescript": "^4.9.5",
106106
"typescript-eslint": "^8.13.0",
107-
"vite-tsconfig-paths": "^5.0.1",
107+
"vite-tsconfig-paths": "^5.1.4",
108108
"vitest": "^3.0.7"
109+
},
110+
"optionalDependencies": {
111+
"@rollup/rollup-linux-x64-musl": "4.52.5"
109112
}
110113
}

compose/neurosynth-frontend/src/pages/Annotations/components/EditAnnotationsHotTable.helpers.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,7 @@ export const annotationNotesToHotData = (
119119
};
120120
};
121121

122-
export const createColumnHeader = (
123-
colKey: string,
124-
colType: EPropertyType,
125-
allowRemoveColumn: boolean
126-
) => {
122+
export const createColumnHeader = (colKey: string, colType: EPropertyType, allowRemoveColumn: boolean) => {
127123
const allowRemove = allowRemoveColumn
128124
? `<div style="width: 50px; display: flex; align-items: center; justify-content: center">
129125
${renderToString(
@@ -168,17 +164,15 @@ export const createColumns = (noteKeys: NoteKeyType[], disable?: boolean) =>
168164
x.type === EPropertyType.NUMBER
169165
? numericValidator
170166
: x.type === EPropertyType.BOOLEAN
171-
? booleanValidator
172-
: undefined,
167+
? booleanValidator
168+
: undefined,
173169
} as ColumnSettings;
174170
}),
175171
] as ColumnSettings[];
176172

177173
// we can assume that the hashmap maintains order and is sorted by key
178174
// this function gets all merge cells and only merge cells. If a cell does not need to be merged, a mergeCellObj is not creatd
179-
export const getMergeCells = (
180-
hotDataToStudyMapping: Map<number, { studyId: string; analysisId: string }>
181-
) => {
175+
export const getMergeCells = (hotDataToStudyMapping: Map<number, { studyId: string; analysisId: string }>) => {
182176
const mergeCells: MergeCellsSettings[] = [];
183177

184178
let studyId: string;

compose/neurosynth-frontend/src/pages/Annotations/hooks/useEditAnnotationsHotTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const useEditAnnotationsHotTable = (annotationId?: string, disableEdit?: boolean
4949
annotationNote.study_name && annotationNote.study_year
5050
? `(${annotationNote.study_year}) ${annotationNote.study_name}`
5151
: annotationNote.study_name
52-
? annotationNote.study_name
53-
: '';
52+
? annotationNote.study_name
53+
: '';
5454

5555
const analysisName = annotationNote.analysis_name || '';
5656

compose/neurosynth-frontend/src/pages/Study/components/EditStudyAnalysis.tsx

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
1-
import { Box, Button, Typography } from '@mui/material';
2-
import ConfirmationDialog from 'components/Dialogs/ConfirmationDialog';
3-
import { useDeleteAnalysis } from 'pages/Study/store/StudyStore';
4-
import { useState } from 'react';
5-
import { useDeleteAnnotationNote } from 'stores/AnnotationStore.actions';
1+
import { Box, Typography } from '@mui/material';
2+
import EditStudyAnalysisDetails from 'pages/Study/components/EditStudyAnalysisDetails';
63
import EditStudyAnalysisPoints from 'pages/Study/components/EditStudyAnalysisPoints';
74
import StudyAnalysisWarnings from 'pages/Study/components/StudyAnalysisWarnings';
8-
import EditStudyAnalysisDetails from 'pages/Study/components/EditStudyAnalysisDetails';
95

106
const EditStudyAnalysis: React.FC<{
117
analysisId?: string;
128
onDeleteAnalysis: () => void;
139
}> = (props) => {
14-
const deleteAnalysis = useDeleteAnalysis();
15-
const deleteAnnotationNote = useDeleteAnnotationNote();
16-
17-
const [dialogIsOpen, setDialogIsOpen] = useState(false);
18-
1910
if (!props.analysisId) {
2011
return <Typography sx={{ color: 'warning.dark' }}>No analysis selected</Typography>;
2112
}
2213

23-
const handleCloseDialog = (confirm?: boolean) => {
24-
if (confirm && props.analysisId) {
25-
deleteAnalysis(props.analysisId);
26-
deleteAnnotationNote(props.analysisId);
27-
props.onDeleteAnalysis();
28-
}
29-
setDialogIsOpen(false);
30-
};
31-
3214
return (
3315
<Box sx={{ marginBottom: '2rem' }}>
3416
<StudyAnalysisWarnings analysisId={props.analysisId} />
35-
<EditStudyAnalysisDetails analysisId={props.analysisId} />
17+
<EditStudyAnalysisDetails analysisId={props.analysisId} onDeleteAnalysis={props.onDeleteAnalysis} />
3618
<EditStudyAnalysisPoints analysisId={props.analysisId} />
3719
{/* TODO: This can be added back later when we have a better understanding of where it fits in as currently, all meta-analysis algorithms do not use this */}
3820
{/* <Box sx={{ marginTop: '2rem' }}>
@@ -41,18 +23,6 @@ const EditStudyAnalysis: React.FC<{
4123
</Typography>
4224
<EditAnalysisConditions analysisId={props.analysisId} />
4325
</Box> */}
44-
<Box sx={{ marginTop: '2rem' }}>
45-
<ConfirmationDialog
46-
isOpen={dialogIsOpen}
47-
dialogTitle="Are you sure you want to delete this analysis?"
48-
onCloseDialog={handleCloseDialog}
49-
confirmText="delete analysis"
50-
rejectText="cancel"
51-
/>
52-
<Button variant="contained" onClick={() => setDialogIsOpen(true)} disableElevation color="error">
53-
Delete Analysis
54-
</Button>
55-
</Box>
5626
</Box>
5727
);
5828
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Button, ButtonOwnProps } from '@mui/material';
2+
import ConfirmationDialog from 'components/Dialogs/ConfirmationDialog';
3+
import { useDeleteAnalysis } from 'pages/Study/store/StudyStore';
4+
import { useState } from 'react';
5+
import { useDeleteAnnotationNote } from 'stores/AnnotationStore.actions';
6+
7+
const EditStudyAnalysisDeleteButton: React.FC<
8+
ButtonOwnProps & {
9+
analysisId?: string;
10+
onDeleteAnalysis: () => void;
11+
}
12+
> = ({ analysisId, onDeleteAnalysis, ...buttonProps }) => {
13+
const deleteAnalysis = useDeleteAnalysis();
14+
const deleteAnnotationNote = useDeleteAnnotationNote();
15+
16+
const [dialogIsOpen, setDialogIsOpen] = useState(false);
17+
18+
const handleCloseDialog = (confirm?: boolean) => {
19+
if (confirm && analysisId) {
20+
deleteAnalysis(analysisId);
21+
deleteAnnotationNote(analysisId);
22+
onDeleteAnalysis();
23+
}
24+
setDialogIsOpen(false);
25+
};
26+
27+
return (
28+
<>
29+
<ConfirmationDialog
30+
isOpen={dialogIsOpen}
31+
dialogTitle="Are you sure you want to delete this analysis?"
32+
onCloseDialog={handleCloseDialog}
33+
confirmText="delete analysis"
34+
rejectText="cancel"
35+
/>
36+
<Button {...buttonProps} onClick={() => setDialogIsOpen(true)}>
37+
{buttonProps.children}
38+
</Button>
39+
</>
40+
);
41+
};
42+
43+
export default EditStudyAnalysisDeleteButton;

compose/neurosynth-frontend/src/pages/Study/components/EditStudyAnalysisDetails.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import {
77
import { IStoreAnalysis } from 'pages/Study/store/StudyStore.helpers';
88
import { useEffect } from 'react';
99
import { useUpdateAnnotationNoteName } from 'stores/AnnotationStore.actions';
10+
import EditStudyAnalysisDeleteButton from './EditStudyAnalysisDeleteButton';
1011

11-
const EditStudyAnalysisDetails: React.FC<{ analysisId?: string }> = (props) => {
12+
const EditStudyAnalysisDetails: React.FC<{ analysisId?: string; onDeleteAnalysis: () => void }> = (props) => {
1213
const addOrUpdateAnalysis = useAddOrUpdateAnalysis();
1314
const name = useStudyAnalysisName(props.analysisId);
1415
const description = useStudyAnalysisDescription(props.analysisId);
1516
const updateAnnotationNoteName = useUpdateAnnotationNoteName();
1617

1718
useEffect(() => {
1819
if (!props.analysisId) return;
19-
let debounce: NodeJS.Timeout;
20-
debounce = setTimeout(() => {
20+
const debounce: NodeJS.Timeout = setTimeout(() => {
2121
updateAnnotationNoteName({
2222
analysis: props.analysisId,
2323
analysis_name: name,
@@ -29,11 +29,7 @@ const EditStudyAnalysisDetails: React.FC<{ analysisId?: string }> = (props) => {
2929
};
3030
}, [name, props.analysisId, updateAnnotationNoteName]);
3131

32-
const handleUpdateAnalysisDetails = (
33-
field: keyof IStoreAnalysis,
34-
analysisId: string,
35-
value: string
36-
) => {
32+
const handleUpdateAnalysisDetails = (field: keyof IStoreAnalysis, analysisId: string, value: string) => {
3733
if (!analysisId) return;
3834
addOrUpdateAnalysis({
3935
id: analysisId,
@@ -43,9 +39,19 @@ const EditStudyAnalysisDetails: React.FC<{ analysisId?: string }> = (props) => {
4339

4440
return (
4541
<Box sx={{ width: '100%' }}>
46-
<Typography sx={{ marginBottom: '1rem', fontWeight: 'bold' }}>
47-
Analysis Details
48-
</Typography>
42+
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
43+
<Typography sx={{ marginBottom: '1rem', fontWeight: 'bold' }}>Analysis Details</Typography>
44+
<EditStudyAnalysisDeleteButton
45+
variant="contained"
46+
disableElevation
47+
color="error"
48+
size="small"
49+
onDeleteAnalysis={props.onDeleteAnalysis}
50+
analysisId={props.analysisId}
51+
>
52+
Delete Analysis
53+
</EditStudyAnalysisDeleteButton>
54+
</Box>
4955
<TextField
5056
label="name"
5157
size="small"
@@ -57,11 +63,7 @@ const EditStudyAnalysisDetails: React.FC<{ analysisId?: string }> = (props) => {
5763
/>
5864
<TextField
5965
onChange={(event) => {
60-
handleUpdateAnalysisDetails(
61-
'description',
62-
props.analysisId || '',
63-
event.target.value
64-
);
66+
handleUpdateAnalysisDetails('description', props.analysisId || '', event.target.value);
6567
}}
6668
label="description"
6769
size="small"

compose/neurosynth-frontend/src/pages/Study/components/EditStudyAnnotationsHotTable.helpers.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ export const HotSettings: HotTableProps = {
2727
},
2828
};
2929

30-
export const createStudyAnnotationColHeaders = (noteKeys: NoteKeyType[]): string[] => {
31-
return [
32-
'Analysis Name',
33-
'Analysis Description',
34-
...noteKeys.map((x) => `<div class="${styles[x.type]}">${x.key}</div>`),
35-
];
36-
};
37-
3830
export const createStudyAnnotationColumns = (noteKeys: NoteKeyType[], readonly: boolean) =>
3931
[
4032
{

0 commit comments

Comments
 (0)