[Update] Config Page: Add Others Tab. Add section Auto Clear Message Box.

This commit is contained in:
Sakamoto Shiina
2024-09-08 17:43:54 +09:00
parent 33cd7b442d
commit 28a602e01e
7 changed files with 83 additions and 14 deletions

View File

@@ -6,6 +6,8 @@ import {
useSelectedMicDevice,
useSpeakerDeviceList,
useSelectedSpeakerDevice,
useEnableAutoClearMessageBox,
} from "@store";
import { useStdoutToPython } from "./useStdoutToPython";
@@ -22,6 +24,7 @@ export const useConfig = () => {
const { updateSelectedMicDevice } = useSelectedMicDevice();
const { updateSpeakerDeviceList } = useSpeakerDeviceList();
const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice();
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
const asyncPending = () => new Promise(() => {});
@@ -95,5 +98,21 @@ export const useConfig = () => {
},
// Others
toggleEnableAutoClearMessageBox: () => {
updateEnableAutoClearMessageBox(asyncPending);
if (currentEnableAutoClearMessageBox.data) {
asyncStdoutToPython("/controller/callback_disable_auto_clear_chatbox");
} else {
asyncStdoutToPython("/controller/callback_enable_auto_clear_chatbox");
}
},
currentEnableAutoClearMessageBox: currentEnableAutoClearMessageBox,
updateEnableAutoClearMessageBox: (payload) => {
updateEnableAutoClearMessageBox(payload.data);
},
};
};