[Update] Resend Message Button: To be store-able the status.
Move to Appearance settings.
This commit is contained in:
@@ -50,7 +50,6 @@ main_page:
|
||||
received: "Received"
|
||||
system: "System"
|
||||
|
||||
show_resend_button: "Show Resend Button"
|
||||
resend_button_on_hover_desc: "Press And Hold To Send"
|
||||
|
||||
state_text_enabled: "Enabled"
|
||||
@@ -120,6 +119,9 @@ config_page:
|
||||
hide: "Hide (Use Enter key to send)"
|
||||
show: "Show"
|
||||
show_and_disable_enter_key: "Show and disable sending using the Enter key."
|
||||
show_resend_button:
|
||||
label: "Show Resend Button"
|
||||
desc: "When hovering over a sent message log, the resend button appears. Click to edit, long press to resend."
|
||||
font_family:
|
||||
label: "Font Family"
|
||||
ui_language:
|
||||
|
||||
@@ -50,7 +50,6 @@ main_page:
|
||||
received: "受信"
|
||||
system: "システム"
|
||||
|
||||
show_resend_button: "再送信ボタンを表示する"
|
||||
resend_button_on_hover_desc: "長押しで送信"
|
||||
|
||||
state_text_enabled: "有効"
|
||||
@@ -120,6 +119,9 @@ config_page:
|
||||
hide: "非表示 (エンターキーを使って送信)"
|
||||
show: "表示"
|
||||
show_and_disable_enter_key: "表示し、エンターキーでの送信を無効"
|
||||
show_resend_button:
|
||||
label: "再送信ボタンを表示する"
|
||||
desc: "送信済メッセージログにマウスホバーすると、再送信ボタンが表示されます。クリックで編集モード、長押しで再送信します。"
|
||||
font_family:
|
||||
label: "使用フォント"
|
||||
ui_language:
|
||||
|
||||
@@ -47,7 +47,6 @@ main_page:
|
||||
received: "수신"
|
||||
system: "시스템"
|
||||
|
||||
show_resend_button:
|
||||
resend_button_on_hover_desc:
|
||||
|
||||
state_text_enabled: "Enabled"
|
||||
|
||||
@@ -47,7 +47,6 @@ main_page:
|
||||
received: "接受"
|
||||
system: "系统"
|
||||
|
||||
show_resend_button:
|
||||
resend_button_on_hover_desc:
|
||||
|
||||
state_text_enabled: "启用"
|
||||
|
||||
@@ -47,7 +47,6 @@ main_page:
|
||||
received: "已接收"
|
||||
system: "系統"
|
||||
|
||||
show_resend_button:
|
||||
resend_button_on_hover_desc:
|
||||
|
||||
state_text_enabled: "啟用"
|
||||
|
||||
@@ -407,6 +407,17 @@ class Config:
|
||||
self._MESSAGE_BOX_RATIO = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value, immediate_save=True)
|
||||
|
||||
@property
|
||||
@json_serializable('SHOW_RESEND_BUTTON')
|
||||
def SHOW_RESEND_BUTTON(self):
|
||||
return self._SHOW_RESEND_BUTTON
|
||||
|
||||
@SHOW_RESEND_BUTTON.setter
|
||||
def SHOW_RESEND_BUTTON(self, value):
|
||||
if isinstance(value, bool):
|
||||
self._SHOW_RESEND_BUTTON = value
|
||||
self.saveConfig(inspect.currentframe().f_code.co_name, value)
|
||||
|
||||
@property
|
||||
@json_serializable('FONT_FAMILY')
|
||||
def FONT_FAMILY(self):
|
||||
@@ -1090,6 +1101,7 @@ class Config:
|
||||
self._UI_SCALING = 100
|
||||
self._TEXTBOX_UI_SCALING = 100
|
||||
self._MESSAGE_BOX_RATIO = 10
|
||||
self._SHOW_RESEND_BUTTON = False
|
||||
self._FONT_FAMILY = "Yu Gothic UI"
|
||||
self._UI_LANGUAGE = "en"
|
||||
self._MAIN_WINDOW_GEOMETRY = {
|
||||
|
||||
@@ -832,6 +832,20 @@ class Controller:
|
||||
config.MESSAGE_BOX_RATIO = data
|
||||
return {"status":200, "result":config.MESSAGE_BOX_RATIO}
|
||||
|
||||
@staticmethod
|
||||
def getShowResendButton(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.SHOW_RESEND_BUTTON}
|
||||
|
||||
@staticmethod
|
||||
def setEnableShowResendButton(*args, **kwargs) -> dict:
|
||||
config.SHOW_RESEND_BUTTON = True
|
||||
return {"status":200, "result":config.SHOW_RESEND_BUTTON}
|
||||
|
||||
@staticmethod
|
||||
def setDisableShowResendButton(*args, **kwargs) -> dict:
|
||||
config.SHOW_RESEND_BUTTON = False
|
||||
return {"status":200, "result":config.SHOW_RESEND_BUTTON}
|
||||
|
||||
@staticmethod
|
||||
def getFontFamily(*args, **kwargs) -> dict:
|
||||
return {"status":200, "result":config.FONT_FAMILY}
|
||||
|
||||
@@ -131,6 +131,10 @@ mapping = {
|
||||
"/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio},
|
||||
"/set/data/message_box_ratio": {"status": True, "variable":controller.setMessageBoxRatio},
|
||||
|
||||
"/get/data/show_resend_button": {"status": True, "variable":controller.getShowResendButton},
|
||||
"/set/enable/show_resend_button": {"status": True, "variable":controller.setEnableShowResendButton},
|
||||
"/set/disable/show_resend_button": {"status": True, "variable":controller.setDisableShowResendButton},
|
||||
|
||||
"/get/data/font_family": {"status": True, "variable":controller.getFontFamily},
|
||||
"/set/data/font_family": {"status": True, "variable":controller.setFontFamily},
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
useUiScaling,
|
||||
useMessageLogUiScaling,
|
||||
useSendMessageButtonType,
|
||||
useShowResendButton,
|
||||
useSelectedFontFamily,
|
||||
useTransparency,
|
||||
} from "@logics_configs";
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
SliderContainer,
|
||||
DropdownMenuContainer,
|
||||
RadioButtonContainer,
|
||||
CheckboxContainer,
|
||||
} from "../_templates/Templates";
|
||||
|
||||
export const Appearance = () => {
|
||||
@@ -31,6 +33,7 @@ export const Appearance = () => {
|
||||
<UiScalingContainer />
|
||||
<MessageLogUiScalingContainer />
|
||||
<SendMessageButtonTypeContainer />
|
||||
<ShowResendButtonContainer />
|
||||
<FontFamilyContainer />
|
||||
<TransparencyContainer />
|
||||
</>
|
||||
@@ -160,6 +163,20 @@ const SendMessageButtonTypeContainer = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const ShowResendButtonContainer = () => {
|
||||
const { t } = useTranslation();
|
||||
const { currentShowResendButton, toggleShowResendButton } = useShowResendButton();
|
||||
|
||||
return (
|
||||
<CheckboxContainer
|
||||
label={t("config_page.appearance.show_resend_button.label")}
|
||||
desc={t("config_page.appearance.show_resend_button.desc")}
|
||||
variable={currentShowResendButton}
|
||||
toggleFunction={toggleShowResendButton}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const FontFamilyContainer = () => {
|
||||
const { t } = useTranslation();
|
||||
const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily();
|
||||
|
||||
@@ -4,7 +4,7 @@ import clsx from "clsx";
|
||||
import styles from "./MessageContainer.module.scss";
|
||||
import { MessageSubMenuContainer } from "./message_sub_menu_container/MessageSubMenuContainer";
|
||||
import { useMessage } from "@logics_common";
|
||||
import { useIsVisibleResendButton } from "@logics_main";
|
||||
import { useShowResendButton } from "@logics_configs";
|
||||
|
||||
export const MessageContainer = ({ messages, status, category, created_at }) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -12,7 +12,7 @@ export const MessageContainer = ({ messages, status, category, created_at }) =>
|
||||
sendMessage,
|
||||
updateMessageInputValue,
|
||||
} = useMessage();
|
||||
const { currentIsVisibleResendButton } = useIsVisibleResendButton();
|
||||
const { currentShowResendButton } = useShowResendButton();
|
||||
const [is_hovered, setIsHovered] = useState(false);
|
||||
const [is_locked, setIsLocked] = useState(false);
|
||||
|
||||
@@ -77,7 +77,7 @@ export const MessageContainer = ({ messages, status, category, created_at }) =>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{currentIsVisibleResendButton.data && is_sent_message && is_hovered ? (
|
||||
{currentShowResendButton.data && is_sent_message && is_hovered ? (
|
||||
<MessageSubMenuContainer
|
||||
setIsHovered={lockHoverState}
|
||||
resendFunction={resendFunction}
|
||||
|
||||
@@ -3,9 +3,7 @@ import styles from "./MessageLogSettingsContainer.module.scss";
|
||||
import clsx from "clsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { useIsVisibleResendButton } from "@logics_main";
|
||||
import { MessageLogUiScalingContainer } from "@setting_box";
|
||||
import { Checkbox } from "@common_components";
|
||||
import ConfigSvg from "@images/configuration.svg?react";
|
||||
|
||||
export const MessageLogSettingsContainer = (props) => {
|
||||
@@ -13,18 +11,12 @@ export const MessageLogSettingsContainer = (props) => {
|
||||
const [is_opened, setIsOpened] = useState(false);
|
||||
const [is_hovered, setIsHovered] = useState(false);
|
||||
|
||||
const { currentIsVisibleResendButton, toggleIsVisibleResendButton } = useIsVisibleResendButton();
|
||||
|
||||
const container_class_name = clsx(styles.container, {
|
||||
[styles.to_visible_toggle_bar]: props.to_visible_toggle_bar,
|
||||
[styles.is_hovered]: is_hovered,
|
||||
[styles.is_opened]: is_opened
|
||||
});
|
||||
|
||||
const toggleVisibleResendButton = () => {
|
||||
toggleIsVisibleResendButton();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={container_class_name}
|
||||
onMouseOver={() => setIsHovered(true)}
|
||||
@@ -38,15 +30,6 @@ export const MessageLogSettingsContainer = (props) => {
|
||||
</div>
|
||||
<MessageLogUiScalingContainer />
|
||||
<div className={styles.others_wrapper}>
|
||||
<div className={styles.resend_checkbox_toggle} onClick={toggleVisibleResendButton}>
|
||||
<p className={styles.resend_checkbox_label}>{t("main_page.message_log.show_resend_button")}</p>
|
||||
<Checkbox
|
||||
id="visible_resend_button"
|
||||
variable={currentIsVisibleResendButton}
|
||||
size="2rem"
|
||||
padding="0"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
28
src-ui/logics/configs/appearance/useShowResendButton.js
Normal file
28
src-ui/logics/configs/appearance/useShowResendButton.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useStore_ShowResendButton } from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
|
||||
export const useShowResendButton = () => {
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { currentShowResendButton, updateShowResendButton, pendingShowResendButton } = useStore_ShowResendButton();
|
||||
|
||||
const getShowResendButton = () => {
|
||||
pendingShowResendButton();
|
||||
asyncStdoutToPython("/get/data/show_resend_button");
|
||||
};
|
||||
|
||||
const toggleShowResendButton = () => {
|
||||
pendingShowResendButton();
|
||||
if (currentShowResendButton.data) {
|
||||
asyncStdoutToPython("/set/disable/show_resend_button");
|
||||
} else {
|
||||
asyncStdoutToPython("/set/enable/show_resend_button");
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
currentShowResendButton,
|
||||
getShowResendButton,
|
||||
updateShowResendButton,
|
||||
toggleShowResendButton,
|
||||
};
|
||||
};
|
||||
@@ -4,6 +4,7 @@ export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling";
|
||||
export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily";
|
||||
export { useTransparency } from "./appearance/useTransparency";
|
||||
export { useSendMessageButtonType } from "./others/useSendMessageButtonType";
|
||||
export { useShowResendButton } from "./appearance/useShowResendButton";
|
||||
export { useUiLanguage } from "./appearance/useUiLanguage";
|
||||
export { useUiScaling } from "./appearance/useUiScaling";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export { useIsVisibleResendButton } from "./useIsVisibleResendButton";
|
||||
export { useIsMainPageCompactMode } from "./useIsMainPageCompactMode";
|
||||
export { useLanguageSettings } from "./useLanguageSettings";
|
||||
export { useMainFunction } from "./useMainFunction";
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { useStore_IsVisibleResendButton } from "@store";
|
||||
|
||||
export const useIsVisibleResendButton = () => {
|
||||
const { currentIsVisibleResendButton, updateIsVisibleResendButton } = useStore_IsVisibleResendButton();
|
||||
|
||||
const toggleIsVisibleResendButton = () => {
|
||||
updateIsVisibleResendButton(!currentIsVisibleResendButton.data);
|
||||
};
|
||||
|
||||
return {
|
||||
currentIsVisibleResendButton,
|
||||
toggleIsVisibleResendButton,
|
||||
updateIsVisibleResendButton,
|
||||
};
|
||||
};
|
||||
@@ -149,6 +149,10 @@ export const ROUTE_META_LIST = [
|
||||
{ endpoint: "/get/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" },
|
||||
{ endpoint: "/set/data/send_message_button_type", ns: configs, hook_name: "useSendMessageButtonType", method_name: "updateSendMessageButtonType" },
|
||||
|
||||
{ endpoint: "/get/data/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" },
|
||||
{ endpoint: "/set/enable/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" },
|
||||
{ endpoint: "/set/disable/show_resend_button", ns: configs, hook_name: "useShowResendButton", method_name: "updateShowResendButton" },
|
||||
|
||||
{ endpoint: "/get/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" },
|
||||
{ endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" },
|
||||
|
||||
|
||||
@@ -172,7 +172,6 @@ export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } =
|
||||
// export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestConversationData(20), "MessageLogs"); // For testing
|
||||
export const { atomInstance: Atom_MessageInputBoxRatio, useHook: useStore_MessageInputBoxRatio } = createAtomWithHook(20, "MessageInputBoxRatio");
|
||||
export const { atomInstance: Atom_MessageInputValue, useHook: useStore_MessageInputValue } = createAtomWithHook("", "MessageInputValue");
|
||||
export const { atomInstance: Atom_IsVisibleResendButton, useHook: useStore_IsVisibleResendButton } = createAtomWithHook(false, "IsVisibleResendButton", {is_state_ok: true});
|
||||
|
||||
|
||||
|
||||
@@ -213,6 +212,7 @@ export const { atomInstance: Atom_UiLanguage, useHook: useStore_UiLanguage } = c
|
||||
export const { atomInstance: Atom_UiScaling, useHook: useStore_UiScaling } = createAtomWithHook(100, "UiScaling");
|
||||
export const { atomInstance: Atom_MessageLogUiScaling, useHook: useStore_MessageLogUiScaling } = createAtomWithHook(100, "MessageLogUiScaling");
|
||||
export const { atomInstance: Atom_SendMessageButtonType, useHook: useStore_SendMessageButtonType } = createAtomWithHook("show", "SendMessageButtonType");
|
||||
export const { atomInstance: Atom_ShowResendButton, useHook: useStore_ShowResendButton } = createAtomWithHook(false, "ShowResendButton");
|
||||
export const { atomInstance: Atom_SelectedFontFamily, useHook: useStore_SelectedFontFamily } = createAtomWithHook("Yu Gothic UI", "SelectedFontFamily");
|
||||
export const { atomInstance: Atom_SelectableFontFamilyList, useHook: useStore_SelectableFontFamilyList } = createAtomWithHook({}, "SelectableFontFamilyList");
|
||||
export const { atomInstance: Atom_Transparency, useHook: useStore_Transparency } = createAtomWithHook(100, "Transparency");
|
||||
|
||||
Reference in New Issue
Block a user