[Refactor] Remove the codes that is no longer in use and organize a bit.
This commit is contained in:
@@ -1,32 +1,22 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import styles from "./Appearance.module.scss";
|
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 {
|
import {
|
||||||
useUiLanguage,
|
useUiLanguage,
|
||||||
useUiScaling,
|
useUiScaling,
|
||||||
useMessageLogUiScaling,
|
useMessageLogUiScaling,
|
||||||
useSelectedFontFamily,
|
useSelectedFontFamily,
|
||||||
useTransparency,
|
useTransparency,
|
||||||
// useRestoreWindowGeometry,
|
|
||||||
} from "@logics_configs";
|
} from "@logics_configs";
|
||||||
|
|
||||||
export const Appearance = () => {
|
export const Appearance = () => {
|
||||||
const { t } = useTranslation();
|
|
||||||
const {
|
|
||||||
// DropdownMenuContainer,
|
|
||||||
// SliderContainer,
|
|
||||||
// CheckboxContainer,
|
|
||||||
// SwitchboxContainer,
|
|
||||||
// EntryContainer,
|
|
||||||
// ThresholdContainer,
|
|
||||||
// RadioButtonContainer,
|
|
||||||
// DeeplAuthKeyContainer,
|
|
||||||
// WordFilterContainer,
|
|
||||||
// ActionButtonContainer,
|
|
||||||
} = useSettingBox();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UiLanguageContainer />
|
<UiLanguageContainer />
|
||||||
@@ -34,38 +24,13 @@ export const Appearance = () => {
|
|||||||
<MessageLogUiScalingContainer />
|
<MessageLogUiScalingContainer />
|
||||||
<FontFamilyContainer />
|
<FontFamilyContainer />
|
||||||
<TransparencyContainer />
|
<TransparencyContainer />
|
||||||
{/* <RestoreWindowGeometryContainer /> */}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* <DropdownMenuContainer dropdown_id="mic_device" label="Mic Device" desc="description" selected_id={currentSelectedMicDevice.data} list={currentMicDeviceList} selectFunction={selectFunction} state={currentSelectedMicDevice.state} />
|
|
||||||
|
|
||||||
<SliderContainer label="Transparent" desc="description" min="0" max="3000"/>
|
|
||||||
<CheckboxContainer label="Transparent" desc="description" checkbox_id="checkbox_id_1"/>
|
|
||||||
<SwitchboxContainer label="Transparent" desc="description" switchbox_id="switchbox_id_1"/>
|
|
||||||
|
|
||||||
<RadioButtonContainer label="Transparent" desc="description" switchbox_id="radiobutton_id_1"/>
|
|
||||||
|
|
||||||
<EntryContainer width="20rem" label="Transparent" desc="description" switchbox_id="entry_id_1"/>
|
|
||||||
|
|
||||||
<ThresholdContainer label="Transparent" desc="description" id="mic_threshold" min="0" max="3000"/>
|
|
||||||
|
|
||||||
<DeeplAuthKeyContainer label={t(`config_page.deepl_auth_key.label`)} desc={t(`config_page.deepl_auth_key.desc`)}/>
|
|
||||||
|
|
||||||
<WordFilterContainer label={t(`config_page.mic_word_filter.label`)} desc={t(`config_page.mic_word_filter.desc`)}/>
|
|
||||||
|
|
||||||
<ActionButtonContainer label={t(`config_page.open_config_filepath.label`)} IconComponent={FolderOpenSvg} OnclickFunction={()=>{}}/> */}
|
|
||||||
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
import { LabelComponent } from "../components/label_component/LabelComponent";
|
|
||||||
|
|
||||||
const UiLanguageContainer = () => {
|
const UiLanguageContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentUiLanguage, setUiLanguage } = useUiLanguage();
|
const { currentUiLanguage, setUiLanguage } = useUiLanguage();
|
||||||
|
|
||||||
const SELECTABLE_UI_LANGUAGES_DICT = {
|
const SELECTABLE_UI_LANGUAGES_DICT = {
|
||||||
en: "English",
|
en: "English",
|
||||||
ja: "日本語",
|
ja: "日本語",
|
||||||
@@ -73,7 +38,6 @@ const UiLanguageContainer = () => {
|
|||||||
"zh-Hant": "繁體中文",
|
"zh-Hant": "繁體中文",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const is_not_en_lang = currentUiLanguage.data !== "en" && currentUiLanguage.data !== undefined;
|
const is_not_en_lang = currentUiLanguage.data !== "en" && currentUiLanguage.data !== undefined;
|
||||||
return (
|
return (
|
||||||
<div className={styles.ui_language_container}>
|
<div className={styles.ui_language_container}>
|
||||||
@@ -106,10 +70,6 @@ const UiLanguageContainer = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
import { SliderContainer } from "../components/useSettingBox";
|
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
const UiScalingContainer = () => {
|
const UiScalingContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentUiScaling, setUiScaling } = useUiScaling();
|
const { currentUiScaling, setUiScaling } = useUiScaling();
|
||||||
@@ -192,8 +152,7 @@ const MessageLogUiScalingContainer = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
import { useStore_SelectableFontFamilyList } from "@store";
|
|
||||||
import { DropdownMenuContainer } from "../components/useSettingBox";
|
|
||||||
const FontFamilyContainer = () => {
|
const FontFamilyContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily();
|
const { currentSelectedFontFamily, setSelectedFontFamily } = useSelectedFontFamily();
|
||||||
@@ -216,7 +175,6 @@ const FontFamilyContainer = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const TransparencyContainer = () => {
|
const TransparencyContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentTransparency, setTransparency } = useTransparency();
|
const { currentTransparency, setTransparency } = useTransparency();
|
||||||
@@ -255,20 +213,4 @@ const TransparencyContainer = () => {
|
|||||||
track={false}
|
track={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// import { CheckboxContainer } from "../components/useSettingBox";
|
|
||||||
|
|
||||||
// const RestoreWindowGeometryContainer = () => {
|
|
||||||
// const { t } = useTranslation();
|
|
||||||
// const { currentRestoreWindowGeometry, toggleRestoreWindowGeometry } = useRestoreWindowGeometry();
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <CheckboxContainer
|
|
||||||
// label={t("config_page.to_restore_main_page_geometry.label")}
|
|
||||||
// desc={t("config_page.to_restore_main_page_geometry.desc")}
|
|
||||||
// variable={currentRestoreWindowGeometry}
|
|
||||||
// toggleFunction={toggleRestoreWindowGeometry}
|
|
||||||
// />
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
@@ -1,18 +1,6 @@
|
|||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import styles from "./Device.module.scss";
|
import styles from "./Device.module.scss";
|
||||||
import {
|
|
||||||
useOnMouseLeaveDropdownMenu,
|
|
||||||
} from "../components/useSettingBox";
|
|
||||||
export const Device = () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Mic_Container />
|
|
||||||
<Speaker_Container />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useEnableAutoMicSelect,
|
useEnableAutoMicSelect,
|
||||||
useMicHostList,
|
useMicHostList,
|
||||||
@@ -25,17 +13,28 @@ import {
|
|||||||
useSelectedSpeakerDevice,
|
useSelectedSpeakerDevice,
|
||||||
useSpeakerThreshold,
|
useSpeakerThreshold,
|
||||||
} from "@logics_configs";
|
} from "@logics_configs";
|
||||||
|
import {
|
||||||
|
useOnMouseLeaveDropdownMenu,
|
||||||
|
} from "../components/useSettingBox";
|
||||||
import { LabelComponent } from "../components/label_component/LabelComponent";
|
import { LabelComponent } from "../components/label_component/LabelComponent";
|
||||||
import { DropdownMenu } from "../components/dropdown_menu/DropdownMenu";
|
import { DropdownMenu } from "../components/dropdown_menu/DropdownMenu";
|
||||||
import { ThresholdComponent } from "../components/threshold_component/ThresholdComponent";
|
import { ThresholdComponent } from "../components/threshold_component/ThresholdComponent";
|
||||||
import { Switchbox } from "../components/switchbox/Switchbox";
|
import { Switchbox } from "../components/switchbox/Switchbox";
|
||||||
|
|
||||||
|
export const Device = () => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Mic_Container />
|
||||||
|
<Speaker_Container />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const Mic_Container = () => {
|
const Mic_Container = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentEnableAutoMicSelect, toggleEnableAutoMicSelect } = useEnableAutoMicSelect();
|
const { currentEnableAutoMicSelect, toggleEnableAutoMicSelect } = useEnableAutoMicSelect();
|
||||||
const { currentSelectedMicHost, setSelectedMicHost } = useSelectedMicHost();
|
const { currentSelectedMicHost, setSelectedMicHost } = useSelectedMicHost();
|
||||||
const { currentMicHostList, getMicHostList } = useMicHostList();
|
const { currentMicHostList } = useMicHostList();
|
||||||
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
|
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
|
||||||
const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold();
|
const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold();
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ const Mic_Container = () => {
|
|||||||
const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "pending";
|
const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "pending";
|
||||||
|
|
||||||
const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice();
|
const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice();
|
||||||
const { currentMicDeviceList, getMicDeviceList } = useMicDeviceList();
|
const { currentMicDeviceList } = useMicDeviceList();
|
||||||
|
|
||||||
const selectFunction_device = (selected_data) => {
|
const selectFunction_device = (selected_data) => {
|
||||||
setSelectedMicDevice(selected_data.selected_id);
|
setSelectedMicDevice(selected_data.selected_id);
|
||||||
@@ -89,7 +88,6 @@ const Mic_Container = () => {
|
|||||||
selected_id={currentSelectedMicHost.data}
|
selected_id={currentSelectedMicHost.data}
|
||||||
list={currentMicHostList.data}
|
list={currentMicHostList.data}
|
||||||
selectFunction={selectFunction_host}
|
selectFunction={selectFunction_host}
|
||||||
// openListFunction={getMicHostList}
|
|
||||||
state={currentSelectedMicHost.state}
|
state={currentSelectedMicHost.state}
|
||||||
style={{ maxWidth: "20rem", minWidth: "10rem" }}
|
style={{ maxWidth: "20rem", minWidth: "10rem" }}
|
||||||
is_disabled={is_disabled_selector}
|
is_disabled={is_disabled_selector}
|
||||||
@@ -103,7 +101,6 @@ const Mic_Container = () => {
|
|||||||
selected_id={currentSelectedMicDevice.data}
|
selected_id={currentSelectedMicDevice.data}
|
||||||
list={currentMicDeviceList.data}
|
list={currentMicDeviceList.data}
|
||||||
selectFunction={selectFunction_device}
|
selectFunction={selectFunction_device}
|
||||||
// openListFunction={getMicDeviceList}
|
|
||||||
state={currentSelectedMicDevice.state}
|
state={currentSelectedMicDevice.state}
|
||||||
is_disabled={is_disabled_selector}
|
is_disabled={is_disabled_selector}
|
||||||
/>
|
/>
|
||||||
@@ -135,7 +132,7 @@ const Speaker_Container = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { currentEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect();
|
const { currentEnableAutoSpeakerSelect, toggleEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect();
|
||||||
const { currentSelectedSpeakerDevice, setSelectedSpeakerDevice } = useSelectedSpeakerDevice();
|
const { currentSelectedSpeakerDevice, setSelectedSpeakerDevice } = useSelectedSpeakerDevice();
|
||||||
const { currentSpeakerDeviceList, getSpeakerDeviceList } = useSpeakerDeviceList();
|
const { currentSpeakerDeviceList } = useSpeakerDeviceList();
|
||||||
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
|
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
|
||||||
const { currentEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold } = useSpeakerThreshold();
|
const { currentEnableAutomaticSpeakerThreshold, toggleEnableAutomaticSpeakerThreshold } = useSpeakerThreshold();
|
||||||
|
|
||||||
@@ -182,7 +179,6 @@ const Speaker_Container = () => {
|
|||||||
selected_id={currentSelectedSpeakerDevice.data}
|
selected_id={currentSelectedSpeakerDevice.data}
|
||||||
list={currentSpeakerDeviceList.data}
|
list={currentSpeakerDeviceList.data}
|
||||||
selectFunction={selectFunction}
|
selectFunction={selectFunction}
|
||||||
// openListFunction={getSpeakerDeviceList}
|
|
||||||
state={currentSelectedSpeakerDevice.state}
|
state={currentSelectedSpeakerDevice.state}
|
||||||
is_disabled={is_disabled_selector}
|
is_disabled={is_disabled_selector}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useSettingBox } from "../components/useSettingBox";
|
import { useSettingBox } from "../components/useSettingBox";
|
||||||
// import {
|
|
||||||
// useStore_EnableAutoClearMessageBox,
|
|
||||||
// } from "@store";
|
|
||||||
|
|
||||||
import { useConfig } from "@logics/useConfig";
|
import { useConfig } from "@logics/useConfig";
|
||||||
|
|
||||||
export const Others = () => {
|
export const Others = () => {
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import {
|
|||||||
useUiScaling,
|
useUiScaling,
|
||||||
useMessageLogUiScaling,
|
useMessageLogUiScaling,
|
||||||
useTransparency,
|
useTransparency,
|
||||||
// useRestoreWindowGeometry,
|
|
||||||
} from "@logics_configs";
|
} from "@logics_configs";
|
||||||
|
|
||||||
export const useReceiveRoutes = () => {
|
export const useReceiveRoutes = () => {
|
||||||
@@ -85,8 +84,6 @@ export const useReceiveRoutes = () => {
|
|||||||
const { updateMessageInputBoxRatio } = useMessageInputBoxRatio();
|
const { updateMessageInputBoxRatio } = useMessageInputBoxRatio();
|
||||||
const { updateSelectedFontFamily } = useSelectedFontFamily();
|
const { updateSelectedFontFamily } = useSelectedFontFamily();
|
||||||
const { updateTransparency } = useTransparency();
|
const { updateTransparency } = useTransparency();
|
||||||
// const { updateRestoreWindowGeometry } = useRestoreWindowGeometry();
|
|
||||||
|
|
||||||
|
|
||||||
const routes = {
|
const routes = {
|
||||||
// Common
|
// Common
|
||||||
@@ -230,10 +227,6 @@ export const useReceiveRoutes = () => {
|
|||||||
"/get/data/transparency": updateTransparency,
|
"/get/data/transparency": updateTransparency,
|
||||||
"/set/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
|
// Others Tab
|
||||||
"/get/data/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
"/get/data/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||||
"/set/enable/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
"/set/enable/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ const createAtomWithHook = (initialValue, base_name, options) => {
|
|||||||
|
|
||||||
|
|
||||||
// Common
|
// 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_IsOpenedConfigPage, useHook: useStore_IsOpenedConfigPage } = createAtomWithHook(false, "IsOpenedConfigPage");
|
||||||
export const { atomInstance: Atom_MainFunctionsStateMemory, useHook: useStore_MainFunctionsStateMemory } = createAtomWithHook({
|
export const { atomInstance: Atom_MainFunctionsStateMemory, useHook: useStore_MainFunctionsStateMemory } = createAtomWithHook({
|
||||||
transcription_send: false,
|
transcription_send: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user