[Update] Config Page: Others Tab. Add section, send message button type.

This commit is contained in:
Sakamoto Shiina
2024-09-08 23:13:18 +09:00
parent 6aa427baec
commit 2b9061d74d
7 changed files with 59 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ import {
useSelectedSpeakerDevice,
useEnableAutoClearMessageBox,
useSendMessageButtonType,
} from "@store";
import { useStdoutToPython } from "./useStdoutToPython";
@@ -25,6 +26,7 @@ export const useConfig = () => {
const { updateSpeakerDeviceList } = useSpeakerDeviceList();
const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice();
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
const { currentSendMessageButtonType, updateSendMessageButtonType } = useSendMessageButtonType();
const asyncPending = () => new Promise(() => {});
@@ -117,6 +119,20 @@ export const useConfig = () => {
updateEnableAutoClearMessageBox(payload.data);
},
getSendMessageButtonType: () => {
updateSendMessageButtonType(asyncPending);
asyncStdoutToPython("/config/send_message_button_type");
},
setSendMessageButtonType: (selected_type) => {
updateSendMessageButtonType(asyncPending);
asyncStdoutToPython("/controller/callback_set_send_message_button_type", selected_type);
},
currentSendMessageButtonType: currentSendMessageButtonType,
updateSendMessageButtonType: (payload) => {
updateSendMessageButtonType(payload.data);
},
};
};