diff --git a/packaging/update-packagejson.js b/packaging/update-packagejson.js index f996b659..a8378f13 100644 --- a/packaging/update-packagejson.js +++ b/packaging/update-packagejson.js @@ -7,7 +7,7 @@ const teamId = process.env.APPLE_TEAM_ID; if (!teamId) { console.error('TEAM_ID is not defined in the environment variables'); - process.exit(1); + process.exit(0); } if (!process.env.I_AM_TRAVIS) { diff --git a/www/main/navigator/shabad/ShabadText.jsx b/www/main/navigator/shabad/ShabadText.jsx index 7b5bf91b..615a43db 100644 --- a/www/main/navigator/shabad/ShabadText.jsx +++ b/www/main/navigator/shabad/ShabadText.jsx @@ -63,6 +63,10 @@ export const ShabadText = ({ setVerseHistory, setActivePaneId, setShortcuts, + setSundarGutkaBaniId, + setCeremonyId, + setIsCeremonyBani, + setIsSundarGutkaBani, } = useStoreActions((actions) => actions.navigator); const [activeVerse, setActiveVerse] = useState({}); @@ -83,6 +87,15 @@ export const ShabadText = ({ activeShabadId, setActiveShabadId, setPreviousIndex, + baniType, + sundarGutkaBaniId, + setSundarGutkaBaniId, + ceremonyId, + setCeremonyId, + isSundarGutkaBani, + setIsSundarGutkaBani, + isCeremonyBani, + setIsCeremonyBani, }); udpateHistory(shabadId, newTraversedVerse, { verseHistory, @@ -163,8 +176,10 @@ export const ShabadText = ({ updateHomeVerse(initialVerseIndex); setActiveVerse({ [activeVerseIndex]: activeVerseId }); } - if (activeShabadId === null) { - updateTraversedVerse(initialVerseId, initialVerseIndex); + if (activeShabadId === null && sundarGutkaBaniId === null && ceremonyId === null) { + if (initialVerseIndex >= 0) { + updateTraversedVerse(initialVerseId, initialVerseIndex); + } } } }, [filteredItems]); diff --git a/www/main/navigator/shabad/utils/change-verse.js b/www/main/navigator/shabad/utils/change-verse.js index c4557882..d117a664 100644 --- a/www/main/navigator/shabad/utils/change-verse.js +++ b/www/main/navigator/shabad/utils/change-verse.js @@ -31,11 +31,51 @@ export const changeVerse = ( setActiveShabadId, activeShabadId, setPreviousIndex, + baniType, + sundarGutkaBaniId, + setSundarGutkaBaniId, + ceremonyId, + setCeremonyId, + isSundarGutkaBani, + setIsSundarGutkaBani, + isCeremonyBani, + setIsCeremonyBani, }, ) => { - if (clickedShabad !== activeShabadId) { - setActiveShabadId(clickedShabad); - setPreviousIndex(null); + if (baniType === 'bani') { + if (clickedShabad !== sundarGutkaBaniId) { + setSundarGutkaBaniId(clickedShabad); + setPreviousIndex(null); + } + if (!isSundarGutkaBani) { + setIsSundarGutkaBani(true); + } + if (isCeremonyBani) { + setIsCeremonyBani(false); + } + } else if (baniType === 'ceremony') { + if (clickedShabad !== ceremonyId) { + setCeremonyId(clickedShabad); + setPreviousIndex(null); + } + + if (!isSundarGutkaBani) { + setIsSundarGutkaBani(true); + } + if (isCeremonyBani) { + setIsCeremonyBani(false); + } + } else if (baniType === 'shabad') { + if (clickedShabad !== activeShabadId) { + setActiveShabadId(clickedShabad); + setPreviousIndex(null); + } + if (isSundarGutkaBani) { + setIsSundarGutkaBani(false); + } + if (isCeremonyBani) { + setIsCeremonyBani(false); + } } setActiveVerse({ [verseIndex]: newTraversedVerse }); if (activeVerseId !== newTraversedVerse) {