Skip to content

Commit 58ff228

Browse files
committed
feat: minor updates, remove comments
1 parent e08f343 commit 58ff228

File tree

7 files changed

+64
-129
lines changed

7 files changed

+64
-129
lines changed

compose/neurosynth-frontend/src/index.tsx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -66,43 +66,6 @@ let theme = createTheme({
6666

6767
theme = responsiveFontSizes(theme);
6868

69-
// theme.typography.h3 = {
70-
// ...theme.typography.h3,
71-
// [theme.breakpoints.down('md')]: {
72-
// fontSize: '1.5rem',
73-
// },
74-
// [theme.breakpoints.up('md')]: {
75-
// fontSize: '3rem',
76-
// },
77-
// };
78-
// theme.typography.h4 = {
79-
// ...theme.typography.h4,
80-
// [theme.breakpoints.down('md')]: {
81-
// fontSize: '1.25rem',
82-
// },
83-
// [theme.breakpoints.up('md')]: {
84-
// fontSize: '2.125',
85-
// },
86-
// };
87-
// theme.typography.h5 = {
88-
// ...theme.typography.h5,
89-
// [theme.breakpoints.down('md')]: {
90-
// fontSize: '1.125rem',
91-
// },
92-
// [theme.breakpoints.up('md')]: {
93-
// fontSize: '1.25rem',
94-
// },
95-
// };
96-
// theme.typography.h6 = {
97-
// ...theme.typography.h6,
98-
// [theme.breakpoints.down('md')]: {
99-
// fontSize: '1rem',
100-
// },
101-
// [theme.breakpoints.up('md')]: {
102-
// fontSize: '1.25rem',
103-
// },
104-
// };
105-
10669
const domain = import.meta.env.VITE_APP_AUTH0_DOMAIN as string;
10770
const clientId = import.meta.env.VITE_APP_AUTH0_CLIENT_ID as string;
10871
const audience = import.meta.env.VITE_APP_AUTH0_AUDIENCE as string;

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import { Box, FormControl, InputLabel, MenuItem, Select, SelectChangeEvent } from '@mui/material';
22
import { useAddOrUpdateAnalysis } from 'pages/Study/store/StudyStore';
3-
import {
4-
useStudyAnalysisPointSpace,
5-
useStudyAnalysisPointStatistic,
6-
} from 'pages/Study/store/StudyStore';
7-
import {
8-
DefaultMapTypes,
9-
DefaultSpaceTypes,
10-
MapOrSpaceType,
11-
} from 'pages/Study/store/StudyStore.helpers';
3+
import { useStudyAnalysisPointSpace, useStudyAnalysisPointStatistic } from 'pages/Study/store/StudyStore';
4+
import { DefaultMapTypes, DefaultSpaceTypes, MapOrSpaceType } from 'pages/Study/store/StudyStore.helpers';
125

136
const statisticTypeOptions: MapOrSpaceType[] = Object.keys(DefaultMapTypes).map((key) => {
147
return {
@@ -54,32 +47,24 @@ const EditStudyAnalysisPointSpaceAndStatistic: React.FC<{
5447
sx={{
5548
margin: '1rem 0',
5649
display: 'flex',
50+
gap: 1,
5751
justifyContent: 'space-between',
5852
width: '100%',
59-
maxWidth: '550px',
6053
}}
6154
>
62-
<FormControl sx={{ width: '250px' }} size="small" fullWidth>
55+
<FormControl size="small" fullWidth>
6356
<InputLabel id="num-col-label">Statistic</InputLabel>
64-
<Select
65-
onChange={handleSelectStatistic}
66-
value={analysisPointStatistic?.value || ''}
67-
label="Statistic"
68-
>
57+
<Select onChange={handleSelectStatistic} value={analysisPointStatistic?.value || ''} label="Statistic">
6958
{statisticTypeOptions.map((mapTypeOption) => (
7059
<MenuItem key={mapTypeOption.value} value={mapTypeOption.value}>
7160
{mapTypeOption.label}
7261
</MenuItem>
7362
))}
7463
</Select>
7564
</FormControl>
76-
<FormControl sx={{ width: '250px' }} size="small" fullWidth>
65+
<FormControl size="small" fullWidth>
7766
<InputLabel id="num-col-label">Space</InputLabel>
78-
<Select
79-
onChange={handleSelectSpace}
80-
value={analysisPointSpace?.value || ''}
81-
label="Space"
82-
>
67+
<Select onChange={handleSelectSpace} value={analysisPointSpace?.value || ''} label="Space">
8368
{spaceTypeOptions.map((spaceTypeOption) => (
8469
<MenuItem key={spaceTypeOption.value} value={spaceTypeOption.value}>
8570
{spaceTypeOption.label}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const EditStudyAnalysisPoints: React.FC<{ analysisId?: string }> = (props) => {
1515
<HelpIcon color="primary" />
1616
</Tooltip>
1717
</Box>
18-
{/* <EditStudyAnalysisPointSpaceAndStatistic analysisId={props.analysisId} /> */}
18+
<EditStudyAnalysisPointSpaceAndStatistic analysisId={props.analysisId} />
1919
<EditStudyAnalysisPointsHotTable analysisId={props.analysisId} />
2020
</Box>
2121
);

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

Lines changed: 46 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ const EditStudyAnalysisPointsHotTable: React.FC<{ analysisId?: string; readOnly?
3838
insertRowsAbove: false,
3939
insertedRowsViaPaste: [],
4040
});
41-
const { insertRowsDialogIsOpen, openInsertRowsDialog, closeInsertRowsDialog } = useEditAnalysisPointsHotTable(
42-
analysisId,
43-
hotTableRef,
44-
hotTableMetadata
45-
);
41+
const { insertRowsDialogIsOpen, openInsertRowsDialog, closeInsertRowsDialog, height } =
42+
useEditAnalysisPointsHotTable(analysisId, hotTableRef, hotTableMetadata);
4643

4744
// handsontable binds and updates to the data references themselves which means the original data is being mutated.
4845
// as we use zustand, this may not be a good idea, so we implement handleAfterChange to
@@ -216,66 +213,54 @@ const EditStudyAnalysisPointsHotTable: React.FC<{ analysisId?: string; readOnly?
216213
* 4) handleBeforeCreateRow
217214
* 5) handleAfterChange
218215
*/
216+
219217
return (
220-
<Box sx={{ width: '100%', height: '100%' }}>
221-
<HotTable
222-
{...EditStudyAnalysisPointsDefaultConfig}
223-
afterChange={handleAfterChange} // beforeChange results in weird update issues so we use afterChange
224-
beforePaste={handleBeforePaste}
225-
width="100%"
226-
height="auto"
227-
beforeCreateRow={handleBeforeCreateRow}
228-
beforeRemoveRow={handleBeforeRemoveRow}
229-
afterAutofill={handleAfterAutofill}
230-
columns={hotTableColumnSettings}
231-
colHeaders={hotTableColHeaders}
232-
data={[...(points || [])]}
233-
ref={hotTableRef}
218+
<Box>
219+
<InputNumberDialog
220+
isOpen={insertRowsDialogIsOpen}
221+
dialogTitle="Enter number of rows to insert"
222+
onCloseDialog={() => closeInsertRowsDialog()}
223+
onSubmit={(val) => handleInsertRows(val)}
224+
dialogDescription=""
234225
/>
226+
<Box sx={{ display: 'flex' }}>
227+
<Box
228+
sx={{
229+
width: '40px',
230+
height: '120px',
231+
marginRight: '0.5rem',
232+
}}
233+
>
234+
<EditStudyAnalysisPointsHotTableToolbar
235+
onAddRow={handleAddRow}
236+
onAddRows={handleAddRows}
237+
onDeleteRows={handleDeleteRows}
238+
/>
239+
</Box>
240+
<Box
241+
sx={{
242+
width: 'calc(100% - 0.5rem - 40px)',
243+
height: height,
244+
}}
245+
>
246+
<HotTable
247+
{...EditStudyAnalysisPointsDefaultConfig}
248+
ref={hotTableRef}
249+
afterChange={handleAfterChange} // beforeChange results in weird update issues so we use afterChange
250+
beforePaste={handleBeforePaste}
251+
beforeCreateRow={handleBeforeCreateRow}
252+
height={height}
253+
stretchH="all"
254+
beforeRemoveRow={handleBeforeRemoveRow}
255+
afterAutofill={handleAfterAutofill}
256+
columns={hotTableColumnSettings}
257+
colHeaders={hotTableColHeaders}
258+
data={[...(points || [])]}
259+
/>
260+
</Box>
261+
</Box>
235262
</Box>
236263
);
237-
// return (
238-
// <Box>
239-
// <InputNumberDialog
240-
// isOpen={insertRowsDialogIsOpen}
241-
// dialogTitle="Enter number of rows to insert"
242-
// onCloseDialog={() => closeInsertRowsDialog()}
243-
// onSubmit={(val) => handleInsertRows(val)}
244-
// dialogDescription=""
245-
// />
246-
// <Box>
247-
// {/* <Box
248-
// sx={{
249-
// width: '40px',
250-
// height: '120px',
251-
// marginRight: '0.5rem',
252-
// }}
253-
// >
254-
// <EditStudyAnalysisPointsHotTableToolbar
255-
// onAddRow={handleAddRow}
256-
// onAddRows={handleAddRows}
257-
// onDeleteRows={handleDeleteRows}
258-
// />
259-
// </Box> */}
260-
// <Box sx={{ width: '100%', height: '100%' }}>
261-
// <HotTable
262-
// {...EditStudyAnalysisPointsDefaultConfig}
263-
// ref={hotTableRef}
264-
// afterChange={handleAfterChange} // beforeChange results in weird update issues so we use afterChange
265-
// beforePaste={handleBeforePaste}
266-
// beforeCreateRow={handleBeforeCreateRow}
267-
// height="auto"
268-
// width="100%"
269-
// beforeRemoveRow={handleBeforeRemoveRow}
270-
// afterAutofill={handleAfterAutofill}
271-
// columns={hotTableColumnSettings}
272-
// colHeaders={hotTableColHeaders}
273-
// data={[...(points || [])]}
274-
// />
275-
// </Box>
276-
// </Box>
277-
// </Box>
278-
// );
279264
}
280265
);
281266

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const EditStudyAnnotationsHotTable: React.FC<{ readonly?: boolean }> = ({ readon
5555
beforePaste={handleBeforePaste}
5656
width="100%"
5757
height="auto"
58+
stretchH="all"
5859
hiddenRows={{
5960
rows: hiddenRows,
6061
indicators: false,

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,7 @@ const EditStudySwapVersionButton: React.FC = () => {
211211
isOpen={unsavedChangesConfirmationDialog}
212212
rejectText="Cancel"
213213
/>
214-
<Menu
215-
open={open}
216-
onClose={handleCloseNavMenu}
217-
anchorEl={anchorEl}
218-
// anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}
219-
// transformOrigin={{ vertical: 'bottom', horizontal: 'right' }}
220-
>
214+
<Menu open={open} onClose={handleCloseNavMenu} anchorEl={anchorEl}>
221215
{baseStudyVersions.map((version) => {
222216
const isCurrentlySelected = version.id === studyId;
223217
const username = version.username ? version.username : 'neurosynth';

compose/neurosynth-frontend/src/pages/Study/hooks/useEditAnalysisPointsHotTable.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import HotTable from '@handsontable/react';
22
import { useStudyAnalysisPoints } from 'pages/Study/store/StudyStore';
33
import { IStorePoint } from 'pages/Study/store/StudyStore.helpers';
4-
import { useEffect, useState } from 'react';
4+
import { useEffect, useMemo, useState } from 'react';
55

66
const useAnalysisPointsHotTable = (
77
aanlysisId: string | undefined,
@@ -71,7 +71,14 @@ const useAnalysisPointsHotTable = (
7171
// eslint-disable-next-line react-hooks/exhaustive-deps
7272
}, [hotTableRef]);
7373

74+
const height = useMemo(() => {
75+
const totalHeight = 26 + (points?.length || 0) * 24;
76+
const height = totalHeight > 600 ? 600 : totalHeight;
77+
return height;
78+
}, [points]);
79+
7480
return {
81+
height,
7582
insertRowsDialogIsOpen,
7683
openInsertRowsDialog,
7784
closeInsertRowsDialog,

0 commit comments

Comments
 (0)