[Update] Main Page: Message Input Box Ratio. saveable the ratio.
This commit is contained in:
22
src-ui/logics/main/useMessageInputBoxRatio.js
Normal file
22
src-ui/logics/main/useMessageInputBoxRatio.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { useStore_MessageInputBoxRatio } from "@store";
|
||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||
|
||||
export const useMessageInputBoxRatio = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentMessageInputBoxRatio, updateMessageInputBoxRatio } = useStore_MessageInputBoxRatio();
|
||||
|
||||
const getMessageInputBoxRatio = () => {
|
||||
asyncStdoutToPython("/get/data/message_box_ratio");
|
||||
};
|
||||
|
||||
const setMessageInputBoxRatio = (ratio) => {
|
||||
asyncStdoutToPython("/set/data/message_box_ratio", parseFloat(ratio.toFixed(2)));
|
||||
};
|
||||
|
||||
return {
|
||||
currentMessageInputBoxRatio,
|
||||
getMessageInputBoxRatio,
|
||||
updateMessageInputBoxRatio,
|
||||
setMessageInputBoxRatio,
|
||||
};
|
||||
};
|
||||
@@ -1,12 +1,15 @@
|
||||
import { translator_status } from "@data";
|
||||
|
||||
import { arrayToObject } from "@utils/arrayToObject";
|
||||
import { useMainFunction } from "@logics_main/useMainFunction";
|
||||
|
||||
import { useMessage } from "@logics_common/useMessage";
|
||||
import { useVolume } from "@logics_common/useVolume";
|
||||
|
||||
import { useMainFunction } from "@logics_main/useMainFunction";
|
||||
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
|
||||
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
|
||||
import { useIsMainPageCompactMode } from "@logics_main/useIsMainPageCompactMode";
|
||||
import { useVolume } from "@logics_common/useVolume";
|
||||
import { useMessageInputBoxRatio } from "@logics_main/useMessageInputBoxRatio";
|
||||
|
||||
|
||||
import { useSoftwareVersion } from "@logics_configs/useSoftwareVersion";
|
||||
@@ -67,6 +70,9 @@ export const useReceiveRoutes = () => {
|
||||
updateSpeakerThresholdCheckStatus,
|
||||
} = useVolume();
|
||||
|
||||
const { updateMessageInputBoxRatio } = useMessageInputBoxRatio();
|
||||
|
||||
|
||||
const routes = {
|
||||
// Main Page
|
||||
// Page Controls
|
||||
@@ -118,6 +124,10 @@ export const useReceiveRoutes = () => {
|
||||
"/run/transcription_send_mic_message": addSentMessageLog,
|
||||
"/run/transcription_receive_speaker_message": addReceivedMessageLog,
|
||||
|
||||
// Message Box
|
||||
"/get/data/message_box_ratio": updateMessageInputBoxRatio,
|
||||
"/set/data/message_box_ratio": updateMessageInputBoxRatio,
|
||||
|
||||
|
||||
// Config Page
|
||||
// Common
|
||||
|
||||
Reference in New Issue
Block a user