diff --git a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js index cc61639f..86b0875c 100644 --- a/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js +++ b/renderer/src/components/EditorPage/AudioEditor/AudioEditor.js @@ -66,8 +66,8 @@ const AudioEditor = ({ editor }) => { const _books = []; Object.entries(_data.type.flavorType.currentScope).forEach( async ([key]) => { - // Checking whether the selected book and chapter is in the scope or not - if (key === bookId.toUpperCase() && _data.type.flavorType.currentScope[key].includes(chapter)) { + // Checking whether the selected book and chapter is in the scope or not + if (key === bookId.toUpperCase() && _data.type.flavorType.currentScope[key].includes(chapter.toString())) { _books.push(bookId.toUpperCase()); const fs = window.require('fs'); const path = require('path'); @@ -130,8 +130,8 @@ const AudioEditor = ({ editor }) => { const arr = folder.match(re); if (arr) { const filePath = path.join(projectsDir, 'audio', 'ingredients', arr[0]); - if (!fs.existsSync(path.join(filePath, chapter))) { - fs.mkdirSync(path.join(filePath, chapter)); + if (!fs.existsSync(path.join(filePath, chapter.toString()))) { + fs.mkdirSync(path.join(filePath, chapter.toString())); } const folderName = fs.readdirSync(filePath); folderName.forEach((chapterNum) => { @@ -178,7 +178,7 @@ const AudioEditor = ({ editor }) => { if (arr || exists) { Object.entries(bookContent).forEach( ([key]) => { - if (bookContent[key].chapterNumber === chapter) { + if (bookContent[key].chapterNumber === chapter.toString()) { // Storing the content in the ReferenceContext for the MainPlayer component setAudioContent(bookContent[key].contents); } diff --git a/renderer/src/components/EditorPage/Navigation/reference/SelectVerse.js b/renderer/src/components/EditorPage/Navigation/reference/SelectVerse.js index ba564b1c..85e20631 100644 --- a/renderer/src/components/EditorPage/Navigation/reference/SelectVerse.js +++ b/renderer/src/components/EditorPage/Navigation/reference/SelectVerse.js @@ -118,8 +118,8 @@ export default function SelectVerse({ key={chapter.key} role="presentation" id={`chapter-${chapter.name}`} - onClick={(e) => { call === 'audio-project' ? (scopedChapters.includes(chapter.name) ? onChapterSelect(e, chapter.key) : '') : onChapterSelect(e, chapter.key); }} - className={call === 'audio-project' ? (scopedChapters.includes(chapter.name) ? styles.select : styles.disabled) : styles.select} + onClick={(e) => { call === 'audio-project' ? (scopedChapters && scopedChapters?.includes(chapter.name) ? onChapterSelect(e, chapter.key) : '') : onChapterSelect(e, chapter.key); }} + className={call === 'audio-project' ? (scopedChapters && scopedChapters?.includes(chapter.name) ? styles.select : styles.disabled) : styles.select} > {chapter.name} diff --git a/renderer/src/core/burrito/createAudioSB.js b/renderer/src/core/burrito/createAudioSB.js index c7012a8d..67777f19 100644 --- a/renderer/src/core/burrito/createAudioSB.js +++ b/renderer/src/core/burrito/createAudioSB.js @@ -57,7 +57,7 @@ const createAudioSB = ( json.copyright.licenses[0].ingredient = 'license.md'; } selectedScope.forEach((scope) => { - json.type.flavorType.currentScope[scope] = []; + json.type.flavorType.currentScope[scope] = json.type.flavorType.currentScope[scope] || []; localizedNames[scope] = json.localizedNames[scope]; }); json.localizedNames = localizedNames; diff --git a/renderer/src/core/projects/saveProjetcsMeta.js b/renderer/src/core/projects/saveProjetcsMeta.js index bd308377..5c74c53d 100644 --- a/renderer/src/core/projects/saveProjetcsMeta.js +++ b/renderer/src/core/projects/saveProjetcsMeta.js @@ -179,7 +179,7 @@ export const saveProjectsMeta = async (projectMetaObj) => { ), JSON.stringify(burritoFile)); // then maybe make a SB usfm - if (type === 'audio') { + if (type === 'Audio') { // Adding text USFM to audio project if ((projectMetaObj.importedFiles).length !== 0) { const newScope = []; @@ -229,6 +229,7 @@ export const saveProjectsMeta = async (projectMetaObj) => { await fs.writeFileSync(path.join( projectDir, `${projectMetaObj.newProjectFields.projectName}_${id}`, + 'text-1', 'metadata.json', ), JSON.stringify(burrito)); });