[Update] UI: Add disable translation function when config page has opened.
This commit is contained in:
@@ -15,8 +15,14 @@ import { useStore_MainFunctionsStateMemory } from "@store";
|
|||||||
|
|
||||||
export const ConfigPageCloseTriggerController = () => {
|
export const ConfigPageCloseTriggerController = () => {
|
||||||
const { currentIsOpenedConfigPage } = useIsOpenedConfigPage();
|
const { currentIsOpenedConfigPage } = useIsOpenedConfigPage();
|
||||||
const { currentMainFunctionsStateMemory, updateMainFunctionsStateMemory} = useStore_MainFunctionsStateMemory();
|
|
||||||
const {
|
const {
|
||||||
|
currentMainFunctionsStateMemory,
|
||||||
|
updateMainFunctionsStateMemory,
|
||||||
|
} = useStore_MainFunctionsStateMemory();
|
||||||
|
|
||||||
|
const {
|
||||||
|
currentTranslationStatus,
|
||||||
|
setTranslation,
|
||||||
currentTranscriptionSendStatus,
|
currentTranscriptionSendStatus,
|
||||||
setTranscriptionSend,
|
setTranscriptionSend,
|
||||||
currentTranscriptionReceiveStatus,
|
currentTranscriptionReceiveStatus,
|
||||||
@@ -34,12 +40,14 @@ export const ConfigPageCloseTriggerController = () => {
|
|||||||
|
|
||||||
const memorizeLatestMainFunctionsState = () => {
|
const memorizeLatestMainFunctionsState = () => {
|
||||||
updateMainFunctionsStateMemory({
|
updateMainFunctionsStateMemory({
|
||||||
|
translation: currentTranslationStatus.data,
|
||||||
transcription_send: currentTranscriptionSendStatus.data,
|
transcription_send: currentTranscriptionSendStatus.data,
|
||||||
transcription_receive: currentTranscriptionReceiveStatus.data,
|
transcription_receive: currentTranscriptionReceiveStatus.data,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const restoreMainFunctionState = () => {
|
const restoreMainFunctionState = () => {
|
||||||
|
if (currentMainFunctionsStateMemory.data.translation === true) setTranslation(true);
|
||||||
if (currentMainFunctionsStateMemory.data.transcription_send === true) setTranscriptionSend(true);
|
if (currentMainFunctionsStateMemory.data.transcription_send === true) setTranscriptionSend(true);
|
||||||
if (currentMainFunctionsStateMemory.data.transcription_receive === true) setTranscriptionReceive(true);
|
if (currentMainFunctionsStateMemory.data.transcription_receive === true) setTranscriptionReceive(true);
|
||||||
};
|
};
|
||||||
@@ -48,6 +56,7 @@ export const ConfigPageCloseTriggerController = () => {
|
|||||||
if (currentIsOpenedConfigPage.data === true) { // When config page is opened.
|
if (currentIsOpenedConfigPage.data === true) { // When config page is opened.
|
||||||
memorizeLatestMainFunctionsState();
|
memorizeLatestMainFunctionsState();
|
||||||
unregisterAll();
|
unregisterAll();
|
||||||
|
if (currentTranslationStatus.data === true) setTranslation(false);
|
||||||
if (currentTranscriptionSendStatus.data === true) setTranscriptionSend(false);
|
if (currentTranscriptionSendStatus.data === true) setTranscriptionSend(false);
|
||||||
if (currentTranscriptionReceiveStatus.data === true) setTranscriptionReceive(false);
|
if (currentTranscriptionReceiveStatus.data === true) setTranscriptionReceive(false);
|
||||||
} else if (currentIsOpenedConfigPage.data === false) { // When config page is closed.
|
} else if (currentIsOpenedConfigPage.data === false) { // When config page is closed.
|
||||||
|
|||||||
Reference in New Issue
Block a user