[Update] UIで使うデータ(min,maxなど)を浅い階層で設定するように。

初期データとして送られてきていたrangeなど、必要のないエンドポイントをコメントアウト。
This commit is contained in:
Sakamoto Shiina
2024-11-06 00:23:43 +09:00
parent 9beba4905b
commit 1acb0a9565
4 changed files with 38 additions and 29 deletions

View File

@@ -2,6 +2,7 @@ import clsx from "clsx";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import styles from "./Appearance.module.scss";
import { ui_configs } from "@ui_configs";
import { useStore_SelectableFontFamilyList } from "@store";
import {
useUiLanguage,
@@ -38,12 +39,6 @@ export const Appearance = () => {
const UiLanguageContainer = () => {
const { t } = useTranslation();
const { currentUiLanguage, setUiLanguage } = useUiLanguage();
const SELECTABLE_UI_LANGUAGES_DICT = {
en: "English",
ja: "日本語",
ko: "한국어",
"zh-Hant": "繁體中文",
};
const is_not_en_lang = currentUiLanguage.data !== "en" && currentUiLanguage.data !== undefined;
return (
@@ -60,7 +55,7 @@ const UiLanguageContainer = () => {
</div>
<div className={styles.ui_language_selector_container}>
{currentUiLanguage.state === "pending" && <span className={styles.loader}></span>}
{Object.entries(SELECTABLE_UI_LANGUAGES_DICT).map(([key, value]) => (
{Object.entries(ui_configs.selectable_ui_languages).map(([key, value]) => (
<label key={key} className={clsx(styles.radio_button_wrapper, { [styles.is_selected]: currentUiLanguage.data === key } )}>
<input
className={styles.radio_button_input}

View File

@@ -1,5 +1,6 @@
import { useTranslation } from "react-i18next";
import styles from "./Device.module.scss";
import { ui_configs } from "@ui_configs";
import {
useEnableAutoMicSelect,
useMicHostList,
@@ -120,8 +121,8 @@ const Mic_Container = () => {
<div className={styles.threshold_section}>
<ThresholdComponent
id="mic_threshold"
min="0"
max="2000"
min={ui_configs.mic_threshold_min}
max={ui_configs.mic_threshold_max}
/>
</div>
</div>
@@ -197,8 +198,8 @@ const Speaker_Container = () => {
<div className={styles.threshold_section}>
<ThresholdComponent
id="speaker_threshold"
min="0"
max="4000"
min={ui_configs.speaker_threshold_min}
max={ui_configs.speaker_threshold_max}
/>
</div>
</div>

View File

@@ -5,4 +5,17 @@ export const translator_status = [
{ translator_id: "Bing", translator_name: "Bing", is_available: false },
{ translator_id: "Papago", translator_name: "Papago", is_available: false },
{ translator_id: "CTranslate2", translator_name: `Internal\n(Default)`, is_available: false },
];
];
export const ui_configs = {
mic_threshold_min: 0,
mic_threshold_max: 2000,
speaker_threshold_min: 0,
speaker_threshold_max: 4000,
selectable_ui_languages: {
en: "English",
ja: "日本語",
ko: "한국어",
"zh-Hant": "繁體中文",
}
};