Skip to content

Commit 445f751

Browse files
authored
Merge pull request #1189 from david-roper/zod4-upload
Zod4 Upload changes
2 parents 040b177 + d64af24 commit 445f751

File tree

2 files changed

+444
-61
lines changed

2 files changed

+444
-61
lines changed

apps/web/src/routes/_app/upload/$instrumentId.tsx

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

0 commit comments

Comments
 (0)