[Refactor] Refactor the way import files.

Organize some codes.
This commit is contained in:
Sakamoto Shiina
2024-10-11 00:23:52 +09:00
parent 4de48edbc1
commit d44c2dd7d9
44 changed files with 157 additions and 114 deletions

View File

@@ -0,0 +1,24 @@
import { useStore_MessageLogUiScaling } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useMessageLogUiScaling = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentMessageLogUiScaling, updateMessageLogUiScaling, pendingMessageLogUiScaling } = useStore_MessageLogUiScaling();
const getMessageLogUiScaling = () => {
pendingMessageLogUiScaling();
asyncStdoutToPython("/get/data/textbox_ui_scaling");
};
const setMessageLogUiScaling = (selected_ui_scaling) => {
pendingMessageLogUiScaling();
asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling);
};
return {
currentMessageLogUiScaling,
getMessageLogUiScaling,
updateMessageLogUiScaling,
setMessageLogUiScaling,
};
};

View File

@@ -0,0 +1,24 @@
import { useStore_SelectedFontFamily } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSelectedFontFamily = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentSelectedFontFamily, updateSelectedFontFamily, pendingSelectedFontFamily } = useStore_SelectedFontFamily();
const getSelectedFontFamily = () => {
pendingSelectedFontFamily();
asyncStdoutToPython("/get/data/font_family");
};
const setSelectedFontFamily = (selected_font_family) => {
pendingSelectedFontFamily();
asyncStdoutToPython("/set/data/font_family", selected_font_family);
};
return {
currentSelectedFontFamily,
getSelectedFontFamily,
updateSelectedFontFamily,
setSelectedFontFamily,
};
};

View File

@@ -0,0 +1,24 @@
import { useStore_SendMessageButtonType } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSendMessageButtonType = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType();
const getSendMessageButtonType = () => {
pendingSendMessageButtonType();
asyncStdoutToPython("/get/data/send_message_button_type");
};
const setSendMessageButtonType = (selected_type) => {
pendingSendMessageButtonType();
asyncStdoutToPython("/set/data/send_message_button_type", selected_type);
};
return {
currentSendMessageButtonType,
getSendMessageButtonType,
setSendMessageButtonType,
updateSendMessageButtonType,
};
};

View File

@@ -0,0 +1,24 @@
import { useStore_Transparency } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useTransparency = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentTransparency, updateTransparency, pendingTransparency } = useStore_Transparency();
const getTransparency = () => {
pendingTransparency();
asyncStdoutToPython("/get/data/transparency");
};
const setTransparency = (selected_transparency) => {
pendingTransparency();
asyncStdoutToPython("/set/data/transparency", selected_transparency);
};
return {
currentTransparency,
getTransparency,
updateTransparency,
setTransparency,
};
};

View File

@@ -0,0 +1,24 @@
import { useStore_UiLanguage } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useUiLanguage = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage();
const getUiLanguage = () => {
pendingUiLanguage();
asyncStdoutToPython("/get/data/ui_language");
};
const setUiLanguage = (selected_ui_language) => {
pendingUiLanguage();
asyncStdoutToPython("/set/data/ui_language", selected_ui_language);
};
return {
currentUiLanguage,
getUiLanguage,
updateUiLanguage,
setUiLanguage,
};
};

View File

@@ -0,0 +1,24 @@
import { useStore_UiScaling } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useUiScaling = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentUiScaling, updateUiScaling, pendingUiScaling } = useStore_UiScaling();
const getUiScaling = () => {
pendingUiScaling();
asyncStdoutToPython("/get/data/ui_scaling");
};
const setUiScaling = (selected_ui_scaling) => {
pendingUiScaling();
asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling);
};
return {
currentUiScaling,
getUiScaling,
updateUiScaling,
setUiScaling,
};
};