diff --git a/package.json b/package.json
index bc2b957736..60d1c5cddd 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"generate-schemas": "yarn generate-schema:StudyConfig && yarn generate-schema:GlobalConfig && yarn generate-schema:LibraryConfig",
"test": "playwright test",
"unittest": "vitest",
- "preinstall": "node -e 'if(!/yarn\\.js$/.test(process.env.npm_execpath))throw new Error(\"Use yarn\")'",
+ "preinstall": "node -e \"if(!/yarn\\.js$/.test(process.env.npm_execpath))throw new Error('Use yarn')\"",
"postinstall": "husky"
},
"lint-staged": {
diff --git a/src/components/interface/AlertModal.tsx b/src/components/interface/AlertModal.tsx
index fb593747a9..da26329a3f 100644
--- a/src/components/interface/AlertModal.tsx
+++ b/src/components/interface/AlertModal.tsx
@@ -11,7 +11,7 @@ export function AlertModal() {
const storeDispatch = useStoreDispatch();
const [opened, setOpened] = useState(alertModal.show);
- const close = useCallback(() => storeDispatch(setAlertModal({ ...alertModal, show: false })), [alertModal, setAlertModal, storeDispatch]);
+ const close = useCallback(() => storeDispatch(setAlertModal({ ...alertModal, show: false, title: '' })), [alertModal, setAlertModal, storeDispatch]);
useEffect(() => setOpened(alertModal.show), [alertModal.show]);
@@ -20,7 +20,7 @@ export function AlertModal() {
}
onClose={close}
styles={{ root: { backgroundColor: 'unset' } }}
diff --git a/src/components/interface/AppHeader.tsx b/src/components/interface/AppHeader.tsx
index 9e4ddaec6a..9d5de62220 100644
--- a/src/components/interface/AppHeader.tsx
+++ b/src/components/interface/AppHeader.tsx
@@ -121,6 +121,18 @@ export function AppHeader({ studyNavigatorEnabled, dataCollectionEnabled }: { st
}
}, [answers, flatSequence, studyConfig, currentStep, storageEngine, dataCollectionEnabled, funcIndex]);
+ // Check if we have issues connecting to the database, if so show alert modal
+ const { setAlertModal } = useStoreActions();
+ const [firstMount, setFirstMount] = useState(true);
+ if (storageEngineFailedToConnect && firstMount) {
+ storeDispatch(setAlertModal({
+ show: true,
+ message: `You may be behind a firewall blocking access, or the server collecting data may be down. Study data will not be saved. If you're taking the study you will not be compensated for your efforts. You are welcome to look around. If you are attempting to participate in the study, please email ${studyConfig.uiConfig.contactEmail} for assistance.`,
+ title: 'Failed to connect to the storage engine',
+ }));
+ setFirstMount(false);
+ }
+
return (
diff --git a/src/controllers/ComponentController.tsx b/src/controllers/ComponentController.tsx
index 76dfc3a99e..994439f200 100644
--- a/src/controllers/ComponentController.tsx
+++ b/src/controllers/ComponentController.tsx
@@ -94,6 +94,7 @@ export function ComponentController() {
storeDispatch(setAlertModal({
show: true,
message: `There was an issue connecting to the ${import.meta.env.VITE_STORAGE_ENGINE} database. This could be caused by a network issue or your adblocker. If you are using an adblocker, please disable it for this website and refresh.`,
+ title: 'Failed to connect to the storage engine',
}));
}
}, [setAlertModal, storageEngine, storeDispatch]);
diff --git a/src/public/libraries/virtual-chinrest/assets/ViewingDistanceCalibration.tsx b/src/public/libraries/virtual-chinrest/assets/ViewingDistanceCalibration.tsx
index a5dc622062..0c07a55a5e 100644
--- a/src/public/libraries/virtual-chinrest/assets/ViewingDistanceCalibration.tsx
+++ b/src/public/libraries/virtual-chinrest/assets/ViewingDistanceCalibration.tsx
@@ -171,14 +171,14 @@ export default function ViewingDistanceCalibration({ parameters, setAnswer }: St
- Put your left hand on the
+ Put your left hand on the
space bar
.
Cover your right eye with your right hand.
Using your left eye, focus on the black square. Keep your focus on the black square.
- The
+ The
red ball
{' '}
will disappear as it moves from right to left.
diff --git a/src/store/store.tsx b/src/store/store.tsx
index 9ebe9faff7..b2f6b3d89f 100644
--- a/src/store/store.tsx
+++ b/src/store/store.tsx
@@ -111,7 +111,7 @@ export async function studyStoreCreator(
config,
showStudyBrowser: true,
showHelpText: false,
- alertModal: { show: false, message: '' },
+ alertModal: { show: false, message: '', title: '' },
trialValidation: Object.keys(answers).length > 0 ? allValid : emptyValidation,
reactiveAnswers: {},
metadata,
@@ -205,7 +205,7 @@ export async function studyStoreCreator(
toggleShowHelpText: (state) => {
state.showHelpText = !state.showHelpText;
},
- setAlertModal: (state, action: PayloadAction<{ show: boolean; message: string }>) => {
+ setAlertModal: (state, action: PayloadAction<{ show: boolean; message: string; title: string }>) => {
state.alertModal = action.payload;
},
setReactiveAnswers: (state, action: PayloadAction>>) => {
diff --git a/src/store/types.ts b/src/store/types.ts
index 4cc57495f7..cc03b2150c 100644
--- a/src/store/types.ts
+++ b/src/store/types.ts
@@ -166,7 +166,7 @@ export interface StoreState {
config: StudyConfig;
showStudyBrowser: boolean;
showHelpText: boolean;
- alertModal: { show: boolean, message: string };
+ alertModal: { show: boolean, message: string, title: string };
trialValidation: TrialValidation;
reactiveAnswers: Record>;
metadata: ParticipantMetadata;
diff --git a/src/utils/useDisableBrowserBack.tsx b/src/utils/useDisableBrowserBack.tsx
index 847273d245..735425caef 100644
--- a/src/utils/useDisableBrowserBack.tsx
+++ b/src/utils/useDisableBrowserBack.tsx
@@ -14,7 +14,7 @@ export function useDisableBrowserBack() {
window.history.pushState(null, '', window.location.href);
window.onpopstate = () => {
window.history.pushState(null, '', window.location.href);
- storeDispatch(setAlertModal({ show: true, message: 'Using the browser\'s back button is prohibited during the study.' }));
+ storeDispatch(setAlertModal({ show: true, message: 'Using the browser\'s back button is prohibited during the study.', title: 'Prohibited' }));
};
}
}, [currentStep, setAlertModal, storeDispatch]);