diff --git a/renderer/src/components/LoadingSpinner/LoadingSpinner.js b/renderer/src/components/LoadingSpinner/LoadingSpinner.js index f520f306c..595e0cab2 100644 --- a/renderer/src/components/LoadingSpinner/LoadingSpinner.js +++ b/renderer/src/components/LoadingSpinner/LoadingSpinner.js @@ -1,7 +1,11 @@ -export default function LoadingSpinner() { +export default function LoadingSpinner({ + height = 'h-10', + width = 'w-10', + colorTW = 'text-primary', +}) { return (
- + diff --git a/renderer/src/core/burrito/importBurrito.js b/renderer/src/core/burrito/importBurrito.js index 2aa7dbcd1..c0a58244e 100644 --- a/renderer/src/core/burrito/importBurrito.js +++ b/renderer/src/core/burrito/importBurrito.js @@ -173,6 +173,16 @@ const updateAudioDir = async (dir, path, fs, status) => { } }; +const checkTheProjectIsAudioChapterLevel = async (metadata) => { + const chapterPathRegex = /^[0-9]{1,3}\.(mp3|wav)/gm; + const chapterLevel = Object.keys(metadata.ingredients).some((path) => { + const pathArr = path.split('/'); + const fileName = pathArr[pathArr.length - 1]; + return chapterPathRegex.test(fileName); +}); + return chapterLevel; +}; + // Core Function Handle Burrito Import for all type of Projects const importBurrito = async (filePath, currentUser, updateBurritoVersion, concatedLangs = []) => { logger.debug('importBurrito.js', 'Inside importBurrito'); @@ -187,6 +197,15 @@ const importBurrito = async (filePath, currentUser, updateBurritoVersion, concat logger.debug('importBurrito.js', 'Project has Burrito file metadata.json.'); let sb = fs.readFileSync(path.join(filePath, 'metadata.json')); let metadata = JSON.parse(sb); + // check if its an audio import and not the import burrito is for chapter level export + if (metadata.type?.flavorType?.flavor?.name === 'audioTranslation') { + const chapterLevel = await checkTheProjectIsAudioChapterLevel(metadata); + if (chapterLevel) { + logger.error('importBurrito.js', 'Import not supported for chapter level audio projects'); + status.push({ type: 'error', value: 'Import not supported for chapter level audio projects' }); + return status; + } + } // Fixing the issue of previous version of AG. The dateCreated was left empty and it will fail the validation. if (!metadata?.meta?.dateCreated) { const agId = Object.keys(metadata?.identification?.primary?.scribe); diff --git a/renderer/src/layouts/projects/Export/ExportProjectPopUp.js b/renderer/src/layouts/projects/Export/ExportProjectPopUp.js index 46969e530..e1e072a7c 100644 --- a/renderer/src/layouts/projects/Export/ExportProjectPopUp.js +++ b/renderer/src/layouts/projects/Export/ExportProjectPopUp.js @@ -11,6 +11,7 @@ import updateTranslationSB from '@/core/burrito/updateTranslationSB'; import updateObsSB from '@/core/burrito/updateObsSB'; import { SnackBar } from '@/components/SnackBar'; // import useSystemNotification from '@/components/hooks/useSystemNotification'; +import { LoadingSpinner } from '@/components/LoadingSpinner'; import CloseIcon from '@/illustrations/close-button-black.svg'; import { validate } from '../../../util/validate'; import * as logger from '../../../logger'; @@ -311,7 +312,7 @@ export default function ExportProjectPopUp(props) { type="button" className="py-2 px-7 rounded shadow bg-success text-white uppercase text-xs tracking-widest font-semibold" > - {t('btn-export')} + {exportStart ? : t('btn-export')}
diff --git a/renderer/src/layouts/projects/ImportProjectPopUp.js b/renderer/src/layouts/projects/ImportProjectPopUp.js index 7224a951c..55879aedb 100644 --- a/renderer/src/layouts/projects/ImportProjectPopUp.js +++ b/renderer/src/layouts/projects/ImportProjectPopUp.js @@ -18,6 +18,7 @@ import * as logger from '../../logger'; import ConfirmationModal from '../editor/ConfirmationModal'; import burrito from '../../lib/BurritoTemplete.json'; import { mergeProject } from './Import/mergeProject'; +import { LoadingSpinner } from '@/components/LoadingSpinner'; export default function ImportProjectPopUp(props) { const { @@ -325,7 +326,9 @@ export default function ImportProjectPopUp(props) { className="py-2 px-7 rounded shadow bg-success text-white uppercase text-xs tracking-widest font-semibold" onClick={() => importProject()} > - {t('btn-import')} + {importProgress.importStarted + ? + : t('btn-import')} )}