From d7cf2425a13d0e677a1e27e1208e779128efb5c2 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Sun, 13 Oct 2024 07:11:47 +0900 Subject: [PATCH] [Refactor] Remove the codes that is no longer in use and organize a bit. --- .../setting_box/appearance/Appearance.jsx | 76 +++---------------- .../setting_box/device/Device.jsx | 34 ++++----- .../setting_box/others/Others.jsx | 4 - src-ui/logics/useReceiveRoutes.js | 7 -- src-ui/store.js | 1 - 5 files changed, 24 insertions(+), 98 deletions(-) diff --git a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx index e5993713..54bb5abe 100644 --- a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx @@ -1,32 +1,22 @@ import clsx from "clsx"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import styles from "./Appearance.module.scss"; -import { useSettingBox } from "../components/useSettingBox"; - +import { LabelComponent } from "../components/label_component/LabelComponent"; +import { + SliderContainer, + DropdownMenuContainer, +} from "../components/useSettingBox"; +import { useStore_SelectableFontFamilyList } from "@store"; import { useUiLanguage, useUiScaling, useMessageLogUiScaling, useSelectedFontFamily, useTransparency, - // useRestoreWindowGeometry, } from "@logics_configs"; export const Appearance = () => { - const { t } = useTranslation(); - const { - // DropdownMenuContainer, - // SliderContainer, - // CheckboxContainer, - // SwitchboxContainer, - // EntryContainer, - // ThresholdContainer, - // RadioButtonContainer, - // DeeplAuthKeyContainer, - // WordFilterContainer, - // ActionButtonContainer, - } = useSettingBox(); - return ( <> @@ -34,38 +24,13 @@ export const Appearance = () => { - {/* */} - - - - {/* - - - - - - - - - - - - - - - - {}}/> */} - ); }; -import { LabelComponent } from "../components/label_component/LabelComponent"; - const UiLanguageContainer = () => { const { t } = useTranslation(); const { currentUiLanguage, setUiLanguage } = useUiLanguage(); - const SELECTABLE_UI_LANGUAGES_DICT = { en: "English", ja: "日本語", @@ -73,7 +38,6 @@ const UiLanguageContainer = () => { "zh-Hant": "繁體中文", }; - const is_not_en_lang = currentUiLanguage.data !== "en" && currentUiLanguage.data !== undefined; return (
@@ -106,10 +70,6 @@ const UiLanguageContainer = () => { ); }; - -import { SliderContainer } from "../components/useSettingBox"; - -import { useEffect, useState } from "react"; const UiScalingContainer = () => { const { t } = useTranslation(); const { currentUiScaling, setUiScaling } = useUiScaling(); @@ -192,8 +152,7 @@ const MessageLogUiScalingContainer = () => { /> ); }; -import { useStore_SelectableFontFamilyList } from "@store"; -import { DropdownMenuContainer } from "../components/useSettingBox"; + const FontFamilyContainer = () => { const { t } = useTranslation(); const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily(); @@ -216,7 +175,6 @@ const FontFamilyContainer = () => { ); }; - const TransparencyContainer = () => { const { t } = useTranslation(); const { currentTransparency, setTransparency } = useTransparency(); @@ -255,20 +213,4 @@ const TransparencyContainer = () => { track={false} /> ); -}; - -// import { CheckboxContainer } from "../components/useSettingBox"; - -// const RestoreWindowGeometryContainer = () => { -// const { t } = useTranslation(); -// const { currentRestoreWindowGeometry, toggleRestoreWindowGeometry } = useRestoreWindowGeometry(); - -// return ( -// -// ); -// }; \ No newline at end of file +}; \ No newline at end of file diff --git a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx index f26a34c8..48d7a62e 100644 --- a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx @@ -1,18 +1,6 @@ import clsx from "clsx"; import { useTranslation } from "react-i18next"; import styles from "./Device.module.scss"; -import { - useOnMouseLeaveDropdownMenu, -} from "../components/useSettingBox"; -export const Device = () => { - return ( - <> - - - - ); -}; - import { useEnableAutoMicSelect, useMicHostList, @@ -25,17 +13,28 @@ import { useSelectedSpeakerDevice, useSpeakerThreshold, } from "@logics_configs"; - +import { + useOnMouseLeaveDropdownMenu, +} from "../components/useSettingBox"; import { LabelComponent } from "../components/label_component/LabelComponent"; import { DropdownMenu } from "../components/dropdown_menu/DropdownMenu"; import { ThresholdComponent } from "../components/threshold_component/ThresholdComponent"; import { Switchbox } from "../components/switchbox/Switchbox"; +export const Device = () => { + return ( + <> + + + + ); +}; + const Mic_Container = () => { const { t } = useTranslation(); const { currentEnableAutoMicSelect, toggleEnableAutoMicSelect } = useEnableAutoMicSelect(); const { currentSelectedMicHost, setSelectedMicHost } = useSelectedMicHost(); - const { currentMicHostList, getMicHostList } = useMicHostList(); + const { currentMicHostList } = useMicHostList(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold(); @@ -47,7 +46,7 @@ const Mic_Container = () => { const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "pending"; const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice(); - const { currentMicDeviceList, getMicDeviceList } = useMicDeviceList(); + const { currentMicDeviceList } = useMicDeviceList(); const selectFunction_device = (selected_data) => { setSelectedMicDevice(selected_data.selected_id); @@ -89,7 +88,6 @@ const Mic_Container = () => { selected_id={currentSelectedMicHost.data} list={currentMicHostList.data} selectFunction={selectFunction_host} - // openListFunction={getMicHostList} state={currentSelectedMicHost.state} style={{ maxWidth: "20rem", minWidth: "10rem" }} is_disabled={is_disabled_selector} @@ -103,7 +101,6 @@ const Mic_Container = () => { selected_id={currentSelectedMicDevice.data} list={currentMicDeviceList.data} selectFunction={selectFunction_device} - // openListFunction={getMicDeviceList} state={currentSelectedMicDevice.state} is_disabled={is_disabled_selector} /> @@ -135,7 +132,7 @@ const Speaker_Container = () => { const { t } = useTranslation(); const { currentEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect(); const { currentSelectedSpeakerDevice, setSelectedSpeakerDevice } = useSelectedSpeakerDevice(); - const { currentSpeakerDeviceList, getSpeakerDeviceList } = useSpeakerDeviceList(); + const { currentSpeakerDeviceList } = useSpeakerDeviceList(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); const { currentEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold } = useSpeakerThreshold(); @@ -182,7 +179,6 @@ const Speaker_Container = () => { selected_id={currentSelectedSpeakerDevice.data} list={currentSpeakerDeviceList.data} selectFunction={selectFunction} - // openListFunction={getSpeakerDeviceList} state={currentSelectedSpeakerDevice.state} is_disabled={is_disabled_selector} /> diff --git a/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx b/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx index 09864c98..a85c1837 100644 --- a/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx +++ b/src-ui/app/config_page/setting_section/setting_box/others/Others.jsx @@ -1,9 +1,5 @@ import { useTranslation } from "react-i18next"; import { useSettingBox } from "../components/useSettingBox"; -// import { -// useStore_EnableAutoClearMessageBox, -// } from "@store"; - import { useConfig } from "@logics/useConfig"; export const Others = () => { diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index a76e1447..c879706c 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -34,7 +34,6 @@ import { useUiScaling, useMessageLogUiScaling, useTransparency, - // useRestoreWindowGeometry, } from "@logics_configs"; export const useReceiveRoutes = () => { @@ -85,8 +84,6 @@ export const useReceiveRoutes = () => { const { updateMessageInputBoxRatio } = useMessageInputBoxRatio(); const { updateSelectedFontFamily } = useSelectedFontFamily(); const { updateTransparency } = useTransparency(); - // const { updateRestoreWindowGeometry } = useRestoreWindowGeometry(); - const routes = { // Common @@ -230,10 +227,6 @@ export const useReceiveRoutes = () => { "/get/data/transparency": updateTransparency, "/set/data/transparency": updateTransparency, - // "/get/data/restore_main_window_geometry": updateRestoreWindowGeometry, - // "/set/enable/restore_main_window_geometry": updateRestoreWindowGeometry, - // "/set/disable/restore_main_window_geometry": updateRestoreWindowGeometry, - // Others Tab "/get/data/auto_clear_message_box": updateEnableAutoClearMessageBox, "/set/enable/auto_clear_message_box": updateEnableAutoClearMessageBox, diff --git a/src-ui/store.js b/src-ui/store.js index 870cb963..e104d8af 100644 --- a/src-ui/store.js +++ b/src-ui/store.js @@ -99,7 +99,6 @@ const createAtomWithHook = (initialValue, base_name, options) => { // Common -// export const { atomInstance: Atom_RestoreWindowGeometry, useHook: useStore_RestoreWindowGeometry } = createAtomWithHook(true, "RestoreWindowGeometry"); export const { atomInstance: Atom_IsOpenedConfigPage, useHook: useStore_IsOpenedConfigPage } = createAtomWithHook(false, "IsOpenedConfigPage"); export const { atomInstance: Atom_MainFunctionsStateMemory, useHook: useStore_MainFunctionsStateMemory } = createAtomWithHook({ transcription_send: false,