From 1623352c9277b84d126c13470445cfdf00bd0fa9 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 21 Jun 2025 02:35:41 +0900 Subject: [PATCH 1/2] [Update] Add save success notification. --- .../ReactToastifyOverrideClass.scss | 31 ++++ .../SnackbarController.jsx | 43 +++--- src-ui/logics/_useBackendErrorHandling.js | 6 +- src-ui/logics/common/useNotificationStatus.js | 20 ++- .../advanced_settings/useAdvancedSettings.js | 45 +++++- .../configs/appearance/useAppearance.js | 45 ++++++ src-ui/logics/configs/device/useDevice.js | 79 +++++++++-- src-ui/logics/configs/hotkeys/useHotkeys.js | 8 +- src-ui/logics/configs/others/useOthers.js | 47 ++++++- src-ui/logics/configs/plugins/usePlugins.js | 7 +- .../configs/transcription/useTranscription.js | 55 +++++++- .../configs/translation/useTranslation.js | 31 ++-- src-ui/logics/configs/vr/useVr.js | 35 ++++- src-ui/logics/useReceiveRoutes.js | 132 +++++++++--------- 14 files changed, 440 insertions(+), 144 deletions(-) diff --git a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss index 640a2116..d8d3045e 100644 --- a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss +++ b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss @@ -110,4 +110,35 @@ min-width: 2.8rem; justify-content: center; align-items: center; +} + +@keyframes fade_in { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@keyframes fade_out { + 0% { + opacity: 1; + } + 100% { + opacity: 0; + } +} +.fade_in { + opacity: 0; + animation-name: fade_in; + animation-duration: 0.1s; + animation-timing-function: ease-out; + animation-fill-mode: forwards; +} +.fade_out { + opacity: 1; + animation-name: fade_out; + animation-duration: 0.2s; + animation-timing-function: ease-out; + animation-fill-mode: forwards; } \ No newline at end of file diff --git a/src-ui/app/others/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx index 28bd6325..b617b98a 100644 --- a/src-ui/app/others/snackbar_controller/SnackbarController.jsx +++ b/src-ui/app/others/snackbar_controller/SnackbarController.jsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { ToastContainer, toast, Bounce } from "react-toastify"; +import { ToastContainer, toast, cssTransition } from "react-toastify"; import clsx from "clsx"; import "./ReactToastifyOverrideClass.scss"; @@ -13,6 +13,13 @@ import ErrorSvg from "@images/error.svg?react"; import { useNotificationStatus } from "@logics_common"; +const CustomTransition = cssTransition({ + enter: "fade_in", + exit: "fade_out", + collapse: false, +}); + + export const SnackbarController = () => { const { currentNotificationStatus, closeNotification } = useNotificationStatus(); const [containerKey, setContainerKey] = useState(0); @@ -35,34 +42,22 @@ export const SnackbarController = () => { hideDuration = Number(settings.options?.hide_duration); } + const to_hide_progress_bar = (settings.options?.to_hide_progress_bar === true) ? true : false; + useEffect(() => { if (!settings.is_open) return; const message_text = settings.message; + const category_id = settings.category_id ? settings.category_id : message_text; - if (toast.isActive(message_text)) { - setContainerKey(prevKey => prevKey + 1); + setContainerKey(prevKey => prevKey + 1); - setTimeout(() => { - toast(message_text, { - toastId: message_text, - type: settings.status, - autoClose: hideDuration, - transition: Bounce, - toastClassName: snackbar_classname, - progressClassName: styles.toast_progress, - closeButton: , - onClose: () => { - closeNotification(); - }, - }); - }, 50); - } else { + setTimeout(() => { toast(message_text, { - toastId: message_text, + toastId: category_id, type: settings.status, autoClose: hideDuration, - transition: Bounce, + transition: CustomTransition, toastClassName: snackbar_classname, progressClassName: styles.toast_progress, closeButton: , @@ -70,15 +65,15 @@ export const SnackbarController = () => { closeNotification(); }, }); - } - }, [settings, hideDuration, closeNotification, snackbar_classname]); + }, 50); + }, [settings]); return ( { case "/set/data/deepl_auth_key": if (message === "DeepL auth key length is not correct") { updateDeepLAuthKey(data); - showNotification_Error(t("common_error.deepl_auth_key_invalid_length")); + showNotification_Error(t("common_error.deepl_auth_key_invalid_length"), { category_id: "deepl_auth_key" }); } else if (message === "Authentication failure of deepL auth key") { updateDeepLAuthKey(data); - showNotification_Error(t("common_error.deepl_auth_key_failed_authentication")); + showNotification_Error(t("common_error.deepl_auth_key_failed_authentication"), { category_id: "deepl_auth_key" }); } else { // Exception updateDeepLAuthKey(data); - showNotification_Error(message); + showNotification_Error(message, { category_id: "deepl_auth_key" }); } return; diff --git a/src-ui/logics/common/useNotificationStatus.js b/src-ui/logics/common/useNotificationStatus.js index c623d091..6c9614cd 100644 --- a/src-ui/logics/common/useNotificationStatus.js +++ b/src-ui/logics/common/useNotificationStatus.js @@ -3,13 +3,11 @@ import { useStore_NotificationStatus } from "@store"; export const useNotificationStatus = () => { const { currentNotificationStatus, updateNotificationStatus } = useStore_NotificationStatus(); - const generateRandomKey = () => Math.random(); - const showNotification_Warning = (message, options = {}) => { updateNotificationStatus({ status: "warning", is_open: true, - key: generateRandomKey(), + category_id: (options.category_id) ? options.category_id : null, message: message, options: options, }); @@ -19,7 +17,7 @@ export const useNotificationStatus = () => { updateNotificationStatus({ status: "error", is_open: true, - key: generateRandomKey(), + category_id: (options.category_id) ? options.category_id : null, message: message, options: options, }); @@ -29,12 +27,23 @@ export const useNotificationStatus = () => { updateNotificationStatus({ status: "success", is_open: true, - key: generateRandomKey(), + category_id: (options.category_id) ? options.category_id : null, message: message, options: options, }); }; + const showNotification_SaveSuccess = (options = {}) => { + options = { hide_duration: 2000, to_hide_progress_bar: true, ...options }; + updateNotificationStatus({ + status: "success", + is_open: true, + category_id: (options.category_id) ? options.category_id : null, + message: "設定の適用と、保存が完了しました。", + options: options, + }); + }; + const closeNotification = () => { updateNotificationStatus((prev) => ({ ...prev.data, @@ -49,6 +58,7 @@ export const useNotificationStatus = () => { showNotification_Warning, showNotification_Error, showNotification_Success, + showNotification_SaveSuccess, closeNotification, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js index 327a15a6..7bf5652e 100644 --- a/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js +++ b/src-ui/logics/configs/advanced_settings/useAdvancedSettings.js @@ -10,7 +10,7 @@ import { useNotificationStatus } from "@logics_common"; export const useAdvancedSettings = () => { const { asyncStdoutToPython } = useStdoutToPython(); - const { showNotification_Error } = useNotificationStatus(); + const { showNotification_Error, showNotification_SaveSuccess } = useNotificationStatus(); // OSC IP Address const { currentOscIpAddress, updateOscIpAddress, pendingOscIpAddress } = useStore_OscIpAddress(); @@ -32,6 +32,11 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/osc_ip_address", osc_ip_address); }; + const setSuccessOscIpAddress = (osc_ip_address) => { + updateOscIpAddress(osc_ip_address); + showNotification_SaveSuccess(); + }; + // OSC Port const getOscPort = () => { pendingOscPort(); @@ -43,12 +48,17 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/osc_port", osc_port); }; - const saveErrorOscPort = ({data, message, _result}) => { + const setSuccessOscPort = (osc_port) => { + updateOscPort(osc_port); + showNotification_SaveSuccess(); + }; + + const saveErrorOscPort = ({ data, message, _result }) => { updateOscPort(d => d.data); showNotification_Error(_result); }; - // WebSocket + // WebSocket Enable const getEnableWebsocket = () => { pendingEnableWebsocket(); asyncStdoutToPython("/get/data/websocket_server"); @@ -63,7 +73,12 @@ export const useAdvancedSettings = () => { } }; + const setSuccessEnableWebsocket = (is_enabled) => { + updateEnableWebsocket(is_enabled); + showNotification_SaveSuccess(); + }; + // WebSocket Host const getWebsocketHost = () => { pendingWebsocketHost(); asyncStdoutToPython("/get/data/websocket_host"); @@ -74,7 +89,12 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/websocket_host", websocket_host); }; + const setSuccessWebsocketHost = (websocket_host) => { + updateWebsocketHost(websocket_host); + showNotification_SaveSuccess(); + }; + // WebSocket Port const getWebsocketPort = () => { pendingWebsocketPort(); asyncStdoutToPython("/get/data/websocket_port"); @@ -85,6 +105,10 @@ export const useAdvancedSettings = () => { asyncStdoutToPython("/set/data/websocket_port", websocket_port); }; + const setSuccessWebsocketPort = (websocket_port) => { + updateWebsocketPort(websocket_port); + showNotification_SaveSuccess(); + }; return { // OSC IP Address @@ -92,28 +116,35 @@ export const useAdvancedSettings = () => { getOscIpAddress, updateOscIpAddress, setOscIpAddress, + setSuccessOscIpAddress, // OSC Port currentOscPort, getOscPort, updateOscPort, setOscPort, + setSuccessOscPort, saveErrorOscPort, - // WebSocket + // WebSocket Enable currentEnableWebsocket, - updateEnableWebsocket, getEnableWebsocket, + updateEnableWebsocket, toggleEnableWebsocket, + setSuccessEnableWebsocket, + // WebSocket Host currentWebsocketHost, - updateWebsocketHost, getWebsocketHost, + updateWebsocketHost, setWebsocketHost, + setSuccessWebsocketHost, + // WebSocket Port currentWebsocketPort, - updateWebsocketPort, getWebsocketPort, + updateWebsocketPort, setWebsocketPort, + setSuccessWebsocketPort, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/appearance/useAppearance.js b/src-ui/logics/configs/appearance/useAppearance.js index 582ebf73..dbf5c310 100644 --- a/src-ui/logics/configs/appearance/useAppearance.js +++ b/src-ui/logics/configs/appearance/useAppearance.js @@ -8,9 +8,13 @@ import { useStore_Transparency, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useI18n } from "@useI18n"; +import { useNotificationStatus } from "@logics_common"; export const useAppearance = () => { + const { t } = useI18n(); const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); // UI Language const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage(); @@ -39,6 +43,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/ui_language", selected_ui_language); }; + const setSuccessUiLanguage = (selected_ui_language) => { + updateUiLanguage(selected_ui_language); + showNotification_SaveSuccess(); + }; + // UI Scaling const getUiScaling = () => { pendingUiScaling(); @@ -50,6 +59,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling); }; + const setSuccessUiScaling = (selected_ui_scaling) => { + updateUiScaling(selected_ui_scaling); + showNotification_SaveSuccess(); + }; + // Message Log Ui Scaling const getMessageLogUiScaling = () => { pendingMessageLogUiScaling(); @@ -61,6 +75,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling); }; + const setSuccessMessageLogUiScaling = (selected_ui_scaling) => { + updateMessageLogUiScaling(selected_ui_scaling); + showNotification_SaveSuccess(); + }; + // Send Message Button Type const getSendMessageButtonType = () => { pendingSendMessageButtonType(); @@ -72,6 +91,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type); }; + const setSuccessSendMessageButtonType = (send_message_button_type) => { + updateSendMessageButtonType(send_message_button_type); + showNotification_SaveSuccess(); + }; + // Show Resend Button const getShowResendButton = () => { pendingShowResendButton(); @@ -86,6 +110,10 @@ export const useAppearance = () => { asyncStdoutToPython("/set/enable/show_resend_button"); } }; + const setSuccessShowResendButton = (to_show) => { + updateShowResendButton(to_show); + showNotification_SaveSuccess(); + }; // Selected Font Family const getSelectedFontFamily = () => { @@ -98,6 +126,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/font_family", selected_font_family); }; + const setSuccessSelectedFontFamily = (selected_font_family) => { + updateSelectedFontFamily(selected_font_family); + showNotification_SaveSuccess(); + }; + // Transparency const getTransparency = () => { pendingTransparency(); @@ -109,6 +142,11 @@ export const useAppearance = () => { asyncStdoutToPython("/set/data/transparency", selected_transparency); }; + const setSuccessTransparency = (selected_transparency) => { + updateTransparency(selected_transparency); + showNotification_SaveSuccess(); + }; + return { // UI Language @@ -116,23 +154,27 @@ export const useAppearance = () => { getUiLanguage, updateUiLanguage, setUiLanguage, + setSuccessUiLanguage, // UI Scaling currentUiScaling, getUiScaling, updateUiScaling, setUiScaling, + setSuccessUiScaling, // Message Log Ui Scaling currentMessageLogUiScaling, getMessageLogUiScaling, updateMessageLogUiScaling, setMessageLogUiScaling, + setSuccessMessageLogUiScaling, // Send Message Button Type currentSendMessageButtonType, getSendMessageButtonType, setSendMessageButtonType, + setSuccessSendMessageButtonType, updateSendMessageButtonType, // Show Resend Button @@ -140,17 +182,20 @@ export const useAppearance = () => { getShowResendButton, updateShowResendButton, toggleShowResendButton, + setSuccessShowResendButton, // Selected Font Family currentSelectedFontFamily, getSelectedFontFamily, updateSelectedFontFamily, setSelectedFontFamily, + setSuccessSelectedFontFamily, // Transparency currentTransparency, getTransparency, updateTransparency, setTransparency, + setSuccessTransparency, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/device/useDevice.js b/src-ui/logics/configs/device/useDevice.js index 25a05f1c..b0919ad1 100644 --- a/src-ui/logics/configs/device/useDevice.js +++ b/src-ui/logics/configs/device/useDevice.js @@ -18,9 +18,11 @@ import { } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; import { arrayToObject } from "@utils"; +import { useNotificationStatus } from "@logics_common"; export const useDevice = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); @@ -34,11 +36,11 @@ export const useDevice = () => { const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); - const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); - const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); + const { currentMicThreshold, updateMicThreshold } = useStore_MicThreshold(); + const { currentEnableAutomaticMicThreshold, updateEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); - const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); - const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); + const { currentSpeakerThreshold, updateSpeakerThreshold } = useStore_SpeakerThreshold(); + const { currentEnableAutomaticSpeakerThreshold, updateEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); // Auto Select (Mic) const getEnableAutoMicSelect = () => { @@ -54,6 +56,12 @@ export const useDevice = () => { asyncStdoutToPython("/set/enable/auto_mic_select"); } }; + + const setSuccessEnableAutoMicSelect = (enabled) => { + updateEnableAutoMicSelect(enabled); + showNotification_SaveSuccess(); + }; + // Auto Select (Speaker) const getEnableAutoSpeakerSelect = () => { pendingEnableAutoSpeakerSelect(); @@ -69,6 +77,10 @@ export const useDevice = () => { } }; + const setSuccessEnableAutoSpeakerSelect = (enabled) => { + updateEnableAutoSpeakerSelect(enabled); + showNotification_SaveSuccess(); + }; // List (Mic device) const getMicDeviceList = () => { @@ -79,6 +91,7 @@ export const useDevice = () => { const updateMicDeviceList_FromBackend = (payload) => { updateMicDeviceList(arrayToObject(payload)); }; + // List (Mic host) const getMicHostList = () => { pendingMicHostList(); @@ -88,6 +101,7 @@ export const useDevice = () => { const updateMicHostList_FromBackend = (payload) => { updateMicHostList(arrayToObject(payload)); }; + // List (Speaker device) const getSpeakerDeviceList = () => { pendingSpeakerDeviceList(); @@ -98,7 +112,6 @@ export const useDevice = () => { updateSpeakerDeviceList(arrayToObject(payload)); }; - // Selected (Mic host) const getSelectedMicHost = () => { pendingSelectedMicHost(); @@ -109,6 +122,12 @@ export const useDevice = () => { pendingSelectedMicHost(); asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host); }; + + const setSuccessSelectedMicHost = (payload) => { + updateSelectedMicHostAndDevice(payload); // Receive host and device from backend. + showNotification_SaveSuccess(); + }; + // Selected (Mic device) const getSelectedMicDevice = () => { pendingSelectedMicDevice(); @@ -120,11 +139,16 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device); }; - // Selected (Mic and Host) + const setSuccessSelectedMicDevice = (selected_mic_device) => { + updateSelectedMicDevice(selected_mic_device); + showNotification_SaveSuccess(); + }; + + // Selected (Mic Device and Host) const updateSelectedMicHostAndDevice = (payload) => { updateSelectedMicHost(payload.host); updateSelectedMicDevice(payload.device); - }; + } // Selected (Speaker device) const getSelectedSpeakerDevice = () => { @@ -137,6 +161,10 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device); }; + const setSuccessSelectedSpeakerDevice = (selected_speaker_device) => { + updateSelectedSpeakerDevice(selected_speaker_device); + showNotification_SaveSuccess(); + }; // Threshold (Mic) const getMicThreshold = () => { @@ -147,6 +175,11 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/mic_threshold", mic_threshold); }; + const setSuccessMicThreshold = (mic_threshold) => { + updateMicThreshold(mic_threshold); + showNotification_SaveSuccess(); + }; + const getEnableAutomaticMicThreshold = () => { pendingEnableAutomaticMicThreshold(); asyncStdoutToPython("/get/data/mic_automatic_threshold"); @@ -160,6 +193,12 @@ export const useDevice = () => { asyncStdoutToPython("/set/enable/mic_automatic_threshold"); } }; + + const setSuccessEnableAutomaticMicThreshold = (enabled) => { + updateEnableAutomaticMicThreshold(enabled); + showNotification_SaveSuccess(); + }; + // Threshold (Speaker) const getSpeakerThreshold = () => { asyncStdoutToPython("/get/data/speaker_threshold"); @@ -169,6 +208,11 @@ export const useDevice = () => { asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold); }; + const setSuccessSpeakerThreshold = (speaker_threshold) => { + updateSpeakerThreshold(speaker_threshold); + showNotification_SaveSuccess(); + }; + const getEnableAutomaticSpeakerThreshold = () => { pendingEnableAutomaticSpeakerThreshold(); asyncStdoutToPython("/get/data/speaker_automatic_threshold"); @@ -183,19 +227,23 @@ export const useDevice = () => { } }; - + const setSuccessEnableAutomaticSpeakerThreshold = (enabled) => { + updateEnableAutomaticSpeakerThreshold(enabled); + showNotification_SaveSuccess(); + }; return { currentEnableAutoMicSelect, getEnableAutoMicSelect, updateEnableAutoMicSelect, toggleEnableAutoMicSelect, + setSuccessEnableAutoMicSelect, currentEnableAutoSpeakerSelect, getEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect, - + setSuccessEnableAutoSpeakerSelect, currentMicDeviceList, getMicDeviceList, @@ -212,46 +260,47 @@ export const useDevice = () => { updateSpeakerDeviceList, updateSpeakerDeviceList_FromBackend, - currentSelectedMicHost, getSelectedMicHost, updateSelectedMicHost, setSelectedMicHost, + setSuccessSelectedMicHost, currentSelectedMicDevice, getSelectedMicDevice, updateSelectedMicDevice, setSelectedMicDevice, - + setSuccessSelectedMicDevice, updateSelectedMicHostAndDevice, - currentSelectedSpeakerDevice, getSelectedSpeakerDevice, updateSelectedSpeakerDevice, setSelectedSpeakerDevice, - + setSuccessSelectedSpeakerDevice, currentMicThreshold, getMicThreshold, setMicThreshold, updateMicThreshold, + setSuccessMicThreshold, currentEnableAutomaticMicThreshold, getEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold, updateEnableAutomaticMicThreshold, + setSuccessEnableAutomaticMicThreshold, currentSpeakerThreshold, getSpeakerThreshold, setSpeakerThreshold, updateSpeakerThreshold, + setSuccessSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, getEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold, updateEnableAutomaticSpeakerThreshold, - - + setSuccessEnableAutomaticSpeakerThreshold, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/hotkeys/useHotkeys.js b/src-ui/logics/configs/hotkeys/useHotkeys.js index 20b18732..df7db416 100644 --- a/src-ui/logics/configs/hotkeys/useHotkeys.js +++ b/src-ui/logics/configs/hotkeys/useHotkeys.js @@ -20,7 +20,7 @@ export const useHotkeys = () => { pendingHotkeys(); asyncStdoutToPython("/get/data/hotkeys"); }; - const { showNotification_Success, showNotification_Error, closeNotification } = useNotificationStatus(); + const { showNotification_SaveSuccess, showNotification_Error, closeNotification } = useNotificationStatus(); const setHotkeys = (hotkeys) => { pendingHotkeys(); @@ -106,11 +106,17 @@ export const useHotkeys = () => { } }; + const setSuccessHotkeys = (hotkeys) => { + updateHotkeys(hotkeys); + showNotification_SaveSuccess(); + }; + return { currentHotkeys, getHotkeys, updateHotkeys, setHotkeys, + setSuccessHotkeys, registerShortcuts, unregisterAll, }; diff --git a/src-ui/logics/configs/others/useOthers.js b/src-ui/logics/configs/others/useOthers.js index b9f13612..62a14364 100644 --- a/src-ui/logics/configs/others/useOthers.js +++ b/src-ui/logics/configs/others/useOthers.js @@ -8,6 +8,7 @@ import { useStore_EnableSendReceivedMessageToVrc, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useNotificationStatus } from "@logics_common"; export const useOthers = () => { const { asyncStdoutToPython } = useStdoutToPython(); @@ -29,6 +30,7 @@ export const useOthers = () => { // Send Received Message To VRC const { currentEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, pendingEnableSendReceivedMessageToVrc } = useStore_EnableSendReceivedMessageToVrc(); + const { showNotification_SaveSuccess } = useNotificationStatus(); // Auto Clear Message Input Box const getEnableAutoClearMessageInputBox = () => { @@ -45,6 +47,11 @@ export const useOthers = () => { } }; + const setSuccessEnableAutoClearMessageInputBox = (enabled) => { + updateEnableAutoClearMessageInputBox(enabled); + showNotification_SaveSuccess(); + }; + // Send Only Translated Messages const getEnableSendOnlyTranslatedMessages = () => { pendingEnableSendOnlyTranslatedMessages(); @@ -60,6 +67,11 @@ export const useOthers = () => { } }; + const setSuccessEnableSendOnlyTranslatedMessages = (enabled) => { + updateEnableSendOnlyTranslatedMessages(enabled); + showNotification_SaveSuccess(); + }; + // Auto Export Message Logs const getEnableAutoExportMessageLogs = () => { pendingEnableAutoExportMessageLogs(); @@ -75,6 +87,11 @@ export const useOthers = () => { } }; + const setSuccessEnableAutoExportMessageLogs = (enabled) => { + updateEnableAutoExportMessageLogs(enabled); + showNotification_SaveSuccess(); + }; + // VRC Mic Mute Sync const getEnableVrcMicMuteSync = () => { pendingEnableVrcMicMuteSync(); @@ -90,10 +107,9 @@ export const useOthers = () => { } }; - const updateEnableVrcMicMuteSync_FromBackend = (payload) => { - updateEnableVrcMicMuteSync((old_value) => { - return {...old_value.data, is_enabled: payload}; - }); + const setSuccessEnableVrcMicMuteSync = (is_enabled) => { + updateEnableVrcMicMuteSync(old => ({ ...old.data, is_enabled: is_enabled })); + showNotification_SaveSuccess(); }; // Send Message To VRCT @@ -111,6 +127,11 @@ export const useOthers = () => { } }; + const setSuccessEnableSendMessageToVrc = (enabled) => { + updateEnableSendMessageToVrc(enabled); + showNotification_SaveSuccess(); + }; + // Sounds // Notification VRC SFX const getEnableNotificationVrcSfx = () => { @@ -127,6 +148,11 @@ export const useOthers = () => { } }; + const setSuccessEnableNotificationVrcSfx = (enabled) => { + updateEnableNotificationVrcSfx(enabled); + showNotification_SaveSuccess(); + }; + // Speaker2Chatbox // Send Received Message To VRC const getEnableSendReceivedMessageToVrc = () => { @@ -143,37 +169,46 @@ export const useOthers = () => { } }; + const setSuccessEnableSendReceivedMessageToVrc = (enabled) => { + updateEnableSendReceivedMessageToVrc(enabled); + showNotification_SaveSuccess(); + }; + return { // Auto Clear Message Input Box currentEnableAutoClearMessageInputBox, getEnableAutoClearMessageInputBox, toggleEnableAutoClearMessageInputBox, updateEnableAutoClearMessageInputBox, + setSuccessEnableAutoClearMessageInputBox, // Send Only Translated Messages currentEnableSendOnlyTranslatedMessages, getEnableSendOnlyTranslatedMessages, toggleEnableSendOnlyTranslatedMessages, updateEnableSendOnlyTranslatedMessages, + setSuccessEnableSendOnlyTranslatedMessages, // Auto Export Message Logs currentEnableAutoExportMessageLogs, getEnableAutoExportMessageLogs, toggleEnableAutoExportMessageLogs, updateEnableAutoExportMessageLogs, + setSuccessEnableAutoExportMessageLogs, // VRC Mic Mute Sync currentEnableVrcMicMuteSync, getEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, - updateEnableVrcMicMuteSync_FromBackend, + setSuccessEnableVrcMicMuteSync, // Send Message To VRCT currentEnableSendMessageToVrc, getEnableSendMessageToVrc, toggleEnableSendMessageToVrc, updateEnableSendMessageToVrc, + setSuccessEnableSendMessageToVrc, // Sounds // Notification VRC SFX @@ -181,6 +216,7 @@ export const useOthers = () => { getEnableNotificationVrcSfx, toggleEnableNotificationVrcSfx, updateEnableNotificationVrcSfx, + setSuccessEnableNotificationVrcSfx, // Speaker2Chatbox // Send Received Message To VRC @@ -188,5 +224,6 @@ export const useOthers = () => { getEnableSendReceivedMessageToVrc, toggleEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, + setSuccessEnableSendReceivedMessageToVrc, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js index e22c2aff..42f7d5a9 100644 --- a/src-ui/logics/configs/plugins/usePlugins.js +++ b/src-ui/logics/configs/plugins/usePlugins.js @@ -37,7 +37,7 @@ const PLUGIN_LIST_URL = getPluginsList(); export const usePlugins = () => { const { t, i18n } = useI18n(); - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + const { showNotification_SaveSuccess, showNotification_Success, showNotification_Error } = useNotificationStatus(); const { asyncStdoutToPython } = useStdoutToPython(); const { currentFetchedPluginsInfo, updateFetchedPluginsInfo, pendingFetchedPluginsInfo, errorFetchedPluginsInfo } = useStore_FetchedPluginsInfo(); @@ -371,6 +371,10 @@ export const usePlugins = () => { }); } + const setSuccessSavedPluginsStatus = (plugins_status) => { + updateSavedPluginsStatus(plugins_status); + showNotification_SaveSuccess(); + }; return { @@ -385,6 +389,7 @@ export const usePlugins = () => { currentSavedPluginsStatus, updateSavedPluginsStatus, + setSuccessSavedPluginsStatus, currentPluginsData, updatePluginsData, diff --git a/src-ui/logics/configs/transcription/useTranscription.js b/src-ui/logics/configs/transcription/useTranscription.js index 2079780c..0c4b8b2b 100644 --- a/src-ui/logics/configs/transcription/useTranscription.js +++ b/src-ui/logics/configs/transcription/useTranscription.js @@ -17,9 +17,11 @@ import { } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; import { transformToIndexedArray } from "@utils"; +import { useNotificationStatus } from "@logics_common"; export const useTranscription = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); // Mic const { currentMicRecordTimeout, updateMicRecordTimeout, pendingMicRecordTimeout } = useStore_MicRecordTimeout(); @@ -39,7 +41,6 @@ export const useTranscription = () => { const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList(); const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice(); - // Mic const getMicRecordTimeout = () => { pendingMicRecordTimeout(); @@ -51,6 +52,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_record_timeout", selected_mic_record_timeout); }; + const setSuccessMicRecordTimeout = (value) => { + updateMicRecordTimeout(value); + showNotification_SaveSuccess(); + }; const getMicPhraseTimeout = () => { pendingMicPhraseTimeout(); @@ -62,6 +67,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_phrase_timeout", selected_mic_phrase_timeout); }; + const setSuccessMicPhraseTimeout = (value) => { + updateMicPhraseTimeout(value); + showNotification_SaveSuccess(); + }; const getMicMaxWords = () => { pendingMicMaxWords(); @@ -73,6 +82,11 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_max_phrases", selected_mic_max_phrases); }; + const setSuccessMicMaxWords = (value) => { + updateMicMaxWords(value); + showNotification_SaveSuccess(); + }; + const getMicWordFilterList = () => { pendingMicWordFilterList(); asyncStdoutToPython("/get/data/mic_word_filter"); @@ -83,7 +97,7 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); }; - const updateMicWordFilterList_FromBackend = (payload) => { + const setSuccessMicWordFilterList = (payload) => { updateMicWordFilterList((prev_list) => { const updated_list = [...prev_list.data]; for (const value of payload) { @@ -96,6 +110,7 @@ export const useTranscription = () => { } return updated_list; }); + showNotification_SaveSuccess(); }; // Speaker @@ -109,6 +124,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/speaker_record_timeout", selected_speaker_record_timeout); }; + const setSuccessSpeakerRecordTimeout = (value) => { + updateSpeakerRecordTimeout(value); + showNotification_SaveSuccess(); + }; const getSpeakerPhraseTimeout = () => { pendingSpeakerPhraseTimeout(); @@ -120,6 +139,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/speaker_phrase_timeout", selected_speaker_phrase_timeout); }; + const setSuccessSpeakerPhraseTimeout = (value) => { + updateSpeakerPhraseTimeout(value); + showNotification_SaveSuccess(); + }; const getSpeakerMaxWords = () => { pendingSpeakerMaxWords(); @@ -131,6 +154,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/speaker_max_phrases", selected_speaker_max_phrases); }; + const setSuccessSpeakerMaxWords = (value) => { + updateSpeakerMaxWords(value); + showNotification_SaveSuccess(); + }; // Transcription Engines // Transcription Engines (Google / Whisper) @@ -144,6 +171,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/selected_transcription_engine", selected_transcription_engine); }; + const setSuccessSelectedTranscriptionEngine = (engine) => { + updateSelectedTranscriptionEngine(engine); + showNotification_SaveSuccess(); + }; // Transcription Engines (Weight Type List) const updateDownloadedWhisperWeightTypeStatus = (downloaded_weight_type_status) => { @@ -199,6 +230,10 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/whisper_weight_type", selected_whisper_weight_type); }; + const setSuccessSelectedWhisperWeightType = (wt) => { + updateSelectedWhisperWeightType(wt); + showNotification_SaveSuccess(); + }; // Transcription Engines (Compute Device List) const getSelectableWhisperComputeDeviceList = () => { @@ -221,50 +256,62 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device); }; + const setSuccessSelectedWhisperComputeDevice = (dev) => { + updateSelectedWhisperComputeDevice(dev); + showNotification_SaveSuccess(); + }; + return { // Mic currentMicRecordTimeout, getMicRecordTimeout, updateMicRecordTimeout, setMicRecordTimeout, + setSuccessMicRecordTimeout, currentMicPhraseTimeout, getMicPhraseTimeout, updateMicPhraseTimeout, setMicPhraseTimeout, + setSuccessMicPhraseTimeout, currentMicMaxWords, getMicMaxWords, updateMicMaxWords, setMicMaxWords, + setSuccessMicMaxWords, currentMicWordFilterList, getMicWordFilterList, updateMicWordFilterList, setMicWordFilterList, - updateMicWordFilterList_FromBackend, + setSuccessMicWordFilterList, // Speaker currentSpeakerRecordTimeout, getSpeakerRecordTimeout, updateSpeakerRecordTimeout, setSpeakerRecordTimeout, + setSuccessSpeakerRecordTimeout, currentSpeakerPhraseTimeout, getSpeakerPhraseTimeout, updateSpeakerPhraseTimeout, setSpeakerPhraseTimeout, + setSuccessSpeakerPhraseTimeout, currentSpeakerMaxWords, getSpeakerMaxWords, updateSpeakerMaxWords, setSpeakerMaxWords, + setSuccessSpeakerMaxWords, // Transcription Engines currentSelectedTranscriptionEngine, getSelectedTranscriptionEngine, updateSelectedTranscriptionEngine, setSelectedTranscriptionEngine, + setSuccessSelectedTranscriptionEngine, currentWhisperWeightTypeStatus, updateWhisperWeightTypeStatus, @@ -278,6 +325,7 @@ export const useTranscription = () => { getSelectedWhisperWeightType, updateSelectedWhisperWeightType, setSelectedWhisperWeightType, + setSuccessSelectedWhisperWeightType, currentSelectableWhisperComputeDeviceList, getSelectableWhisperComputeDeviceList, @@ -288,5 +336,6 @@ export const useTranscription = () => { getSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, setSelectedWhisperComputeDevice, + setSuccessSelectedWhisperComputeDevice, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/translation/useTranslation.js b/src-ui/logics/configs/translation/useTranslation.js index 77747256..b282bf90 100644 --- a/src-ui/logics/configs/translation/useTranslation.js +++ b/src-ui/logics/configs/translation/useTranslation.js @@ -13,7 +13,7 @@ import { useNotificationStatus } from "@logics_common"; export const useTranslation = () => { const { t } = useI18n(); const { asyncStdoutToPython } = useStdoutToPython(); - const { showNotification_Success, showNotification_Error } = useNotificationStatus(); + const { showNotification_SaveSuccess } = useNotificationStatus(); const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus(); const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType(); @@ -74,6 +74,11 @@ export const useTranslation = () => { asyncStdoutToPython("/set/data/ctranslate2_weight_type", selected_ctranslate2_weight_type); }; + const setSuccessSelectedCTranslate2WeightType = (selected_ctranslate2_weight_type) => { + updateSelectedCTranslate2WeightType(selected_ctranslate2_weight_type); + showNotification_SaveSuccess(); + }; + const getSelectableCTranslate2ComputeDeviceList = () => { pendingSelectableCTranslate2ComputeDeviceList(); @@ -95,6 +100,11 @@ export const useTranslation = () => { asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device); }; + const setSuccessSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => { + updateSelectedCTranslate2ComputeDevice(selected_translation_compute_device); + showNotification_SaveSuccess(); + }; + const getDeepLAuthKey = () => { pendingDeepLAuthKey(); @@ -106,17 +116,18 @@ export const useTranslation = () => { asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key); }; + const setSuccessDeepLAuthKey = (data) => { + updateDeepLAuthKey(data); + showNotification_SaveSuccess(t("config_page.translation.deepl_auth_key.auth_key_success"), { category_id: "deepl_auth_key" }); + }; + const deleteDeepLAuthKey = () => { pendingDeepLAuthKey(); asyncStdoutToPython("/delete/data/deepl_auth_key"); }; - const deletedDeepLAuthKey = () => { - updateDeepLAuthKey(""); - }; - const savedDeepLAuthKey = (data) => { - updateDeepLAuthKey(data); - showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success")); + const deleteSuccessDeepLAuthKey = () => { + updateDeepLAuthKey(""); }; @@ -133,6 +144,7 @@ export const useTranslation = () => { getSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, setSelectedCTranslate2WeightType, + setSuccessSelectedCTranslate2WeightType, currentSelectableCTranslate2ComputeDeviceList, getSelectableCTranslate2ComputeDeviceList, @@ -143,13 +155,14 @@ export const useTranslation = () => { getSelectedCTranslate2ComputeDevice, updateSelectedCTranslate2ComputeDevice, setSelectedCTranslate2ComputeDevice, + setSuccessSelectedCTranslate2ComputeDevice, currentDeepLAuthKey, getDeepLAuthKey, updateDeepLAuthKey, setDeepLAuthKey, deleteDeepLAuthKey, - deletedDeepLAuthKey, - savedDeepLAuthKey, + deleteSuccessDeepLAuthKey, + setSuccessDeepLAuthKey, }; }; \ No newline at end of file diff --git a/src-ui/logics/configs/vr/useVr.js b/src-ui/logics/configs/vr/useVr.js index 2f5dd9eb..ee65c538 100644 --- a/src-ui/logics/configs/vr/useVr.js +++ b/src-ui/logics/configs/vr/useVr.js @@ -6,9 +6,11 @@ import { useStore_OverlayShowOnlyTranslatedMessages, } from "@store"; import { useStdoutToPython } from "@useStdoutToPython"; +import { useNotificationStatus } from "@logics_common"; export const useVr = () => { const { asyncStdoutToPython } = useStdoutToPython(); + const { showNotification_SaveSuccess } = useNotificationStatus(); const { currentIsEnabledOverlaySmallLog, updateIsEnabledOverlaySmallLog, pendingIsEnabledOverlaySmallLog } = useStore_IsEnabledOverlaySmallLog(); const { currentIsEnabledOverlayLargeLog, updateIsEnabledOverlayLargeLog, pendingIsEnabledOverlayLargeLog } = useStore_IsEnabledOverlayLargeLog(); @@ -16,7 +18,6 @@ export const useVr = () => { const { currentOverlayLargeLogSettings, updateOverlayLargeLogSettings, pendingOverlayLargeLogSettings } = useStore_OverlayLargeLogSettings(); const { currentOverlayShowOnlyTranslatedMessages, updateOverlayShowOnlyTranslatedMessages, pendingOverlayShowOnlyTranslatedMessages } = useStore_OverlayShowOnlyTranslatedMessages(); - const getIsEnabledOverlaySmallLog = () => { pendingIsEnabledOverlaySmallLog(); asyncStdoutToPython("/get/data/overlay_small_log"); @@ -31,6 +32,10 @@ export const useVr = () => { } }; + const setSuccessIsEnabledOverlaySmallLog = (enabled) => { + updateIsEnabledOverlaySmallLog(enabled); + showNotification_SaveSuccess(); + }; const getIsEnabledOverlayLargeLog = () => { pendingIsEnabledOverlayLargeLog(); @@ -46,6 +51,10 @@ export const useVr = () => { } }; + const setSuccessIsEnabledOverlayLargeLog = (enabled) => { + updateIsEnabledOverlayLargeLog(enabled); + showNotification_SaveSuccess(); + }; const getOverlaySmallLogSettings = () => { // pendingOverlaySmallLogSettings(); @@ -57,6 +66,10 @@ export const useVr = () => { asyncStdoutToPython("/set/data/overlay_small_log_settings", overlay_small_log_settings); }; + const setSuccessOverlaySmallLogSettings = (settings) => { + updateOverlaySmallLogSettings(settings); + showNotification_SaveSuccess(); + }; const getOverlayLargeLogSettings = () => { // pendingOverlayLargeLogSettings(); @@ -68,6 +81,10 @@ export const useVr = () => { asyncStdoutToPython("/set/data/overlay_large_log_settings", overlay_large_log_settings); }; + const setSuccessOverlayLargeLogSettings = (settings) => { + updateOverlayLargeLogSettings(settings); + showNotification_SaveSuccess(); + }; const getOverlayShowOnlyTranslatedMessages = () => { pendingOverlayShowOnlyTranslatedMessages(); @@ -83,37 +100,45 @@ export const useVr = () => { } }; + const setSuccessOverlayShowOnlyTranslatedMessages = (enabled) => { + updateOverlayShowOnlyTranslatedMessages(enabled); + showNotification_SaveSuccess(); + }; const sendTextToOverlay = (text) => { asyncStdoutToPython("/run/send_text_overlay", text); }; - return { currentIsEnabledOverlaySmallLog, getIsEnabledOverlaySmallLog, - updateIsEnabledOverlaySmallLog, toggleIsEnabledOverlaySmallLog, + updateIsEnabledOverlaySmallLog, + setSuccessIsEnabledOverlaySmallLog, currentIsEnabledOverlayLargeLog, getIsEnabledOverlayLargeLog, - updateIsEnabledOverlayLargeLog, toggleIsEnabledOverlayLargeLog, + updateIsEnabledOverlayLargeLog, + setSuccessIsEnabledOverlayLargeLog, currentOverlaySmallLogSettings, getOverlaySmallLogSettings, updateOverlaySmallLogSettings, setOverlaySmallLogSettings, + setSuccessOverlaySmallLogSettings, currentOverlayLargeLogSettings, getOverlayLargeLogSettings, updateOverlayLargeLogSettings, setOverlayLargeLogSettings, + setSuccessOverlayLargeLogSettings, currentOverlayShowOnlyTranslatedMessages, getOverlayShowOnlyTranslatedMessages, - updateOverlayShowOnlyTranslatedMessages, toggleOverlayShowOnlyTranslatedMessages, + updateOverlayShowOnlyTranslatedMessages, + setSuccessOverlayShowOnlyTranslatedMessages, sendTextToOverlay, }; diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index a956ba6e..5c0e78e1 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -92,25 +92,25 @@ export const ROUTE_META_LIST = [ // Config Page // Device { endpoint: "/get/data/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, - { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoMicSelect" }, + { endpoint: "/set/enable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoMicSelect" }, + { endpoint: "/set/disable/auto_mic_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoMicSelect" }, { endpoint: "/get/data/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, - { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutoSpeakerSelect" }, + { endpoint: "/set/enable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoSpeakerSelect" }, + { endpoint: "/set/disable/auto_speaker_select", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutoSpeakerSelect" }, // Device (Mic) { endpoint: "/get/data/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, { endpoint: "/run/mic_host_list", ns: configs, hook_name: "useDevice", method_name: "updateMicHostList_FromBackend" }, { endpoint: "/get/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHost" }, - { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, + { endpoint: "/set/data/selected_mic_host", ns: configs, hook_name: "useDevice", method_name: "setSuccessSelectedMicHost" }, { endpoint: "/get/data/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, { endpoint: "/run/mic_device_list", ns: configs, hook_name: "useDevice", method_name: "updateMicDeviceList_FromBackend" }, { endpoint: "/get/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, - { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicDevice" }, + { endpoint: "/set/data/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "setSuccessSelectedMicDevice" }, { endpoint: "/run/selected_mic_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedMicHostAndDevice" }, @@ -119,54 +119,54 @@ export const ROUTE_META_LIST = [ { endpoint: "/run/speaker_device_list", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerDeviceList_FromBackend" }, { endpoint: "/get/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, - { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, + { endpoint: "/set/data/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "setSuccessSelectedSpeakerDevice" }, { endpoint: "/run/selected_speaker_device", ns: configs, hook_name: "useDevice", method_name: "updateSelectedSpeakerDevice" }, // Device (Threshold) { endpoint: "/get/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, - { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateMicThreshold" }, + { endpoint: "/set/data/mic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessMicThreshold" }, { endpoint: "/get/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, - { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "updateSpeakerThreshold" }, + { endpoint: "/set/data/speaker_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessSpeakerThreshold" }, { endpoint: "/get/data/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, - { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticMicThreshold" }, + { endpoint: "/set/enable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticMicThreshold" }, + { endpoint: "/set/disable/mic_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticMicThreshold" }, { endpoint: "/get/data/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, - { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "updateEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/enable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticSpeakerThreshold" }, + { endpoint: "/set/disable/speaker_automatic_threshold", ns: configs, hook_name: "useDevice", method_name: "setSuccessEnableAutomaticSpeakerThreshold" }, // Appearance { endpoint: "/get/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, - { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "updateUiLanguage" }, + { endpoint: "/set/data/ui_language", ns: configs, hook_name: "useAppearance", method_name: "setSuccessUiLanguage" }, { endpoint: "/get/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateUiScaling" }, - { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateUiScaling" }, + { endpoint: "/set/data/ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "setSuccessUiScaling" }, { endpoint: "/get/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateMessageLogUiScaling" }, - { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "updateMessageLogUiScaling" }, + { endpoint: "/set/data/textbox_ui_scaling", ns: configs, hook_name: "useAppearance", method_name: "setSuccessMessageLogUiScaling" }, { endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "updateSendMessageButtonType" }, - { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "updateSendMessageButtonType" }, + { endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useAppearance", method_name: "setSuccessSendMessageButtonType" }, { endpoint: "/get/data/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, - { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, - { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "updateShowResendButton" }, + { endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "setSuccessShowResendButton" }, + { endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useAppearance", method_name: "setSuccessShowResendButton" }, { endpoint: "/get/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "updateSelectedFontFamily" }, - { endpoint: "/set/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "updateSelectedFontFamily" }, + { endpoint: "/set/data/font_family", ns: configs, hook_name: "useAppearance", method_name: "setSuccessSelectedFontFamily" }, { endpoint: "/get/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" }, - { endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "updateTransparency" }, + { endpoint: "/set/data/transparency", ns: configs, hook_name: "useAppearance", method_name: "setSuccessTransparency" }, // Translation { endpoint: "/get/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "updateDeepLAuthKey" }, - { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "savedDeepLAuthKey" }, - { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deletedDeepLAuthKey" }, + { endpoint: "/set/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "setSuccessDeepLAuthKey" }, + { endpoint: "/delete/data/deepl_auth_key", ns: configs, hook_name: "useTranslation", method_name: "deleteSuccessDeepLAuthKey" }, // Translation (AI Models) { endpoint: "/get/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, - { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2WeightType" }, + { endpoint: "/set/data/ctranslate2_weight_type", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2WeightType" }, { endpoint: "/get/data/selectable_ctranslate2_weight_type_dict", ns: configs, hook_name: "useTranslation", method_name: "updateDownloadedCTranslate2WeightTypeStatus" }, @@ -177,39 +177,39 @@ export const ROUTE_META_LIST = [ { endpoint: "/get/data/translation_compute_device_list", ns: configs, hook_name: "useTranslation", method_name: "updateSelectableCTranslate2ComputeDeviceList_FromBackend" }, { endpoint: "/get/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, - { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "updateSelectedCTranslate2ComputeDevice" }, + { endpoint: "/set/data/selected_translation_compute_device", ns: configs, hook_name: "useTranslation", method_name: "setSuccessSelectedCTranslate2ComputeDevice" }, // Transcription // Transcription (Mic) { endpoint: "/get/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, - { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicRecordTimeout" }, + { endpoint: "/set/data/mic_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicRecordTimeout" }, { endpoint: "/get/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicPhraseTimeout" }, - { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateMicPhraseTimeout" }, + { endpoint: "/set/data/mic_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicPhraseTimeout" }, { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, - { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, + { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicMaxWords" }, - { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList_FromBackend" }, - { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList_FromBackend" }, + { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList" }, + { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicWordFilterList" }, // Transcription (Speaker) { endpoint: "/get/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, - { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerRecordTimeout" }, + { endpoint: "/set/data/speaker_record_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerRecordTimeout" }, { endpoint: "/get/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerPhraseTimeout" }, - { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerPhraseTimeout" }, + { endpoint: "/set/data/speaker_phrase_timeout", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerPhraseTimeout" }, { endpoint: "/get/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerMaxWords" }, - { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateSpeakerMaxWords" }, + { endpoint: "/set/data/speaker_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSpeakerMaxWords" }, // Transcription (AI Models) { endpoint: "/get/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, - { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedTranscriptionEngine" }, + { endpoint: "/set/data/selected_transcription_engine", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedTranscriptionEngine" }, { endpoint: "/get/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, - { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperWeightType" }, + { endpoint: "/set/data/whisper_weight_type", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperWeightType" }, { endpoint: "/get/data/selectable_whisper_weight_type_dict", ns: configs, hook_name: "useTranscription", method_name: "updateDownloadedWhisperWeightTypeStatus" }, @@ -219,84 +219,84 @@ export const ROUTE_META_LIST = [ { endpoint: "/get/data/transcription_compute_device_list", ns: configs, hook_name: "useTranscription", method_name: "updateSelectableWhisperComputeDeviceList_FromBackend" }, { endpoint: "/get/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, - { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "updateSelectedWhisperComputeDevice" }, + { endpoint: "/set/data/selected_transcription_compute_device", ns: configs, hook_name: "useTranscription", method_name: "setSuccessSelectedWhisperComputeDevice" }, // VR { endpoint: "/get/data/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, - { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlaySmallLog" }, + { endpoint: "/set/enable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlaySmallLog" }, + { endpoint: "/set/disable/overlay_small_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlaySmallLog" }, { endpoint: "/get/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlaySmallLogSettings" }, - { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlaySmallLogSettings" }, + { endpoint: "/set/data/overlay_small_log_settings", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlaySmallLogSettings" }, { endpoint: "/get/data/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, - { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "updateIsEnabledOverlayLargeLog" }, + { endpoint: "/set/enable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlayLargeLog" }, + { endpoint: "/set/disable/overlay_large_log", ns: configs, hook_name: "useVr", method_name: "setSuccessIsEnabledOverlayLargeLog" }, { endpoint: "/get/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlayLargeLogSettings" }, - { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "updateOverlayLargeLogSettings" }, + { endpoint: "/set/data/overlay_large_log_settings", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlayLargeLogSettings" }, { endpoint: "/get/data/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, - { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, - { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "updateOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/enable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlayShowOnlyTranslatedMessages" }, + { endpoint: "/set/disable/overlay_show_only_translated_messages", ns: configs, hook_name: "useVr", method_name: "setSuccessOverlayShowOnlyTranslatedMessages" }, { endpoint: "/run/send_text_overlay", ns: null, hook_name: null, method_name: null }, // Others { endpoint: "/get/data/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, - { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoClearMessageInputBox" }, + { endpoint: "/set/enable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoClearMessageInputBox" }, + { endpoint: "/set/disable/auto_clear_message_box", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoClearMessageInputBox" }, { endpoint: "/get/data/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, - { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/enable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendOnlyTranslatedMessages" }, + { endpoint: "/set/disable/send_only_translated_messages", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendOnlyTranslatedMessages" }, { endpoint: "/get/data/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, - { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "updateEnableAutoExportMessageLogs" }, + { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoExportMessageLogs" }, + { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoExportMessageLogs" }, { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, - { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, + { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, { endpoint: "/get/data/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, - { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendMessageToVrc" }, + { endpoint: "/set/enable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendMessageToVrc" }, + { endpoint: "/set/disable/send_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendMessageToVrc" }, { endpoint: "/get/data/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, - { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "updateEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/enable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendReceivedMessageToVrc" }, + { endpoint: "/set/disable/send_received_message_to_vrc", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableSendReceivedMessageToVrc" }, { endpoint: "/get/data/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, - { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, - { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "updateEnableNotificationVrcSfx" }, + { endpoint: "/set/enable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableNotificationVrcSfx" }, + { endpoint: "/set/disable/notification_vrc_sfx", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableNotificationVrcSfx" }, // Hotkeys { endpoint: "/get/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, - { endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "updateHotkeys" }, + { endpoint: "/set/data/hotkeys", ns: configs, hook_name: "useHotkeys", method_name: "setSuccessHotkeys" }, // Plugins { endpoint: "/get/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, - { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "updateSavedPluginsStatus" }, + { endpoint: "/set/data/plugins_status", ns: configs, hook_name: "usePlugins", method_name: "setSuccessSavedPluginsStatus" }, // Advanced Settings { endpoint: "/get/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, - { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscIpAddress" }, + { endpoint: "/set/data/osc_ip_address", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessOscIpAddress" }, { endpoint: "/get/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscPort" }, - { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateOscPort" }, + { endpoint: "/set/data/osc_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessOscPort" }, { endpoint: "/get/data/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, - { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, - { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateEnableWebsocket" }, + { endpoint: "/set/enable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessEnableWebsocket" }, + { endpoint: "/set/disable/websocket_server", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessEnableWebsocket" }, { endpoint: "/get/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketHost" }, - { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketHost" }, + { endpoint: "/set/data/websocket_host", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessWebsocketHost" }, { endpoint: "/get/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketPort" }, - { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "updateWebsocketPort" }, + { endpoint: "/set/data/websocket_port", ns: configs, hook_name: "useAdvancedSettings", method_name: "setSuccessWebsocketPort" }, // Not Implemented Yet... From e02ed917210ef59771a6a0f0ab32ebf718712241 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sat, 21 Jun 2025 09:38:38 +0900 Subject: [PATCH 2/2] [Update/bugfix] Notification UI: Adjust an animation. Add localizations. Fix stack behavior that was not updated correctly. (it still has an issue tho.) --- locales/en.yml | 3 ++ locales/ja.yml | 3 ++ .../ReactToastifyOverrideClass.scss | 4 +- .../SnackbarController.jsx | 46 +++++++++++-------- src-ui/logics/common/useNotificationStatus.js | 8 ++-- src-ui/logics/configs/plugins/usePlugins.js | 10 ++-- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/locales/en.yml b/locales/en.yml index 24bb73a8..9e133bed 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -269,6 +269,9 @@ config_page: websocket_port: label: "WebSocket Port" + notifications: + save_success: "Settings have been saved" + plugin_notifications: downloading: Downloading the plugin. downloaded_success: Downloaded successfully. diff --git a/locales/ja.yml b/locales/ja.yml index bd0ffe60..b2ff2ad8 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -269,6 +269,9 @@ config_page: websocket_port: label: "WebSocket Port" + notifications: + save_success: "設定を保存しました。" + plugin_notifications: downloading: プラグインをダウンロード中。 downloaded_success: プラグインのダウンロードが完了しました。 diff --git a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss index d8d3045e..5e0a2539 100644 --- a/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss +++ b/src-ui/app/others/snackbar_controller/ReactToastifyOverrideClass.scss @@ -138,7 +138,7 @@ .fade_out { opacity: 1; animation-name: fade_out; - animation-duration: 0.2s; - animation-timing-function: ease-out; + animation-duration: 0.1s; + animation-timing-function: ease-in; animation-fill-mode: forwards; } \ No newline at end of file diff --git a/src-ui/app/others/snackbar_controller/SnackbarController.jsx b/src-ui/app/others/snackbar_controller/SnackbarController.jsx index b617b98a..fe692c10 100644 --- a/src-ui/app/others/snackbar_controller/SnackbarController.jsx +++ b/src-ui/app/others/snackbar_controller/SnackbarController.jsx @@ -35,14 +35,13 @@ export const SnackbarController = () => { } ); - let hideDuration = 5000; + let hide_duration = 5000; if (settings.options?.hide_duration === null) { - hideDuration = false; + hide_duration = false; } else if (Number(settings.options?.hide_duration)) { - hideDuration = Number(settings.options?.hide_duration); + hide_duration = Number(settings.options?.hide_duration); } - const to_hide_progress_bar = (settings.options?.to_hide_progress_bar === true) ? true : false; useEffect(() => { if (!settings.is_open) return; @@ -50,22 +49,29 @@ export const SnackbarController = () => { const message_text = settings.message; const category_id = settings.category_id ? settings.category_id : message_text; - setContainerKey(prevKey => prevKey + 1); + const to_hide_progress_bar = (settings.options?.to_hide_progress_bar === true) ? true : false; + + const asyncShowNotification = async () => { + setTimeout(() => { + toast(message_text, { + toastId: category_id, + type: settings.status, + autoClose: hide_duration, + transition: CustomTransition, + toastClassName: snackbar_classname, + hideProgressBar: to_hide_progress_bar, + progressClassName: styles.toast_progress, + closeButton: , + onClose: () => { + closeNotification(); + }, + }); + }, 100); + }; + + setContainerKey(prevKey => prevKey + 1); + asyncShowNotification(); - setTimeout(() => { - toast(message_text, { - toastId: category_id, - type: settings.status, - autoClose: hideDuration, - transition: CustomTransition, - toastClassName: snackbar_classname, - progressClassName: styles.toast_progress, - closeButton: , - onClose: () => { - closeNotification(); - }, - }); - }, 50); }, [settings]); return ( @@ -73,7 +79,7 @@ export const SnackbarController = () => { key={containerKey} position="bottom-left" transition={CustomTransition} - hideProgressBar={to_hide_progress_bar} + hideProgressBar={false} newestOnTop={false} closeOnClick={false} pauseOnFocusLoss={false} diff --git a/src-ui/logics/common/useNotificationStatus.js b/src-ui/logics/common/useNotificationStatus.js index 6c9614cd..9667aaba 100644 --- a/src-ui/logics/common/useNotificationStatus.js +++ b/src-ui/logics/common/useNotificationStatus.js @@ -1,7 +1,9 @@ import { useStore_NotificationStatus } from "@store"; +import { useI18n } from "@useI18n"; export const useNotificationStatus = () => { const { currentNotificationStatus, updateNotificationStatus } = useStore_NotificationStatus(); + const { t } = useI18n(); const showNotification_Warning = (message, options = {}) => { updateNotificationStatus({ @@ -34,12 +36,12 @@ export const useNotificationStatus = () => { }; const showNotification_SaveSuccess = (options = {}) => { - options = { hide_duration: 2000, to_hide_progress_bar: true, ...options }; + options = { hide_duration: 1000, to_hide_progress_bar: true, ...options }; updateNotificationStatus({ status: "success", is_open: true, - category_id: (options.category_id) ? options.category_id : null, - message: "設定の適用と、保存が完了しました。", + category_id: "save_success", + message: t("config_page.notifications.save_success"), options: options, }); }; diff --git a/src-ui/logics/configs/plugins/usePlugins.js b/src-ui/logics/configs/plugins/usePlugins.js index 42f7d5a9..a467aeb7 100644 --- a/src-ui/logics/configs/plugins/usePlugins.js +++ b/src-ui/logics/configs/plugins/usePlugins.js @@ -283,6 +283,10 @@ export const usePlugins = () => { }; const toggleSavedPluginsStatus = (target_plugin_id) => { + const successPluginNotification = (message) => showNotification_Success(message, { + hide_duration: 1000, + category_id: "to_enable_plugin" + }); const is_exists = currentSavedPluginsStatus.data.some( (d) => d.plugin_id === target_plugin_id ); @@ -292,8 +296,8 @@ export const usePlugins = () => { if (d.plugin_id === target_plugin_id) { d.is_enabled = !d.is_enabled; (d.is_enabled) - ? showNotification_Success(t("plugin_notifications.is_enabled")) - : showNotification_Success(t("plugin_notifications.is_disabled")); + ? successPluginNotification(t("plugin_notifications.is_enabled")) + : successPluginNotification(t("plugin_notifications.is_disabled")); } return d; }); @@ -303,7 +307,7 @@ export const usePlugins = () => { plugin_id: target_plugin_id, is_enabled: true, }); - showNotification_Success(t("plugin_notifications.is_enabled")) + successPluginNotification(t("plugin_notifications.is_enabled")) } // 「currentPluginsData.data」でis_downloadedがtrueのものだけ残す