From 9dbdf2ffe20365d662c5bcaf65d9c57f1e41f7da Mon Sep 17 00:00:00 2001 From: vzhang03 Date: Fri, 2 Aug 2024 15:19:09 -0400 Subject: [PATCH] Adding in identifier new author buttton and adding oldname to begin saving logic --- .../frontend/src/components/upload/AuthorForm.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/upload/AuthorForm.tsx b/packages/frontend/src/components/upload/AuthorForm.tsx index c37e0a1..09c61da 100644 --- a/packages/frontend/src/components/upload/AuthorForm.tsx +++ b/packages/frontend/src/components/upload/AuthorForm.tsx @@ -12,9 +12,9 @@ const AuthorForm: React.FC = ({ jsPsychMetadata }) => { const [authors, setAuthors] = useState<(AuthorFields)[]>( jsPsychMetadata.getAuthorList().map((author: AuthorFields | string) => { if (typeof author === 'string') { - return { name: author, identifier: '' }; + return { name: author, identifier: '', oldName: author }; // need to check oldName with saving } else { - return author; + return { ...author, oldName: author["name"] }; // need to check oldName when saving } }) ); @@ -31,6 +31,10 @@ const AuthorForm: React.FC = ({ jsPsychMetadata }) => { setAuthors(newAuthors); }; + const addEmptyAuthor = () => { + setAuthors([...authors, { name: '', identifier: '' }]); + }; + return (

Authors

@@ -54,7 +58,10 @@ const AuthorForm: React.FC = ({ jsPsychMetadata }) => {
))} - + ); };