Skip to content

Commit 8e3f30d

Browse files
committed
chore: merge branch 'main' into dev
2 parents 04bcad0 + e338568 commit 8e3f30d

6 files changed

Lines changed: 62 additions & 24612 deletions

File tree

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"dependencies": {
1818
"@douglasneuroinformatics/libcrypto": "catalog:",
1919
"@douglasneuroinformatics/libjs": "catalog:",
20-
"@douglasneuroinformatics/libnest": "^7.0.1",
20+
"@douglasneuroinformatics/libnest": "^7.3.1",
2121
"@douglasneuroinformatics/libpasswd": "catalog:",
2222
"@douglasneuroinformatics/libstats": "catalog:",
2323
"@faker-js/faker": "^9.4.0",

apps/web/src/features/session/components/StartSessionForm/StartSessionForm.tsx

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,34 +105,18 @@ export const StartSessionForm = ({ currentGroup, initialValues, readOnly, onSubm
105105
}
106106
},
107107
subjectDateOfBirth: {
108-
kind: 'dynamic',
109-
deps: ['subjectIdentificationMethod'],
110-
render({ subjectIdentificationMethod }) {
111-
return subjectIdentificationMethod === 'PERSONAL_INFO'
112-
? {
113-
kind: 'date',
114-
label: t('core.identificationData.dateOfBirth.label')
115-
}
116-
: null;
117-
}
108+
kind: 'date',
109+
label: t('core.identificationData.dateOfBirth.label')
118110
},
119111
subjectSex: {
120-
kind: 'dynamic',
121-
deps: ['subjectIdentificationMethod'],
122-
render({ subjectIdentificationMethod }) {
123-
return subjectIdentificationMethod === 'PERSONAL_INFO'
124-
? {
125-
description: t('core.identificationData.sex.description'),
126-
kind: 'string',
127-
label: t('core.identificationData.sex.label'),
128-
options: {
129-
FEMALE: t('core.identificationData.sex.female'),
130-
MALE: t('core.identificationData.sex.male')
131-
},
132-
variant: 'select'
133-
}
134-
: null;
135-
}
112+
description: t('core.identificationData.sex.description'),
113+
kind: 'string',
114+
label: t('core.identificationData.sex.label'),
115+
options: {
116+
FEMALE: t('core.identificationData.sex.female'),
117+
MALE: t('core.identificationData.sex.male')
118+
},
119+
variant: 'select'
136120
}
137121
}
138122
},

apps/web/src/features/upload/pages/UploadPage.tsx

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import React, { useState } from 'react';
22

3+
import { isZodType } from '@douglasneuroinformatics/libjs';
34
import { Button, FileDropzone, Heading, Spinner } from '@douglasneuroinformatics/libui/components';
45
import { useDownload, useNotificationsStore, useTranslation } from '@douglasneuroinformatics/libui/hooks';
56
import type { AnyUnilingualFormInstrument } from '@opendatacapture/runtime-core';
6-
import { BadgeHelpIcon, DownloadIcon } from 'lucide-react';
7+
import { BadgeHelpIcon, CircleAlertIcon, DownloadIcon } from 'lucide-react';
78
import { useParams } from 'react-router-dom';
89

910
import { PageHeader } from '@/components/PageHeader';
@@ -107,44 +108,56 @@ export const UploadPage = () => {
107108
</Heading>
108109
</PageHeader>
109110
{!isLoading ? (
110-
<div className="mx-auto flex w-full max-w-3xl grow flex-col justify-center">
111-
<FileDropzone
112-
acceptedFileTypes={{
113-
'text/csv': ['.csv']
114-
}}
115-
className="flex h-80 w-full flex-col"
116-
file={file}
117-
setFile={setFile}
118-
/>
119-
<div className="mt-4 flex justify-between space-x-2">
120-
<Button disabled={!(file && instrument)} variant={'primary'} onClick={() => void handleInstrumentCSV()}>
121-
{t('core.submit')}
122-
</Button>
123-
<div className="flex justify-between space-x-1">
124-
<Button className="gap-1" disabled={!instrument} variant={'primary'} onClick={handleTemplateDownload}>
125-
<DownloadIcon />
126-
{t({
127-
en: 'Download Template',
128-
fr: 'Télécharger le modèle'
129-
})}
130-
</Button>
131-
<Button
132-
className="gap-1"
133-
disabled={!instrument}
134-
variant={'primary'}
135-
onClick={() => {
136-
window.open('https://opendatacapture.org/en/docs/guides/how-to-upload-data/');
137-
}}
138-
>
139-
<BadgeHelpIcon />
140-
{t({
141-
en: 'Help',
142-
fr: 'Aide'
143-
})}
111+
isZodType(instrument.validationSchema, { version: 4 }) ? (
112+
<div className="mb-2 flex items-center gap-2 rounded-md bg-red-300 p-4 dark:bg-red-800">
113+
<CircleAlertIcon style={{ height: '20px', strokeWidth: '2px', width: '20px' }} />
114+
<h5 className="font-medium tracking-tight">
115+
{t({
116+
en: 'Upload is Not Supported for Zod v4 Instruments',
117+
fr: "Le téléchargement n'est pas pris en charge pour les instruments utilisant Zod v4"
118+
})}
119+
</h5>
120+
</div>
121+
) : (
122+
<div className="mx-auto flex w-full max-w-3xl grow flex-col justify-center">
123+
<FileDropzone
124+
acceptedFileTypes={{
125+
'text/csv': ['.csv']
126+
}}
127+
className="flex h-80 w-full flex-col"
128+
file={file}
129+
setFile={setFile}
130+
/>
131+
<div className="mt-4 flex justify-between space-x-2">
132+
<Button disabled={!(file && instrument)} variant={'primary'} onClick={() => void handleInstrumentCSV()}>
133+
{t('core.submit')}
144134
</Button>
135+
<div className="flex justify-between space-x-1">
136+
<Button className="gap-1" disabled={!instrument} variant={'primary'} onClick={handleTemplateDownload}>
137+
<DownloadIcon />
138+
{t({
139+
en: 'Download Template',
140+
fr: 'Télécharger le modèle'
141+
})}
142+
</Button>
143+
<Button
144+
className="gap-1"
145+
disabled={!instrument}
146+
variant={'primary'}
147+
onClick={() => {
148+
window.open('https://opendatacapture.org/en/docs/guides/how-to-upload-data/');
149+
}}
150+
>
151+
<BadgeHelpIcon />
152+
{t({
153+
en: 'Help',
154+
fr: 'Aide'
155+
})}
156+
</Button>
157+
</div>
145158
</div>
146159
</div>
147-
</div>
160+
)
148161
) : (
149162
<>
150163
<div className="mx-auto flex w-full max-w-3xl grow flex-col justify-center">

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "opendatacapture",
33
"type": "module",
4-
"version": "1.10.3",
4+
"version": "1.10.4",
55
"private": true,
66
"packageManager": "pnpm@9.15.4",
77
"license": "Apache-2.0",

packages/instrument-library/src/forms/DNP_HAPPINESS_QUESTIONNAIRE/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineInstrument } from '/runtime/v1/@opendatacapture/runtime-core';
22
import { pick, sum } from '/runtime/v1/lodash-es@4.x';
3-
import { z } from '/runtime/v1/zod@3.x';
3+
import { z } from '/runtime/v1/zod@3.x/v4';
44

55
export default defineInstrument({
66
kind: 'FORM',

0 commit comments

Comments
 (0)