Skip to content
Snippets Groups Projects
Commit a1fb0394 authored by Marjolaine Bodin's avatar Marjolaine Bodin
Browse files

#843 add multiple references

parent 0a0791d0
No related branches found
No related tags found
1 merge request!742Resolve "DOI add multiple reference URLs"
Pipeline #231193 passed
...@@ -117,19 +117,23 @@ export function MintDOIModal({ ...@@ -117,19 +117,23 @@ export function MintDOIModal({
</div> </div>
</li> </li>
)} )}
{data.referenceURL && ( {data.referenceURLs && (
<li className="p-2"> <li className="p-2">
<strong>Reference URL</strong>: Check that the external <strong>Reference URLs</strong>: : Check that the external
reference URL is correct. reference URLs are correct.
<div className="fst-italic"> <ul className="fst-italic">
<a {data.referenceURLs.map((referenceURL: any, index: any) => (
href={data.referenceURL} <li key={`reference-${index}`}>
target={'_blank'} <a
rel="noreferrer" href={referenceURL}
> target={'_blank'}
{data.referenceURL} rel="noreferrer"
</a> >
</div> {referenceURL}
</a>
</li>
))}
</ul>
</li> </li>
)} )}
</ul> </ul>
......
...@@ -109,7 +109,7 @@ type FormType = { ...@@ -109,7 +109,7 @@ type FormType = {
}[]; }[];
keywords?: { keyword: string }[]; keywords?: { keyword: string }[];
citationPublicationDOI?: string; citationPublicationDOI?: string;
referenceURL?: string; referenceURLs?: { referenceURL: string }[];
}; };
function FormSection({ function FormSection({
...@@ -252,20 +252,30 @@ function FormSection({ ...@@ -252,20 +252,30 @@ function FormSection({
return undefined; return undefined;
}, },
}, },
referenceURL: { referenceURLs: {
type: 'url', type: 'array',
label: 'External reference URL (PDB,...)', label: 'External reference URLs (PDB,...)',
validate: (value?: string) => { item: {
if (value === undefined || !value?.length) { referenceURL: (v) => ({
return undefined; type: 'url',
} label: 'Reference URL',
try { required: true,
new URL(value); validate: (value?: string) => {
return undefined; if (value === undefined || !value?.length) {
} catch { return undefined;
return 'Invalid URL'; }
} try {
new URL(value);
return undefined;
} catch {
return 'Invalid URL';
}
},
}),
}, },
newItem: () => ({
referenceURL: '',
}),
}, },
}; };
...@@ -338,6 +348,9 @@ function FormSection({ ...@@ -338,6 +348,9 @@ function FormSection({
keywords: data.keywords?.map((k) => { keywords: data.keywords?.map((k) => {
return k.keyword; return k.keyword;
}), }),
referenceURLs: data.referenceURLs?.map((url) => {
return url.referenceURL;
}),
}; };
handleClick({ ...postData }, clearForm, onErrorCallBack); handleClick({ ...postData }, clearForm, onErrorCallBack);
}} }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment