Merge branch 'adjust_feature_resend_button' into develop

This commit is contained in:
Sakamoto Shiina
2025-06-15 17:52:00 +09:00
17 changed files with 90 additions and 42 deletions

View File

@@ -50,7 +50,6 @@ main_page:
received: "Received" received: "Received"
system: "System" system: "System"
show_resend_button: "Show Resend Button"
resend_button_on_hover_desc: "Press And Hold To Send" resend_button_on_hover_desc: "Press And Hold To Send"
state_text_enabled: "Enabled" state_text_enabled: "Enabled"
@@ -120,6 +119,9 @@ config_page:
hide: "Hide (Use Enter key to send)" hide: "Hide (Use Enter key to send)"
show: "Show" show: "Show"
show_and_disable_enter_key: "Show and disable sending using the Enter key." 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: font_family:
label: "Font Family" label: "Font Family"
ui_language: ui_language:

View File

@@ -50,7 +50,6 @@ main_page:
received: "受信" received: "受信"
system: "システム" system: "システム"
show_resend_button: "再送信ボタンを表示する"
resend_button_on_hover_desc: "長押しで送信" resend_button_on_hover_desc: "長押しで送信"
state_text_enabled: "有効" state_text_enabled: "有効"
@@ -120,6 +119,9 @@ config_page:
hide: "非表示 (エンターキーを使って送信)" hide: "非表示 (エンターキーを使って送信)"
show: "表示" show: "表示"
show_and_disable_enter_key: "表示し、エンターキーでの送信を無効" show_and_disable_enter_key: "表示し、エンターキーでの送信を無効"
show_resend_button:
label: "再送信ボタンを表示する"
desc: "送信済メッセージログにマウスホバーすると、再送信ボタンが表示されます。クリックで編集モード、長押しで再送信します。"
font_family: font_family:
label: "使用フォント" label: "使用フォント"
ui_language: ui_language:

View File

@@ -47,7 +47,6 @@ main_page:
received: "수신" received: "수신"
system: "시스템" system: "시스템"
show_resend_button:
resend_button_on_hover_desc: resend_button_on_hover_desc:
state_text_enabled: "Enabled" state_text_enabled: "Enabled"

View File

@@ -47,7 +47,6 @@ main_page:
received: "接受" received: "接受"
system: "系统" system: "系统"
show_resend_button:
resend_button_on_hover_desc: resend_button_on_hover_desc:
state_text_enabled: "启用" state_text_enabled: "启用"

View File

@@ -47,7 +47,6 @@ main_page:
received: "已接收" received: "已接收"
system: "系統" system: "系統"
show_resend_button:
resend_button_on_hover_desc: resend_button_on_hover_desc:
state_text_enabled: "啟用" state_text_enabled: "啟用"

View File

