diff --git a/app/.env.dist b/app/.env.dist index feb166b0e..ae5b21d2e 100644 --- a/app/.env.dist +++ b/app/.env.dist @@ -12,4 +12,5 @@ VITE_BUGSNAG_KEY= VITE_DEBUG_APP=true VITE_PRODUCTION_BUILD=false VITE_POUCHDB_DEBUG=false -VITE_NOTEBOOK_LIST_TYPE=tabs \ No newline at end of file +VITE_NOTEBOOK_LIST_TYPE=tabs # tabs or headings +VITE_NOTEBOOK_NAME=survey \ No newline at end of file diff --git a/app/src/App.tsx b/app/src/App.tsx index f0aa3d2df..93a1cf4eb 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -93,7 +93,7 @@ export default function App() { } /> @@ -101,7 +101,7 @@ export default function App() { } /> @@ -114,7 +114,7 @@ export default function App() { without one, it immediately mints a UUID and redirects to it */} { console.log('Failed to delete', record_id, draft_id, err); diff --git a/app/src/gui/components/notebook/index.tsx b/app/src/gui/components/notebook/index.tsx index 30f598294..384e4d88c 100644 --- a/app/src/gui/components/notebook/index.tsx +++ b/app/src/gui/components/notebook/index.tsx @@ -32,6 +32,7 @@ import useMediaQuery from '@mui/material/useMediaQuery'; import CircularLoading from '../ui/circular_loading'; import * as ROUTES from '../../../constants/routes'; import DashboardIcon from '@mui/icons-material/Dashboard'; +import {NOTEBOOK_NAME, NOTEBOOK_NAME_CAPITALIZED} from '../../../buildconfig'; interface TabPanelProps { children?: React.ReactNode; @@ -127,7 +128,7 @@ export default function NotebookComponent(props: NotebookComponentProps) { {' '} - {props.project.name} notebook cannot sync right now. + {props.project.name} {NOTEBOOK_NAME} cannot sync right now. Your device may be offline.
@@ -145,7 +146,7 @@ export default function NotebookComponent(props: NotebookComponentProps) {
) : loading ? ( - + ) : ( - - - + + + @@ -193,12 +194,15 @@ export default function NotebookComponent(props: NotebookComponentProps) { - + } - {...a11yProps(1, 'notebook-records')} + {...a11yProps(1, `${NOTEBOOK_NAME}-records`)} /> diff --git a/app/src/gui/components/notebook/refresh.tsx b/app/src/gui/components/notebook/refresh.tsx index 96b2992f1..ab5139d6f 100644 --- a/app/src/gui/components/notebook/refresh.tsx +++ b/app/src/gui/components/notebook/refresh.tsx @@ -4,6 +4,7 @@ import moment from 'moment/moment'; import {ActionType} from '../../../context/actions'; import {store} from '../../../context/store'; import {useInterval} from '../../../utils/useInterval'; +import {NOTEBOOK_NAME_CAPITALIZED} from '../../../buildconfig'; interface RefreshNotebookProps { handleRefresh: Function; @@ -39,7 +40,7 @@ export default function RefreshNotebook(props: RefreshNotebookProps) { dispatch({ type: ActionType.ADD_ALERT, payload: { - message: `${props.project_name} Notebook refreshed`, + message: `${props.project_name} ${NOTEBOOK_NAME_CAPITALIZED} refreshed`, severity: 'success', }, }); diff --git a/app/src/gui/components/notebook/settings/activation-switch.tsx b/app/src/gui/components/notebook/settings/activation-switch.tsx index 739e94468..4f602c52c 100644 --- a/app/src/gui/components/notebook/settings/activation-switch.tsx +++ b/app/src/gui/components/notebook/settings/activation-switch.tsx @@ -5,6 +5,7 @@ import {ProjectInformation} from '@faims3/data-model'; import DialogActions from '@mui/material/DialogActions'; import Dialog from '@mui/material/Dialog'; +import {NOTEBOOK_NAME} from '../../../../buildconfig'; type NotebookActivationSwitchProps = { project: ProjectInformation; @@ -43,8 +44,8 @@ export default function NotebookActivationSwitch( > Are you sure? - Do you want to start syncing the {props.project.name} notebook to your - device? + Do you want to start syncing the {props.project.name} {NOTEBOOK_NAME}{' '} + to your device? diff --git a/app/src/gui/components/ui/breadcrumbs.test.tsx b/app/src/gui/components/ui/breadcrumbs.test.tsx index 61eaa7dbe..a746ac12c 100644 --- a/app/src/gui/components/ui/breadcrumbs.test.tsx +++ b/app/src/gui/components/ui/breadcrumbs.test.tsx @@ -22,9 +22,10 @@ import {render, screen} from '@testing-library/react'; import {BrowserRouter as Router} from 'react-router-dom'; import Breadcrumbs from './breadcrumbs'; import {describe, it, expect} from 'vitest'; +import {NOTEBOOK_NAME_CAPITALIZED} from '../../../buildconfig'; const testData1 = [{title: 'Workspace'}]; -const testData2 = [{title: 'Workspace'}, {title: 'Notebook'}]; +const testData2 = [{title: 'Workspace'}, {title: NOTEBOOK_NAME_CAPITALIZED}]; describe('Check breadcrumbs component', () => { it('Check with one element in array', async () => { diff --git a/app/src/gui/components/ui/heading-grid.tsx b/app/src/gui/components/ui/heading-grid.tsx index 750c71225..1cff7d24e 100644 --- a/app/src/gui/components/ui/heading-grid.tsx +++ b/app/src/gui/components/ui/heading-grid.tsx @@ -1,6 +1,7 @@ import {Stack} from '@mui/material'; import {DataGrid, GridEventListener} from '@mui/x-data-grid'; import {ProjectInformation} from '@faims3/data-model/build/src/types'; +import {NOTEBOOK_NAME, NOTEBOOK_NAME_CAPITALIZED} from '../../../buildconfig'; /** * Renders a grid with two sections: Active and Not Active. @@ -55,7 +56,7 @@ export default function HeadingGrid({ slots={{ noRowsOverlay: () => ( - No Notebooks have been activated yet. + No {NOTEBOOK_NAME_CAPITALIZED}s have been activated yet. ), }} @@ -87,7 +88,7 @@ export default function HeadingGrid({ slots={{ noRowsOverlay: () => ( - You don't have any unactivated notebooks. + You don't have any unactivated {NOTEBOOK_NAME}s. ), }} diff --git a/app/src/gui/components/ui/tab-grid.tsx b/app/src/gui/components/ui/tab-grid.tsx index 9328a7760..38e4e7d5e 100644 --- a/app/src/gui/components/ui/tab-grid.tsx +++ b/app/src/gui/components/ui/tab-grid.tsx @@ -4,6 +4,7 @@ import TabPanel from '@mui/lab/TabPanel'; import {Box, Stack, Tab} from '@mui/material'; import {DataGrid, GridEventListener} from '@mui/x-data-grid'; import {ProjectInformation} from '@faims3/data-model/build/src/types'; +import {NOTEBOOK_NAME, NOTEBOOK_NAME_CAPITALIZED} from '../../../buildconfig'; /** * Renders a tabbed grid component. @@ -96,7 +97,7 @@ export default function TabGrid({ alignItems="center" justifyContent="center" > - No Notebooks have been activated yet. + No {NOTEBOOK_NAME_CAPITALIZED}s have been activated yet. ), }} @@ -134,7 +135,7 @@ export default function TabGrid({ alignItems="center" justifyContent="center" > - You don't have any unactivated notebooks. + You don't have any unactivated {NOTEBOOK_NAME}s. ), }} diff --git a/app/src/gui/components/workspace/notebooks.tsx b/app/src/gui/components/workspace/notebooks.tsx index 09cdf6b75..d676dcf34 100644 --- a/app/src/gui/components/workspace/notebooks.tsx +++ b/app/src/gui/components/workspace/notebooks.tsx @@ -36,7 +36,7 @@ import {useTheme} from '@mui/material/styles'; import {grey} from '@mui/material/colors'; import Tabs from '../ui/tab-grid'; import HeadingGrid from '../ui/heading-grid'; -import {NOTEBOOK_LIST_TYPE} from '../../../buildconfig'; +import {NOTEBOOK_LIST_TYPE, NOTEBOOK_NAME} from '../../../buildconfig'; interface sortModel { field: string; @@ -92,7 +92,7 @@ export default function NoteBooks(props: NoteBookListProps) { const handleRowClick: GridEventListener<'rowClick'> = params => { if (params.row.is_activated) { - history(ROUTES.NOTEBOOK + params.row.project_id); + history(ROUTES.INDIVIDUAL_NOTEBOOK_ROUTE + params.row.project_id); } else { // do nothing } @@ -157,7 +157,7 @@ export default function NoteBooks(props: NoteBookListProps) { flex: 0.2, minWidth: 160, headerName: 'Sync', - description: 'Toggle syncing this notebook to the server', + description: `Toggle syncing this ${NOTEBOOK_NAME} to the server`, renderCell: (params: GridCellParams) => ( ( {pouchProjectList.length === 0 ? ( - + ) : ( You have {pouchProjectList.filter(r => r.is_activated).length}{' '} - notebook + {NOTEBOOK_NAME} {pouchProjectList.filter(r => r.is_activated).length !== 1 ? 's' : ''}{' '} - activated on this device. To start syncing a notebook, visit the{' '} + activated on this device. To start syncing a {NOTEBOOK_NAME}, visit + the{' '}