Skip to content

Commit

Permalink
added a better user-friendly messages to nugde the user to import at …
Browse files Browse the repository at this point in the history
…least one resource for a Juxtalinear project
  • Loading branch information
danielc-n committed Apr 11, 2024
1 parent 34b9bb8 commit 8e7ca37
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions renderer/src/components/Projects/NewProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default function NewProject({ call, project, closeEdit }) {
setLanguage,
createProject,
setNewProjectFields,
setImportedBookCodes,
},
} = React.useContext(ProjectContext);
const { t } = useTranslation();
Expand Down Expand Up @@ -218,6 +219,7 @@ export default function NewProject({ call, project, closeEdit }) {
setSnackText(status[0].value);
setOpenSnackBar(true);
if (status[0].type === 'success') {
setImportedBookCodes([]);
if (call === 'edit') {
closeEdit();
} else {
Expand Down Expand Up @@ -469,6 +471,8 @@ export default function NewProject({ call, project, closeEdit }) {
>
{t('btn-import-books')}
</button>
{headerDropDown === 'Juxta' && (<span className="text-error">&nbsp;*</span>)}
{headerDropDown === 'Juxta' && (!importedBookCodes || importedBookCodes.length === 0) && (<span className="text-error text-sm">&nbsp;&nbsp;You must provide at least one book resource</span>)}
<ImportPopUp open={openPopUp} closePopUp={closeImportPopUp} projectType={headerDropDown} replaceConformation={callReplace} />
</div>
</div>
Expand Down Expand Up @@ -537,9 +541,14 @@ export default function NewProject({ call, project, closeEdit }) {
/>
<ConfirmationModal
openModal={openModalJuxtaWrongSetOfBooks}
title="Canon specification error"
title={(!importedBookCodes || importedBookCodes.length === 0) ?
'Book resource needed' :
'Canon specification error'}
setOpenModal={setOpenModalJuxtaWrongSetOfBooks}
confirmMessage={'Your imported resources must correspond to your canon specifications'}
confirmMessage={
(!importedBookCodes || importedBookCodes.length === 0) ?
'No resource imported.' :
'Your imported resources must correspond to your canon specifications'}
buttonName={t('btn-ok')}
closeModal={() => {}}
showCancelButton={false}
Expand Down

0 comments on commit 8e7ca37

Please sign in to comment.