[Update] Add save success notification.
This commit is contained in:
@@ -8,9 +8,13 @@ import {
|
||||
useStore_Transparency,
|
||||
} from "@store";
|
||||
import { useStdoutToPython } from "@useStdoutToPython";
|
||||
import { useI18n } from "@useI18n";
|
||||
import { useNotificationStatus } from "@logics_common";
|
||||
|
||||
export const useAppearance = () => {
|
||||
const { t } = useI18n();
|
||||
const { asyncStdoutToPython } = useStdoutToPython();
|
||||
const { showNotification_SaveSuccess } = useNotificationStatus();
|
||||
|
||||
// UI Language
|
||||
const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage();
|
||||
@@ -39,6 +43,11 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/data/ui_language", selected_ui_language);
|
||||
};
|
||||
|
||||
const setSuccessUiLanguage = (selected_ui_language) => {
|
||||
updateUiLanguage(selected_ui_language);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
// UI Scaling
|
||||
const getUiScaling = () => {
|
||||
pendingUiScaling();
|
||||
@@ -50,6 +59,11 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling);
|
||||
};
|
||||
|
||||
const setSuccessUiScaling = (selected_ui_scaling) => {
|
||||
updateUiScaling(selected_ui_scaling);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
// Message Log Ui Scaling
|
||||
const getMessageLogUiScaling = () => {
|
||||
pendingMessageLogUiScaling();
|
||||
@@ -61,6 +75,11 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling);
|
||||
};
|
||||
|
||||
const setSuccessMessageLogUiScaling = (selected_ui_scaling) => {
|
||||
updateMessageLogUiScaling(selected_ui_scaling);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
// Send Message Button Type
|
||||
const getSendMessageButtonType = () => {
|
||||
pendingSendMessageButtonType();
|
||||
@@ -72,6 +91,11 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type);
|
||||
};
|
||||
|
||||
const setSuccessSendMessageButtonType = (send_message_button_type) => {
|
||||
updateSendMessageButtonType(send_message_button_type);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
// Show Resend Button
|
||||
const getShowResendButton = () => {
|
||||
pendingShowResendButton();
|
||||
@@ -86,6 +110,10 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/enable/show_resend_button");
|
||||
}
|
||||
};
|
||||
const setSuccessShowResendButton = (to_show) => {
|
||||
updateShowResendButton(to_show);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
// Selected Font Family
|
||||
const getSelectedFontFamily = () => {
|
||||
@@ -98,6 +126,11 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/data/font_family", selected_font_family);
|
||||
};
|
||||
|
||||
const setSuccessSelectedFontFamily = (selected_font_family) => {
|
||||
updateSelectedFontFamily(selected_font_family);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
// Transparency
|
||||
const getTransparency = () => {
|
||||
pendingTransparency();
|
||||
@@ -109,6 +142,11 @@ export const useAppearance = () => {
|
||||
asyncStdoutToPython("/set/data/transparency", selected_transparency);
|
||||
};
|
||||
|
||||
const setSuccessTransparency = (selected_transparency) => {
|
||||
updateTransparency(selected_transparency);
|
||||
showNotification_SaveSuccess();
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
// UI Language
|
||||
@@ -116,23 +154,27 @@ export const useAppearance = () => {
|
||||
getUiLanguage,
|
||||
updateUiLanguage,
|
||||
setUiLanguage,
|
||||
setSuccessUiLanguage,
|
||||
|
||||
// UI Scaling
|
||||
currentUiScaling,
|
||||
getUiScaling,
|
||||
updateUiScaling,
|
||||
setUiScaling,
|
||||
setSuccessUiScaling,
|
||||
|
||||
// Message Log Ui Scaling
|
||||
currentMessageLogUiScaling,
|
||||
getMessageLogUiScaling,
|
||||
updateMessageLogUiScaling,
|
||||
setMessageLogUiScaling,
|
||||
setSuccessMessageLogUiScaling,
|
||||
|
||||
// Send Message Button Type
|
||||
currentSendMessageButtonType,
|
||||
getSendMessageButtonType,
|
||||
setSendMessageButtonType,
|
||||
setSuccessSendMessageButtonType,
|
||||
updateSendMessageButtonType,
|
||||
|
||||
// Show Resend Button
|
||||
@@ -140,17 +182,20 @@ export const useAppearance = () => {
|
||||
getShowResendButton,
|
||||
updateShowResendButton,
|
||||
toggleShowResendButton,
|
||||
setSuccessShowResendButton,
|
||||
|
||||
// Selected Font Family
|
||||
currentSelectedFontFamily,
|
||||
getSelectedFontFamily,
|
||||
updateSelectedFontFamily,
|
||||
setSelectedFontFamily,
|
||||
setSuccessSelectedFontFamily,
|
||||
|
||||
// Transparency
|
||||
currentTransparency,
|
||||
getTransparency,
|
||||
updateTransparency,
|
||||
setTransparency,
|
||||
setSuccessTransparency,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user