[Refactor] Remove the codes that is no longer in use and organize a bit.

This commit is contained in:
Sakamoto Shiina
2024-10-13 07:11:47 +09:00
parent 743e73b9ed
commit d7cf2425a1
5 changed files with 24 additions and 98 deletions

View File

@@ -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 (
<>
<UiLanguageContainer />
@@ -34,38 +24,13 @@ export const Appearance = () => {
<MessageLogUiScalingContainer />
<FontFamilyContainer />
<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 { 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 (
<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 { 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 (
// <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}
// />
// );
// };
};

View File

@@ -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 (
<>
<Mic_Container />
<Speaker_Container />
</>
);
};
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 (
<>
<Mic_Container />
<Speaker_Container />
</>
);
};
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}
/>

View File

@@ -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 = () => {

View File

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

View File

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