@@ -407,6 +407,17 @@ class Config:
self._MESSAGE_BOX_RATIO = value self._MESSAGE_BOX_RATIO = value
self.saveConfig(inspect.currentframe().f_code.co_name, value, immediate_save=True) 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 @property
@json_serializable('FONT_FAMILY') @json_serializable('FONT_FAMILY')
def FONT_FAMILY(self): def FONT_FAMILY(self):
@@ -1090,6 +1101,7 @@ class Config:
self._UI_SCALING = 100 self._UI_SCALING = 100
self._TEXTBOX_UI_SCALING = 100 self._TEXTBOX_UI_SCALING = 100
self._MESSAGE_BOX_RATIO = 10 self._MESSAGE_BOX_RATIO = 10
self._SHOW_RESEND_BUTTON = False
self._FONT_FAMILY = "Yu Gothic UI" self._FONT_FAMILY = "Yu Gothic UI"
self._UI_LANGUAGE = "en" self._UI_LANGUAGE = "en"
self._MAIN_WINDOW_GEOMETRY = { self._MAIN_WINDOW_GEOMETRY = {

View File

@@ -832,6 +832,20 @@ class Controller:
config.MESSAGE_BOX_RATIO = data config.MESSAGE_BOX_RATIO = data
return {"status":200, "result":config.MESSAGE_BOX_RATIO} 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 @staticmethod
def getFontFamily(*args, **kwargs) -> dict: def getFontFamily(*args, **kwargs) -> dict:
return {"status":200, "result":config.FONT_FAMILY} return {"status":200, "result":config.FONT_FAMILY}

View File

@@ -131,6 +131,10 @@ mapping = {
"/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio}, "/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio},
"/set/data/message_box_ratio": {"status": True, "variable":controller.setMessageBoxRatio}, "/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}, "/get/data/font_family": {"status": True, "variable":controller.getFontFamily},
"/set/data/font_family": {"status": True, "variable":controller.setFontFamily}, "/set/data/font_family": {"status": True, "variable":controller.setFontFamily},

View File

@@ -14,6 +14,7 @@ import {
useUiScaling, useUiScaling,
useMessageLogUiScaling, useMessageLogUiScaling,
useSendMessageButtonType, useSendMessageButtonType,
useShowResendButton,
useSelectedFontFamily, useSelectedFontFamily,
useTransparency, useTransparency,
} from "@logics_configs"; } from "@logics_configs";
@@ -22,6 +23,7 @@ import {
SliderContainer, SliderContainer,
DropdownMenuContainer, DropdownMenuContainer,
RadioButtonContainer, RadioButtonContainer,
CheckboxContainer,
} from "../_templates/Templates"; } from "../_templates/Templates";
export const Appearance = () => { export const Appearance = () => {
@@ -31,6 +33,7 @@ export const Appearance = () => {
<UiScalingContainer /> <UiScalingContainer />
<MessageLogUiScalingContainer /> <MessageLogUiScalingContainer />
<SendMessageButtonTypeContainer /> <SendMessageButtonTypeContainer />
<ShowResendButtonContainer />
<FontFamilyContainer /> <FontFamilyContainer />
<TransparencyContainer /> <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 FontFamilyContainer = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily(); const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily();

View File

@@ -4,7 +4,7 @@ import clsx from "clsx";
import styles from "./MessageContainer.module.scss"; import styles from "./MessageContainer.module.scss";
import { MessageSubMenuContainer } from "./message_sub_menu_container/MessageSubMenuContainer"; import { MessageSubMenuContainer } from "./message_sub_menu_container/MessageSubMenuContainer";
import { useMessage } from "@logics_common"; import { useMessage } from "@logics_common";
import { useIsVisibleResendButton } from "@logics_main"; import { useShowResendButton } from "@logics_configs";
export const MessageContainer = ({ messages, status, category, created_at }) => { export const MessageContainer = ({ messages, status, category, created_at }) => {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -12,7 +12,7 @@ export const MessageContainer = ({ messages, status, category, created_at }) =>
sendMessage, sendMessage,
updateMessageInputValue, updateMessageInputValue,
} = useMessage(); } = useMessage();
const { currentIsVisibleResendButton } = useIsVisibleResendButton(); const { currentShowResendButton } = useShowResendButton();
const [is_hovered, setIsHovered] = useState(false); const [is_hovered, setIsHovered] = useState(false);
const [is_locked, setIsLocked] = useState(false); const [is_locked, setIsLocked] = useState(false);
@@ -77,7 +77,7 @@ export const MessageContainer = ({ messages, status, category, created_at }) =>
)} )}
</div> </div>
</div> </div>
{currentIsVisibleResendButton.data && is_sent_message && is_hovered ? ( {currentShowResendButton.data && is_sent_message && is_hovered ? (
<MessageSubMenuContainer <MessageSubMenuContainer
setIsHovered={lockHoverState} setIsHovered={lockHoverState}
resendFunction={resendFunction} resendFunction={resendFunction}

View File

@@ -3,9 +3,7 @@ import styles from "./MessageLogSettingsContainer.module.scss";
import clsx from "clsx"; import clsx from "clsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useIsVisibleResendButton } from "@logics_main";
import { MessageLogUiScalingContainer } from "@setting_box"; import { MessageLogUiScalingContainer } from "@setting_box";
import { Checkbox } from "@common_components";
import ConfigSvg from "@images/configuration.svg?react"; import ConfigSvg from "@images/configuration.svg?react";
export const MessageLogSettingsContainer = (props) => { export const MessageLogSettingsContainer = (props) => {
@@ -13,18 +11,12 @@ export const MessageLogSettingsContainer = (props) => {
const [is_opened, setIsOpened] = useState(false); const [is_opened, setIsOpened] = useState(false);
const [is_hovered, setIsHovered] = useState(false); const [is_hovered, setIsHovered] = useState(false);
const { currentIsVisibleResendButton, toggleIsVisibleResendButton } = useIsVisibleResendButton();
const container_class_name = clsx(styles.container, { const container_class_name = clsx(styles.container, {
[styles.to_visible_toggle_bar]: props.to_visible_toggle_bar, [styles.to_visible_toggle_bar]: props.to_visible_toggle_bar,
[styles.is_hovered]: is_hovered, [styles.is_hovered]: is_hovered,
[styles.is_opened]: is_opened [styles.is_opened]: is_opened
}); });
const toggleVisibleResendButton = () => {
toggleIsVisibleResendButton();
};
return ( return (
<div className={container_class_name} <div className={container_class_name}
onMouseOver={() => setIsHovered(true)} onMouseOver={() => setIsHovered(true)}
@@ -38,15 +30,6 @@ export const MessageLogSettingsContainer = (props) => {
</div> </div>
<MessageLogUiScalingContainer /> <MessageLogUiScalingContainer />
<div className={styles.others_wrapper}> <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>
</div> </div>
); );

View 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,
};
};

View File

@@ -4,6 +4,7 @@ export { useMessageLogUiScaling } from "./appearance/useMessageLogUiScaling";
export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily"; export { useSelectedFontFamily } from "./appearance/useSelectedFontFamily";
export { useTransparency } from "./appearance/useTransparency"; export { useTransparency } from "./appearance/useTransparency";
export { useSendMessageButtonType } from "./others/useSendMessageButtonType"; export { useSendMessageButtonType } from "./others/useSendMessageButtonType";
export { useShowResendButton } from "./appearance/useShowResendButton";
export { useUiLanguage } from "./appearance/useUiLanguage"; export { useUiLanguage } from "./appearance/useUiLanguage";
export { useUiScaling } from "./appearance/useUiScaling"; export { useUiScaling } from "./appearance/useUiScaling";

View File

@@ -1,4 +1,3 @@
export { useIsVisibleResendButton } from "./useIsVisibleResendButton";
export { useIsMainPageCompactMode } from "./useIsMainPageCompactMode"; export { useIsMainPageCompactMode } from "./useIsMainPageCompactMode";
export { useLanguageSettings } from "./useLanguageSettings"; export { useLanguageSettings } from "./useLanguageSettings";
export { useMainFunction } from "./useMainFunction"; export { useMainFunction } from "./useMainFunction";

View File

@@ -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,
};
};

View File

@@ -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: "/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: "/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: "/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" }, { endpoint: "/set/data/font_family", ns: configs, hook_name: "useSelectedFontFamily", method_name: "updateSelectedFontFamily" },

View File

@@ -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_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_MessageInputBoxRatio, useHook: useStore_MessageInputBoxRatio } = createAtomWithHook(20, "MessageInputBoxRatio");
export const { atomInstance: Atom_MessageInputValue, useHook: useStore_MessageInputValue } = createAtomWithHook("", "MessageInputValue"); 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_UiScaling, useHook: useStore_UiScaling } = createAtomWithHook(100, "UiScaling");
export const { atomInstance: Atom_MessageLogUiScaling, useHook: useStore_MessageLogUiScaling } = createAtomWithHook(100, "MessageLogUiScaling"); 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_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_SelectedFontFamily, useHook: useStore_SelectedFontFamily } = createAtomWithHook("Yu Gothic UI", "SelectedFontFamily");
export const { atomInstance: Atom_SelectableFontFamilyList, useHook: useStore_SelectableFontFamilyList } = createAtomWithHook({}, "SelectableFontFamilyList"); export const { atomInstance: Atom_SelectableFontFamilyList, useHook: useStore_SelectableFontFamilyList } = createAtomWithHook({}, "SelectableFontFamilyList");
export const { atomInstance: Atom_Transparency, useHook: useStore_Transparency } = createAtomWithHook(100, "Transparency"); export const { atomInstance: Atom_Transparency, useHook: useStore_Transparency } = createAtomWithHook(100, "Transparency");