[Refactor] Change state management structures. Async atom to be manage manually.

This commit is contained in:
Sakamoto Shiina
2024-09-23 03:44:33 +09:00
parent 586aaf0091
commit 0616092eff
49 changed files with 295 additions and 190 deletions

10
data.js
View File

@@ -1,10 +1,10 @@
export const translator_status = [ export const translator_status = [
{ translator_id: "DeepL", translator_name: "DeepL", is_available: true }, { translator_id: "DeepL", translator_name: "DeepL", is_available: false },
{ translator_id: "DeepL_API", translator_name: `DeepL\nAPI`, is_available: false }, { translator_id: "DeepL_API", translator_name: `DeepL\nAPI`, is_available: false },
{ translator_id: "Google", translator_name: "Google", is_available: true }, { translator_id: "Google", translator_name: "Google", is_available: false },
{ translator_id: "Bing", translator_name: "Bing", is_available: true }, { translator_id: "Bing", translator_name: "Bing", is_available: false },
{ translator_id: "Papago", translator_name: "Papago", is_available: true }, { translator_id: "Papago", translator_name: "Papago", is_available: false },
{ translator_id: "CTranslate2", translator_name: `Internal\n(Default)`, is_available: true }, { translator_id: "CTranslate2", translator_name: `Internal\n(Default)`, is_available: false },
]; ];

View File

@@ -124,7 +124,7 @@ const ConfigPageCloseTrigger = () => {
} = useVolume(); } = useVolume();
useEffect(() => { useEffect(() => {
if (currentIsOpenedConfigPage === false) { if (currentIsOpenedConfigPage.data === false) {
if (currentMicThresholdCheckStatus.data === true) volumeCheckStop_Mic(); if (currentMicThresholdCheckStatus.data === true) volumeCheckStop_Mic();
if (currentSpeakerThresholdCheckStatus.data === true) volumeCheckStop_Speaker(); if (currentSpeakerThresholdCheckStatus.data === true) volumeCheckStop_Speaker();
} }

View File

@@ -21,7 +21,7 @@ export const ConfigPage = () => {
</div> </div>
<p className={styles.software_version}> <p className={styles.software_version}>
{ {
t("config_page.version", {version: currentSoftwareVersion}) t("config_page.version", {version: currentSoftwareVersion.data})
} }
</p> </p>
</div> </div>

View File

@@ -7,7 +7,7 @@ import { Appearance } from "./appearance/Appearance";
export const SettingBox = () => { export const SettingBox = () => {
const { currentSelectedConfigTabId } = useStore_SelectedConfigTabId(); const { currentSelectedConfigTabId } = useStore_SelectedConfigTabId();
switch (currentSelectedConfigTabId) { switch (currentSelectedConfigTabId.data) {
case "device": case "device":
return <Device />; return <Device />;
// case "others": // case "others":

View File

@@ -74,7 +74,7 @@ export const AboutVrct = () => {
<img src={special_thanks_section_title} className={clsx(styles.section_title, styles.special_thanks)} /> <img src={special_thanks_section_title} className={clsx(styles.section_title, styles.special_thanks)} />
<img src={special_thanks_members} className={styles.special_thanks_members_img} /> <img src={special_thanks_members} className={styles.special_thanks_members_img} />
{ {
currentUiLanguage === "ja" currentUiLanguage.data === "ja"
? <img src={special_thanks_message_ja} className={styles.special_thanks_message_img} /> ? <img src={special_thanks_message_ja} className={styles.special_thanks_message_img} />
: <img src={special_thanks_message_en} className={styles.special_thanks_message_img} /> : <img src={special_thanks_message_en} className={styles.special_thanks_message_img} />
} }

View File

@@ -19,7 +19,7 @@ export const PosterShowcaseWorldsContents = () => {
})); }));
const chunked_poster_showcase_world_images = chunkArray(poster_showcase_world_images, 8); const chunked_poster_showcase_world_images = chunkArray(poster_showcase_world_images, 8);
const target_poster_showcase_world_images = chunked_poster_showcase_world_images[currentPosterShowcaseWorldPageIndex]; const target_poster_showcase_world_images = chunked_poster_showcase_world_images[currentPosterShowcaseWorldPageIndex.data];
return ( return (
@@ -70,7 +70,7 @@ const PosterShowcaseWorldsPagination = ({ page_length }) => {
}; };
const getClassNames = (index, baseClass) => clsx(baseClass, { const getClassNames = (index, baseClass) => clsx(baseClass, {
[styles.is_active]: (currentPosterShowcaseWorldPageIndex === index), [styles.is_active]: (currentPosterShowcaseWorldPageIndex.data === index),
}); });
return ( return (

View File

@@ -34,11 +34,11 @@ export const PostersContents = () => {
const updateIndex = (delta) => { const updateIndex = (delta) => {
const newIndex = (currentVrctPosterIndex + delta + poster_images.length) % poster_images.length; const newIndex = (currentVrctPosterIndex.data + delta + poster_images.length) % poster_images.length;
updateVrctPosterIndex(newIndex); updateVrctPosterIndex(newIndex);
}; };
const current_poster = poster_images[currentVrctPosterIndex]; const current_poster = poster_images[currentVrctPosterIndex.data];
const current_poster_authors_img_ja = (current_poster.poster_type === "poster") ? poster_images_authors_ja : poster_images_authors_m_ja; const current_poster_authors_img_ja = (current_poster.poster_type === "poster") ? poster_images_authors_ja : poster_images_authors_m_ja;
const current_poster_authors_img_en = (current_poster.poster_type === "poster") ? poster_images_authors_en : poster_images_authors_m_en; const current_poster_authors_img_en = (current_poster.poster_type === "poster") ? poster_images_authors_en : poster_images_authors_m_en;
@@ -60,7 +60,7 @@ export const PostersContents = () => {
</button> </button>
</div> </div>
{ {
currentUiLanguage === "ja" currentUiLanguage.data === "ja"
? <img src={current_poster_authors_img_ja} className={styles.poster_authors_img} /> ? <img src={current_poster_authors_img_ja} className={styles.poster_authors_img} />
: <img src={current_poster_authors_img_en} className={styles.poster_authors_img} /> : <img src={current_poster_authors_img_en} className={styles.poster_authors_img} />
} }

View File

@@ -101,7 +101,7 @@ const UiLanguageContainer = () => {
} }
</div> </div>
<div className={styles.ui_language_selector_container}> <div className={styles.ui_language_selector_container}>
{currentUiLanguage.state === "loading" && <span className={styles.loader}></span>} {currentUiLanguage.state === "pending" && <span className={styles.loader}></span>}
{Object.entries(SELECTABLE_UI_LANGUAGES_DICT).map(([key, value]) => ( {Object.entries(SELECTABLE_UI_LANGUAGES_DICT).map(([key, value]) => (
<label key={key} className={clsx(styles.radio_button_wrapper, { [styles.is_selected]: currentUiLanguage.data === key } )}> <label key={key} className={clsx(styles.radio_button_wrapper, { [styles.is_selected]: currentUiLanguage.data === key } )}>
<input <input

View File

@@ -4,7 +4,7 @@ export const Checkbox = (props) => {
return ( return (
<div className={styles.checkbox_container}> <div className={styles.checkbox_container}>
<label className={styles.checkbox_wrapper} htmlFor={props.checkbox_id}> <label className={styles.checkbox_wrapper} htmlFor={props.checkbox_id}>
{(props.state === "loading") {(props.state === "pending")
? <span className={styles.loader}></span> ? <span className={styles.loader}></span>
: <input : <input
type="checkbox" type="checkbox"

View File

@@ -7,7 +7,7 @@ export const DropdownMenu = (props) => {
const { updateIsOpenedDropdownMenu, currentIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu(); const { updateIsOpenedDropdownMenu, currentIsOpenedDropdownMenu } = useStore_IsOpenedDropdownMenu();
const toggleDropdownMenu = () => { const toggleDropdownMenu = () => {
if (currentIsOpenedDropdownMenu === props.dropdown_id) { if (currentIsOpenedDropdownMenu.data === props.dropdown_id) {
updateIsOpenedDropdownMenu(""); updateIsOpenedDropdownMenu("");
} else { } else {
if (props.openListFunction !== undefined) props.openListFunction(); if (props.openListFunction !== undefined) props.openListFunction();
@@ -24,21 +24,21 @@ export const DropdownMenu = (props) => {
}; };
const dropdown_content_wrapper_class_name = clsx(styles["dropdown_content_wrapper"], { const dropdown_content_wrapper_class_name = clsx(styles["dropdown_content_wrapper"], {
[styles.is_opened]: (currentIsOpenedDropdownMenu === props.dropdown_id) ? true : false, [styles.is_opened]: (currentIsOpenedDropdownMenu.data === props.dropdown_id) ? true : false,
[styles.is_disabled]: props.is_disabled, [styles.is_disabled]: props.is_disabled,
}); });
const dropdown_toggle_button_class_name = clsx(styles["dropdown_toggle_button"], { const dropdown_toggle_button_class_name = clsx(styles["dropdown_toggle_button"], {
[styles.is_loading]: (props.state === "loading") ? true : false, [styles.is_loading]: (props.state === "pending") ? true : false,
[styles.is_disabled]: props.is_disabled, [styles.is_disabled]: props.is_disabled,
}); });
const arrow_class_names = clsx(styles["arrow_left_svg"], { const arrow_class_names = clsx(styles["arrow_left_svg"], {
[styles.is_opened]: (currentIsOpenedDropdownMenu === props.dropdown_id) ? true : false [styles.is_opened]: (currentIsOpenedDropdownMenu.data === props.dropdown_id) ? true : false
}); });
const getSelectedText = () => { const getSelectedText = () => {
if (props.state !== "hasData") return; if (props.state !== "ok") return;
return props.selected_id; return props.selected_id;
}; };
const list = (props.list === undefined) ? {} : props.list; const list = (props.list === undefined) ? {} : props.list;
@@ -46,18 +46,18 @@ export const DropdownMenu = (props) => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={dropdown_toggle_button_class_name} onClick={toggleDropdownMenu} style={props.style}> <div className={dropdown_toggle_button_class_name} onClick={toggleDropdownMenu} style={props.style}>
{(props.state === "loading") {(props.state === "pending")
? <p className={styles.dropdown_selected_text}>Loading...</p> ? <p className={styles.dropdown_selected_text}>Loading...</p>
: <p className={styles.dropdown_selected_text}>{getSelectedText()}</p> : <p className={styles.dropdown_selected_text}>{getSelectedText()}</p>
} }
{(props.state === "loading") {(props.state === "pending")
? <span className={styles.loader}></span> ? <span className={styles.loader}></span>
: <ArrowLeftSvg className={arrow_class_names} /> : <ArrowLeftSvg className={arrow_class_names} />
} }
</div> </div>
<div className={dropdown_content_wrapper_class_name}> <div className={dropdown_content_wrapper_class_name}>
<div className={styles.dropdown_content}> <div className={styles.dropdown_content}>
{(props.state === "hasData") {(props.state === "ok")
? Object.entries(list).map(([key, value]) => { ? Object.entries(list).map(([key, value]) => {
return ( return (
<div key={key} className={styles.value_button} onClick={() => selectValue(key)}> <div key={key} className={styles.value_button} onClick={() => selectValue(key)}>

View File

@@ -56,7 +56,7 @@ const ExampleComponent = ({ id, current_format }) => {
let format = current_format; let format = current_format;
if (["send_with_t", "received_with_t"].includes(id)) { if (["send_with_t", "received_with_t"].includes(id)) {
const translationLocale = currentUiLanguage === "en" ? "ja" : "en"; const translationLocale = currentUiLanguage.data === "en" ? "ja" : "en";
const translatedLangMessage = t("config_page.send_message_format.example_text", { lng: translationLocale }); const translatedLangMessage = t("config_page.send_message_format.example_text", { lng: translationLocale });
return format.is_message_first return format.is_message_first

View File

@@ -7,7 +7,7 @@ export const RadioButton = (props) => {
<label key={option.radio_button_id} className={styles.radio_button_wrapper}> <label key={option.radio_button_id} className={styles.radio_button_wrapper}>
{props.checked_variable.data === option.radio_button_id {props.checked_variable.data === option.radio_button_id
? <> ? <>
{ props.checked_variable.state === "loading" && <span className={styles.loader}></span> } { props.checked_variable.state === "pending" && <span className={styles.loader}></span> }
<input <input
type="radio" type="radio"
name="radio" name="radio"

View File

@@ -6,7 +6,7 @@ export const Switchbox = (props) => {
const [is_hovered, setIsHovered] = useState(false); const [is_hovered, setIsHovered] = useState(false);
const [is_mouse_down, setIsMouseDown] = useState(false); const [is_mouse_down, setIsMouseDown] = useState(false);
const is_loading = (props.variable.state === "loading"); const is_loading = (props.variable.state === "pending");
const getClassNames = (base_class) => clsx(base_class, { const getClassNames = (base_class) => clsx(base_class, {
[styles.is_active]: (props.variable.data === true), [styles.is_active]: (props.variable.data === true),

View File

@@ -22,7 +22,7 @@ const MicComponent = (props) => {
setMicThreshold, setMicThreshold,
currentEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold,
} = useMicThreshold(); } = useMicThreshold();
const [ui_threshold, setUiThreshold] = useState(currentMicThreshold); const [ui_threshold, setUiThreshold] = useState(currentMicThreshold.data);
const { const {
volumeCheckStart_Mic, volumeCheckStart_Mic,
volumeCheckStop_Mic, volumeCheckStop_Mic,
@@ -34,9 +34,9 @@ const MicComponent = (props) => {
if (currentEnableAutomaticMicThreshold.data === true) { if (currentEnableAutomaticMicThreshold.data === true) {
setUiThreshold("Auto"); setUiThreshold("Auto");
} else { } else {
setUiThreshold(currentMicThreshold); setUiThreshold(currentMicThreshold.data);
} }
}, [currentMicThreshold, currentEnableAutomaticMicThreshold]); }, [currentMicThreshold.data, currentEnableAutomaticMicThreshold]);
const setUiThresholdFunction = (payload_ui_threshold) => { const setUiThresholdFunction = (payload_ui_threshold) => {
setUiThreshold(payload_ui_threshold); setUiThreshold(payload_ui_threshold);
@@ -80,7 +80,7 @@ const SpeakerComponent = (props) => {
setSpeakerThreshold, setSpeakerThreshold,
currentEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold,
} = useSpeakerThreshold(); } = useSpeakerThreshold();
const [ui_threshold, setUiThreshold] = useState(currentSpeakerThreshold); const [ui_threshold, setUiThreshold] = useState(currentSpeakerThreshold.data);
const { const {
volumeCheckStart_Speaker, volumeCheckStart_Speaker,
volumeCheckStop_Speaker, volumeCheckStop_Speaker,
@@ -91,9 +91,9 @@ const SpeakerComponent = (props) => {
if (currentEnableAutomaticSpeakerThreshold.data === true) { if (currentEnableAutomaticSpeakerThreshold.data === true) {
setUiThreshold("Auto"); setUiThreshold("Auto");
} else { } else {
setUiThreshold(currentSpeakerThreshold); setUiThreshold(currentSpeakerThreshold.data);
} }
}, [currentSpeakerThreshold, currentEnableAutomaticSpeakerThreshold]); }, [currentSpeakerThreshold.data, currentEnableAutomaticSpeakerThreshold]);
const setUiThresholdFunction = (payload_ui_threshold) => { const setUiThresholdFunction = (payload_ui_threshold) => {
setUiThreshold(payload_ui_threshold); setUiThreshold(payload_ui_threshold);

View File

@@ -5,7 +5,7 @@ import clsx from "clsx";
export const VolumeCheckButton = React.memo((props) => { export const VolumeCheckButton = React.memo((props) => {
const getClassNames = (baseClass) => clsx(baseClass, { const getClassNames = (baseClass) => clsx(baseClass, {
[styles.is_active]: (props.isChecking?.data === true), [styles.is_active]: (props.isChecking?.data === true),
[styles.is_loading]: (props.isChecking.state === "loading"), [styles.is_loading]: (props.isChecking.state === "pending"),
}); });
const toggleFunction = () => { const toggleFunction = () => {

View File

@@ -15,7 +15,7 @@ export const WordFilter = () => {
if (input_value === undefined) return; if (input_value === undefined) return;
const input_value_array = input_value.split(","); const input_value_array = input_value.split(",");
let updated_list = [...currentWordFilterList]; let updated_list = [...currentWordFilterList.data];
for (let each_input_value of input_value_array) { for (let each_input_value of input_value_array) {
each_input_value = each_input_value.trim(); each_input_value = each_input_value.trim();
@@ -57,10 +57,10 @@ export const WordFilter = () => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
{ currentIsOpenedWordFilterList && { currentIsOpenedWordFilterList.data &&
<div className={styles.list_section_wrapper}> <div className={styles.list_section_wrapper}>
{ {
currentWordFilterList.map((item, index) => { currentWordFilterList.data.map((item, index) => {
return <WordFilterItem value={item.value} key={index} is_redoable={item.is_redoable} deleteAction={deleteAction} redoAction={redoAction}/>; return <WordFilterItem value={item.value} key={index} is_redoable={item.is_redoable} deleteAction={deleteAction} redoAction={redoAction}/>;
}) })
} }
@@ -117,15 +117,15 @@ export const WordFilterListToggleComponent = (props) => {
const svg_class_names = clsx(styles["arrow_left_svg"], { const svg_class_names = clsx(styles["arrow_left_svg"], {
[styles.to_down]: !currentIsOpenedWordFilterList, [styles.to_down]: !currentIsOpenedWordFilterList.data,
[styles.to_up]: currentIsOpenedWordFilterList [styles.to_up]: currentIsOpenedWordFilterList.data
}); });
const OnclickFunction = () => { const OnclickFunction = () => {
updateIsOpenedWordFilterList(!currentIsOpenedWordFilterList); updateIsOpenedWordFilterList(!currentIsOpenedWordFilterList.data);
}; };
const word_filter_list_length = currentWordFilterList.filter(item => item.is_redoable === false).length; const word_filter_list_length = currentWordFilterList.data.filter(item => item.is_redoable === false).length;
return ( return (

View File

@@ -35,11 +35,12 @@ const Mic_Container = () => {
const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu(); const { onMouseLeaveFunction } = useOnMouseLeaveDropdownMenu();
const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold(); const { currentEnableAutomaticMicThreshold, toggleEnableAutomaticMicThreshold } = useMicThreshold();
const selectFunction_host = (selected_data) => { const selectFunction_host = (selected_data) => {
setSelectedMicHost(selected_data.selected_id); setSelectedMicHost(selected_data.selected_id);
}; };
const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "loading"; const is_disabled_selector = currentEnableAutoMicSelect.data === true || currentEnableAutoMicSelect.data === "pending";
const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice(); const { currentSelectedMicDevice, setSelectedMicDevice } = useSelectedMicDevice();
const { currentMicDeviceList, getMicDeviceList } = useMicDeviceList(); const { currentMicDeviceList, getMicDeviceList } = useMicDeviceList();
@@ -143,7 +144,7 @@ const Speaker_Container = () => {
setSelectedSpeakerDevice(selected_data.selected_id); setSelectedSpeakerDevice(selected_data.selected_id);
}; };
const is_disabled_selector = currentEnableAutoSpeakerSelect.data === true || currentEnableAutoSpeakerSelect.data === "loading"; const is_disabled_selector = currentEnableAutoSpeakerSelect.data === true || currentEnableAutoSpeakerSelect.data === "pending";
const getLabels = () => { const getLabels = () => {
if (currentEnableAutomaticSpeakerThreshold.data === true) { if (currentEnableAutomaticSpeakerThreshold.data === true) {

View File

@@ -32,10 +32,10 @@ const Tab = (props) => {
}; };
const tab_container_class_names = clsx(styles["tab_container"], { const tab_container_class_names = clsx(styles["tab_container"], {
[styles["is_selected"]]: (currentSelectedConfigTabId === props.tab_id) ? true : false [styles["is_selected"]]: (currentSelectedConfigTabId.data === props.tab_id) ? true : false
}); });
const switch_indicator_class_names = clsx(styles["switch_indicator"], { const switch_indicator_class_names = clsx(styles["switch_indicator"], {
[styles["is_selected"]]: (currentSelectedConfigTabId === props.tab_id) ? true : false [styles["is_selected"]]: (currentSelectedConfigTabId.data === props.tab_id) ? true : false
}); });
return ( return (

View File

@@ -16,8 +16,8 @@ export const Topbar = () => {
return ( return (
<div className={clsx(styles.container, { <div className={clsx(styles.container, {
[styles.show_config]: currentIsOpenedConfigPage, [styles.show_config]: currentIsOpenedConfigPage.data,
[styles.show_main]: !currentIsOpenedConfigPage [styles.show_main]: !currentIsOpenedConfigPage.data
})}> })}>
<div className={styles.wrapper} onClick={() => closeConfigPage()}> <div className={styles.wrapper} onClick={() => closeConfigPage()}>
<div className={styles.go_back_button}> <div className={styles.go_back_button}>

View File

@@ -7,7 +7,7 @@ export const SectionTitleBox = () => {
const { currentSelectedConfigTabId } = useStore_SelectedConfigTabId(); const { currentSelectedConfigTabId } = useStore_SelectedConfigTabId();
return ( return (
<div className={styles.container}> <div className={styles.container}>
<p className={styles.title}>{t(`config_page.side_menu_labels.${currentSelectedConfigTabId}`)}</p> <p className={styles.title}>{t(`config_page.side_menu_labels.${currentSelectedConfigTabId.data}`)}</p>
</div> </div>
); );
}; };

View File

@@ -9,8 +9,8 @@ export const MainPage = () => {
return ( return (
<div className={clsx(styles.page, styles.main_page, { <div className={clsx(styles.page, styles.main_page, {
[styles.show_config]: currentIsOpenedConfigPage, [styles.show_config]: currentIsOpenedConfigPage.data,
[styles.show_main]: !currentIsOpenedConfigPage [styles.show_main]: !currentIsOpenedConfigPage.data
})}> })}>
<div className={styles.container}> <div className={styles.container}>
<SidebarSection /> <SidebarSection />

View File

@@ -28,10 +28,10 @@ const HandleLanguageSelector = () => {
setSelectedTargetLanguages, setSelectedTargetLanguages,
} = useLanguageSettings(); } = useLanguageSettings();
if (currentIsOpenedLanguageSelector.your_language === true) { if (currentIsOpenedLanguageSelector.data.your_language === true) {
const onclickFunction_YourLanguage = (payload) => setSelectedYourLanguages(payload); const onclickFunction_YourLanguage = (payload) => setSelectedYourLanguages(payload);
return <LanguageSelector id="your_language" onClickFunction={onclickFunction_YourLanguage}/>; return <LanguageSelector id="your_language" onClickFunction={onclickFunction_YourLanguage}/>;
} else if (currentIsOpenedLanguageSelector.target_language === true) { } else if (currentIsOpenedLanguageSelector.data.target_language === true) {
const onclickFunction_TargetLanguage = (payload) => setSelectedTargetLanguages(payload); const onclickFunction_TargetLanguage = (payload) => setSelectedTargetLanguages(payload);
return <LanguageSelector id="target_language" onClickFunction={onclickFunction_TargetLanguage}/>; return <LanguageSelector id="target_language" onClickFunction={onclickFunction_TargetLanguage}/>;
} else { } else {

View File

@@ -27,7 +27,7 @@ export const LanguageSelector = ({ id, onClickFunction }) => {
}, {}); }, {});
}; };
const groupedLanguages = groupLanguagesByFirstLetter(currentSelectableLanguageList); const groupedLanguages = groupLanguagesByFirstLetter(currentSelectableLanguageList.data);
return ( return (
<div className={styles.container}> <div className={styles.container}>

View File

@@ -1,20 +1,22 @@
import { useEffect, useLayoutEffect, useRef, useState } from "react"; import { useEffect, useLayoutEffect, useRef, useState } from "react";
import styles from "./LogBox.module.scss"; import styles from "./LogBox.module.scss";
import { useStore_MessageLogs, store } from "@store"; import { store } from "@store";
import { MessageContainer } from "./message_container/MessageContainer"; import { MessageContainer } from "./message_container/MessageContainer";
import { scrollToBottom } from "@utils/scrollToBottom"; import { scrollToBottom } from "@utils/scrollToBottom";
import { useMessage } from "@logics_common/useMessage";
export const LogBox = () => { export const LogBox = () => {
const { currentMessageLogs } = useStore_MessageLogs(); const { currentMessageLogs } = useMessage();
const log_container_ref = useRef(null); const log_container_ref = useRef(null);
const [is_scrolling, setIsScrolling] = useState(false); const [is_scrolling, setIsScrolling] = useState(false);
useLayoutEffect(() => { useLayoutEffect(() => {
store.log_box_ref = log_container_ref; store.log_box_ref = log_container_ref;
if (!is_scrolling) { if (!is_scrolling) {
scrollToBottom(store.log_box_ref, true); scrollToBottom(store.log_box_ref, true);
} }
}, [currentMessageLogs]); }, [currentMessageLogs.data]);
useEffect(() => { useEffect(() => {
const handleScroll = () => { const handleScroll = () => {
@@ -39,7 +41,7 @@ export const LogBox = () => {
return ( return (
<div id="log_container" className={styles.container} ref={log_container_ref}> <div id="log_container" className={styles.container} ref={log_container_ref}>
{currentMessageLogs.map(message_data => ( {currentMessageLogs.data.map(message_data => (
<MessageContainer key={message_data.id} {...message_data} /> <MessageContainer key={message_data.id} {...message_data} />
))} ))}
</div> </div>

View File

@@ -8,11 +8,11 @@ export const SidebarCompactModeButton = () => {
const { updateIsMainPageCompactMode, currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode(); const { updateIsMainPageCompactMode, currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode();
const toggleCompactMode = () => { const toggleCompactMode = () => {
updateIsMainPageCompactMode(!currentIsMainPageCompactMode); updateIsMainPageCompactMode(!currentIsMainPageCompactMode.data);
}; };
const class_names = clsx(styles["arrow_left_svg"], { const class_names = clsx(styles["arrow_left_svg"], {
[styles["reverse"]]: currentIsMainPageCompactMode [styles["reverse"]]: currentIsMainPageCompactMode.data
}); });
return ( return (

View File

@@ -11,12 +11,12 @@ import { OpenSettings } from "./open_settings/OpenSettings";
export const SidebarSection = () => { export const SidebarSection = () => {
const { currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode(); const { currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode();
const container_class_name = clsx(styles.container, { const container_class_name = clsx(styles.container, {
[styles.is_compact_mode]: currentIsMainPageCompactMode [styles.is_compact_mode]: currentIsMainPageCompactMode.data
}); });
const { currentIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector(); const { currentIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector();
const scroll_container_class_names = clsx(styles.scroll_container, { const scroll_container_class_names = clsx(styles.scroll_container, {
[styles.is_opened]: (currentIsOpenedLanguageSelector.your_language === true || currentIsOpenedLanguageSelector.target_language === true) [styles.is_opened]: (currentIsOpenedLanguageSelector.data.your_language === true || currentIsOpenedLanguageSelector.data.target_language === true)
}); });
return ( return (
@@ -24,7 +24,7 @@ export const SidebarSection = () => {
<Logo /> <Logo />
<div className={scroll_container_class_names}> <div className={scroll_container_class_names}>
<MainFunctionSwitch /> <MainFunctionSwitch />
{!currentIsMainPageCompactMode && <LanguageSettings />} {!currentIsMainPageCompactMode.data && <LanguageSettings />}
</div> </div>
<OpenSettings /> <OpenSettings />
</div> </div>

View File

@@ -62,8 +62,8 @@ const PresetContainer = () => {
const yourLanguageSettings = { const yourLanguageSettings = {
title: t("main_page.your_language"), title: t("main_page.your_language"),
is_opened: currentIsOpenedLanguageSelector.your_language, is_opened: currentIsOpenedLanguageSelector.data.your_language,
onClickFunction: () => toggleSelector("your_language", currentIsOpenedLanguageSelector.your_language, updateIsOpenedLanguageSelector), onClickFunction: () => toggleSelector("your_language", currentIsOpenedLanguageSelector.data.your_language, updateIsOpenedLanguageSelector),
TurnedOnSvgComponent: <MicSvg />, TurnedOnSvgComponent: <MicSvg />,
is_turned_on: currentTranscriptionSendStatus.data, is_turned_on: currentTranscriptionSendStatus.data,
variable: your_language_data?.primary, variable: your_language_data?.primary,
@@ -71,8 +71,8 @@ const PresetContainer = () => {
const targetLanguageSettings = { const targetLanguageSettings = {
title: t("main_page.target_language"), title: t("main_page.target_language"),
is_opened: currentIsOpenedLanguageSelector.target_language, is_opened: currentIsOpenedLanguageSelector.data.target_language,
onClickFunction: () => toggleSelector("target_language", currentIsOpenedLanguageSelector.target_language, updateIsOpenedLanguageSelector), onClickFunction: () => toggleSelector("target_language", currentIsOpenedLanguageSelector.data.target_language, updateIsOpenedLanguageSelector),
TurnedOnSvgComponent: <HeadphonesSvg />, TurnedOnSvgComponent: <HeadphonesSvg />,
is_turned_on: currentTranscriptionReceiveStatus.data, is_turned_on: currentTranscriptionReceiveStatus.data,
variable: target_language_data?.primary, variable: target_language_data?.primary,

View File

@@ -14,11 +14,10 @@ export const TranslatorSelectorOpenButton = () => {
currentSelectedTranslationEngines, currentSelectedTranslationEngines,
} = useLanguageSettings(); } = useLanguageSettings();
// console.log(currentTranslationEngines, currentSelectedTranslationEngines); const selected_translator_name = (currentTranslationEngines.state === "pending")
const selected_translator_name = (currentTranslationEngines.state === "loading")
? "Loading..." ? "Loading..."
: currentTranslationEngines.data.find( : currentTranslationEngines.data.find(
translator_data => translator_data.translator_id === currentSelectedTranslationEngines[currentSelectedPresetTabNumber.data] translator_data => translator_data.translator_id === currentSelectedTranslationEngines.data[currentSelectedPresetTabNumber.data]
)?.translator_name; )?.translator_name;
@@ -26,7 +25,7 @@ export const TranslatorSelectorOpenButton = () => {
const openTranslatorSelector = () => { const openTranslatorSelector = () => {
getTranslationEngines(); getTranslationEngines();
updateIsOpenedTranslatorSelector(!currentIsOpenedTranslatorSelector); updateIsOpenedTranslatorSelector(!currentIsOpenedTranslatorSelector.data);
}; };
return ( return (
@@ -35,7 +34,7 @@ export const TranslatorSelectorOpenButton = () => {
<p className={styles.label}>{t("main_page.translator")}: </p> <p className={styles.label}>{t("main_page.translator")}: </p>
<p className={styles.label}>{selected_translator_name}</p> <p className={styles.label}>{selected_translator_name}</p>
</div> </div>
{currentIsOpenedTranslatorSelector && {currentIsOpenedTranslatorSelector.data &&
<TranslatorSelector <TranslatorSelector
selected_translator_id={currentSelectedTranslationEngines} selected_translator_id={currentSelectedTranslationEngines}
translation_engines={currentTranslationEngines} translation_engines={currentTranslationEngines}

View File

@@ -15,7 +15,7 @@ import { useStore_IsMainPageCompactMode } from "@store";
export const LogoBox = () => { export const LogoBox = () => {
const { currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode(); const { currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode();
if (currentIsMainPageCompactMode === true) { if (currentIsMainPageCompactMode.data === true) {
return <img src={chato_img} className={styles.logo_chato} alt="VRCT logo chato" />; return <img src={chato_img} className={styles.logo_chato} alt="VRCT logo chato" />;
} else { } else {
return <img src={vrct_logo} className={styles.logo} alt="VRCT logo" />; return <img src={vrct_logo} className={styles.logo} alt="VRCT logo" />;

View File

@@ -77,9 +77,9 @@ export const SwitchContainer = ({ switchLabel, switch_id, children, currentState
const { currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode(); const { currentIsMainPageCompactMode } = useStore_IsMainPageCompactMode();
const getClassNames = (baseClass) => clsx(baseClass, { const getClassNames = (baseClass) => clsx(baseClass, {
[styles.is_compact_mode]: currentIsMainPageCompactMode, [styles.is_compact_mode]: currentIsMainPageCompactMode.data,
[styles.is_active]: (currentState.data === true), [styles.is_active]: (currentState.data === true),
[styles.is_loading]: (currentState.state === "loading"), [styles.is_loading]: (currentState.state === "pending"),
[styles.is_hovered]: is_hovered, [styles.is_hovered]: is_hovered,
[styles.is_mouse_down]: is_mouse_down, [styles.is_mouse_down]: is_mouse_down,
}); });
@@ -108,7 +108,7 @@ export const SwitchContainer = ({ switchLabel, switch_id, children, currentState
</div> </div>
<div className={getClassNames(styles.switch_indicator)}></div> <div className={getClassNames(styles.switch_indicator)}></div>
{(currentState.state === "loading") {(currentState.state === "pending")
? <span className={styles.loader}></span> ? <span className={styles.loader}></span>
: null : null
} }

View File

@@ -71,8 +71,8 @@ const generateMessageObject = (data, category) => {
}; };
const updateItemById = (id, translated_data) => (prev_items) => { const updateItemById = (id, translated_data) => (current_items) => {
return prev_items.map(item => { return current_items.data.map(item => {
if (item.id === id) { if (item.id === id) {
item.status = "ok"; item.status = "ok";
item.messages.translated = translated_data; item.messages.translated = translated_data;

View File

@@ -11,17 +11,24 @@ export const useVolume = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { updateMicVolume } = useStore_MicVolume(); const { updateMicVolume } = useStore_MicVolume();
const { updateSpeakerVolume } = useStore_SpeakerVolume(); const { updateSpeakerVolume } = useStore_SpeakerVolume();
const { currentMicThresholdCheckStatus, updateMicThresholdCheckStatus } = useStore_MicThresholdCheckStatus(); const {
const { currentSpeakerThresholdCheckStatus, updateSpeakerThresholdCheckStatus } = useStore_SpeakerThresholdCheckStatus(); currentMicThresholdCheckStatus,
updateMicThresholdCheckStatus,
pendingMicThresholdCheckStatus,
} = useStore_MicThresholdCheckStatus();
const {
currentSpeakerThresholdCheckStatus,
updateSpeakerThresholdCheckStatus,
pendingSpeakerThresholdCheckStatus,
} = useStore_SpeakerThresholdCheckStatus();
const asyncPending = () => new Promise(() => {});
return { return {
volumeCheckStart_Mic: () => { volumeCheckStart_Mic: () => {
updateMicThresholdCheckStatus(asyncPending); pendingMicThresholdCheckStatus();
asyncStdoutToPython("/set/enable_check_mic_threshold"); asyncStdoutToPython("/set/enable_check_mic_threshold");
}, },
volumeCheckStop_Mic: () => { volumeCheckStop_Mic: () => {
updateMicThresholdCheckStatus(asyncPending); pendingMicThresholdCheckStatus();
asyncStdoutToPython("/set/disable_check_mic_threshold"); asyncStdoutToPython("/set/disable_check_mic_threshold");
}, },
updateVolumeVariable_Mic: (payload) => { updateVolumeVariable_Mic: (payload) => {
@@ -35,11 +42,11 @@ export const useVolume = () => {
volumeCheckStart_Speaker: () => { volumeCheckStart_Speaker: () => {
updateSpeakerVolume("0"); updateSpeakerVolume("0");
updateSpeakerThresholdCheckStatus(asyncPending); pendingSpeakerThresholdCheckStatus();
asyncStdoutToPython("/set/enable_check_speaker_threshold"); asyncStdoutToPython("/set/enable_check_speaker_threshold");
}, },
volumeCheckStop_Speaker: () => { volumeCheckStop_Speaker: () => {
updateSpeakerThresholdCheckStatus(asyncPending); pendingSpeakerThresholdCheckStatus();
asyncStdoutToPython("/set/disable_check_speaker_threshold"); asyncStdoutToPython("/set/disable_check_speaker_threshold");
}, },
updateVolumeVariable_Speaker: (payload) => { updateVolumeVariable_Speaker: (payload) => {

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useEnableAutoClearMessageBox = () => { export const useEnableAutoClearMessageBox = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox } = useStore_EnableAutoClearMessageBox(); const { currentEnableAutoClearMessageBox, updateEnableAutoClearMessageBox, pendingEnableAutoClearMessageBox } = useStore_EnableAutoClearMessageBox();
const getEnableAutoClearMessageBox = () => { const getEnableAutoClearMessageBox = () => {
updateEnableAutoClearMessageBox(() => new Promise(() => {})); pendingEnableAutoClearMessageBox();
asyncStdoutToPython("/get/auto_clear_message_box"); asyncStdoutToPython("/get/auto_clear_message_box");
}; };
const toggleEnableAutoClearMessageBox = () => { const toggleEnableAutoClearMessageBox = () => {
updateEnableAutoClearMessageBox(() => new Promise(() => {})); pendingEnableAutoClearMessageBox();
if (currentEnableAutoClearMessageBox.data) { if (currentEnableAutoClearMessageBox.data) {
asyncStdoutToPython("/set/disable_auto_clear_message_box"); asyncStdoutToPython("/set/disable_auto_clear_message_box");
} else { } else {

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useEnableAutoMicSelect = () => { export const useEnableAutoMicSelect = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect } = useStore_EnableAutoMicSelect(); const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
const getEnableAutoMicSelect = () => { const getEnableAutoMicSelect = () => {
updateEnableAutoMicSelect(() => new Promise(() => {})); pendingEnableAutoMicSelect();
asyncStdoutToPython("/get/auto_mic_select"); asyncStdoutToPython("/get/auto_mic_select");
}; };
const toggleEnableAutoMicSelect = () => { const toggleEnableAutoMicSelect = () => {
updateEnableAutoMicSelect(() => new Promise(() => {})); pendingEnableAutoMicSelect();
if (currentEnableAutoMicSelect.data) { if (currentEnableAutoMicSelect.data) {
asyncStdoutToPython("/set/disable_auto_mic_select"); asyncStdoutToPython("/set/disable_auto_mic_select");
} else { } else {

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useEnableAutoSpeakerSelect = () => { export const useEnableAutoSpeakerSelect = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect(); const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect();
const getEnableAutoSpeakerSelect = () => { const getEnableAutoSpeakerSelect = () => {
updateEnableAutoSpeakerSelect(() => new Promise(() => {})); pendingEnableAutoSpeakerSelect();
asyncStdoutToPython("/get/auto_speaker_select"); asyncStdoutToPython("/get/auto_speaker_select");
}; };
const toggleEnableAutoSpeakerSelect = () => { const toggleEnableAutoSpeakerSelect = () => {
updateEnableAutoSpeakerSelect(() => new Promise(() => {})); pendingEnableAutoSpeakerSelect();
if (currentEnableAutoSpeakerSelect.data) { if (currentEnableAutoSpeakerSelect.data) {
asyncStdoutToPython("/set/disable_auto_speaker_select"); asyncStdoutToPython("/set/disable_auto_speaker_select");
} else { } else {

View File

@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useMicDeviceList = () => { export const useMicDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentMicDeviceList, updateMicDeviceList } = useStore_MicDeviceList(); const { currentMicDeviceList, updateMicDeviceList, pendingMicDeviceList } = useStore_MicDeviceList();
const getMicDeviceList = () => { const getMicDeviceList = () => {
updateMicDeviceList(() => new Promise(() => {})); pendingMicDeviceList();
asyncStdoutToPython("/get/list_mic_device"); asyncStdoutToPython("/get/list_mic_device");
}; };

View File

@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useMicHostList = () => { export const useMicHostList = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentMicHostList, updateMicHostList } = useStore_MicHostList(); const { currentMicHostList, updateMicHostList, pendingMicHostList } = useStore_MicHostList();
const getMicHostList = () => { const getMicHostList = () => {
updateMicHostList(() => new Promise(() => {})); pendingMicHostList();
asyncStdoutToPython("/get/list_mic_host"); asyncStdoutToPython("/get/list_mic_host");
}; };

View File

@@ -4,7 +4,7 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useMicThreshold = () => { export const useMicThreshold = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold(); const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold();
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold(); const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
const getMicThreshold = () => { const getMicThreshold = () => {
asyncStdoutToPython("/get/mic_energy_threshold"); asyncStdoutToPython("/get/mic_energy_threshold");
@@ -15,12 +15,12 @@ export const useMicThreshold = () => {
}; };
const getEnableAutomaticMicThreshold = () => { const getEnableAutomaticMicThreshold = () => {
updateEnableAutomaticMicThreshold(() => new Promise(() => {})); pendingEnableAutomaticMicThreshold();
asyncStdoutToPython("/get/mic_dynamic_energy_threshold"); asyncStdoutToPython("/get/mic_dynamic_energy_threshold");
}; };
const toggleEnableAutomaticMicThreshold = () => { const toggleEnableAutomaticMicThreshold = () => {
updateEnableAutomaticMicThreshold(() => new Promise(() => {})); pendingEnableAutomaticMicThreshold();
if (currentEnableAutomaticMicThreshold.data) { if (currentEnableAutomaticMicThreshold.data) {
asyncStdoutToPython("/set/disable_mic_dynamic_energy_threshold"); asyncStdoutToPython("/set/disable_mic_dynamic_energy_threshold");
} else { } else {

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSelectedMicDevice = () => { export const useSelectedMicDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentSelectedMicDevice, updateSelectedMicDevice } = useStore_SelectedMicDevice(); const { currentSelectedMicDevice, updateSelectedMicDevice, pendingSelectedMicDevice } = useStore_SelectedMicDevice();
const getSelectedMicDevice = () => { const getSelectedMicDevice = () => {
updateSelectedMicDevice(() => new Promise(() => {})); pendingSelectedMicDevice();
asyncStdoutToPython("/get/selected_mic_device"); asyncStdoutToPython("/get/selected_mic_device");
}; };
const setSelectedMicDevice = (selected_mic_device) => { const setSelectedMicDevice = (selected_mic_device) => {
updateSelectedMicDevice(() => new Promise(() => {})); pendingSelectedMicDevice();
asyncStdoutToPython("/set/selected_mic_device", selected_mic_device); asyncStdoutToPython("/set/selected_mic_device", selected_mic_device);
}; };

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSelectedMicHost = () => { export const useSelectedMicHost = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentSelectedMicHost, updateSelectedMicHost } = useStore_SelectedMicHost(); const { currentSelectedMicHost, updateSelectedMicHost, pendingSelectedMicHost } = useStore_SelectedMicHost();
const getSelectedMicHost = () => { const getSelectedMicHost = () => {
updateSelectedMicHost(() => new Promise(() => {})); pendingSelectedMicHost();
asyncStdoutToPython("/get/selected_mic_host"); asyncStdoutToPython("/get/selected_mic_host");
}; };
const setSelectedMicHost = (selected_mic_host) => { const setSelectedMicHost = (selected_mic_host) => {
updateSelectedMicHost(() => new Promise(() => {})); pendingSelectedMicHost();
asyncStdoutToPython("/set/selected_mic_host", selected_mic_host); asyncStdoutToPython("/set/selected_mic_host", selected_mic_host);
}; };

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSelectedSpeakerDevice = () => { export const useSelectedSpeakerDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice(); const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice();
const getSelectedSpeakerDevice = () => { const getSelectedSpeakerDevice = () => {
updateSelectedSpeakerDevice(() => new Promise(() => {})); pendingSelectedSpeakerDevice();
asyncStdoutToPython("/get/selected_speaker_device"); asyncStdoutToPython("/get/selected_speaker_device");
}; };
const setSelectedSpeakerDevice = (selected_speaker_device) => { const setSelectedSpeakerDevice = (selected_speaker_device) => {
updateSelectedSpeakerDevice(() => new Promise(() => {})); pendingSelectedSpeakerDevice();
asyncStdoutToPython("/set/selected_speaker_device", selected_speaker_device); asyncStdoutToPython("/set/selected_speaker_device", selected_speaker_device);
}; };

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSendMessageButtonType = () => { export const useSendMessageButtonType = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentSendMessageButtonType, updateSendMessageButtonType } = useStore_SendMessageButtonType(); const { currentSendMessageButtonType, updateSendMessageButtonType, pendingSendMessageButtonType } = useStore_SendMessageButtonType();
const getSendMessageButtonType = () => { const getSendMessageButtonType = () => {
updateSendMessageButtonType(() => new Promise(() => {})); pendingSendMessageButtonType();
asyncStdoutToPython("/get/send_message_button_type"); asyncStdoutToPython("/get/send_message_button_type");
}; };
const setSendMessageButtonType = (selected_type) => { const setSendMessageButtonType = (selected_type) => {
updateSendMessageButtonType(() => new Promise(() => {})); pendingSendMessageButtonType();
asyncStdoutToPython("/set/send_message_button_type", selected_type); asyncStdoutToPython("/set/send_message_button_type", selected_type);
}; };

View File

@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSoftwareVersion = () => { export const useSoftwareVersion = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentSoftwareVersion, updateSoftwareVersion } = useStore_SoftwareVersion(); const { currentSoftwareVersion, updateSoftwareVersion, pendingSoftwareVersion } = useStore_SoftwareVersion();
const getSoftwareVersion = () => { const getSoftwareVersion = () => {
updateSoftwareVersion(() => new Promise(() => {})); pendingSoftwareVersion();
asyncStdoutToPython("/get/version"); asyncStdoutToPython("/get/version");
}; };

View File

@@ -3,10 +3,10 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSpeakerDeviceList = () => { export const useSpeakerDeviceList = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentSpeakerDeviceList, updateSpeakerDeviceList } = useStore_SpeakerDeviceList(); const { currentSpeakerDeviceList, updateSpeakerDeviceList, pendingSpeakerDeviceList } = useStore_SpeakerDeviceList();
const getSpeakerDeviceList = () => { const getSpeakerDeviceList = () => {
updateSpeakerDeviceList(() => new Promise(() => {})); pendingSpeakerDeviceList();
asyncStdoutToPython("/get/list_speaker_device"); asyncStdoutToPython("/get/list_speaker_device");
}; };

View File

@@ -4,7 +4,7 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useSpeakerThreshold = () => { export const useSpeakerThreshold = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold(); const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold();
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold(); const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
const getSpeakerThreshold = () => { const getSpeakerThreshold = () => {
asyncStdoutToPython("/get/speaker_energy_threshold"); asyncStdoutToPython("/get/speaker_energy_threshold");
@@ -15,12 +15,12 @@ export const useSpeakerThreshold = () => {
}; };
const getEnableAutomaticSpeakerThreshold = () => { const getEnableAutomaticSpeakerThreshold = () => {
updateEnableAutomaticSpeakerThreshold(() => new Promise(() => {})); pendingEnableAutomaticSpeakerThreshold();
asyncStdoutToPython("/get/speaker_dynamic_energy_threshold"); asyncStdoutToPython("/get/speaker_dynamic_energy_threshold");
}; };
const toggleEnableAutomaticSpeakerThreshold = () => { const toggleEnableAutomaticSpeakerThreshold = () => {
updateEnableAutomaticSpeakerThreshold(() => new Promise(() => {})); pendingEnableAutomaticSpeakerThreshold();
if (currentEnableAutomaticSpeakerThreshold.data) { if (currentEnableAutomaticSpeakerThreshold.data) {
asyncStdoutToPython("/set/disable_speaker_dynamic_energy_threshold"); asyncStdoutToPython("/set/disable_speaker_dynamic_energy_threshold");
} else { } else {

View File

@@ -3,15 +3,15 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useUiLanguage = () => { export const useUiLanguage = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentUiLanguage, updateUiLanguage } = useStore_UiLanguage(); const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage();
const getUiLanguage = () => { const getUiLanguage = () => {
updateUiLanguage(() => new Promise(() => {})); pendingUiLanguage();
asyncStdoutToPython("/get/ui_language"); asyncStdoutToPython("/get/ui_language");
}; };
const setUiLanguage = (selected_ui_language) => { const setUiLanguage = (selected_ui_language) => {
updateUiLanguage(() => new Promise(() => {})); pendingUiLanguage();
asyncStdoutToPython("/set/ui_language", selected_ui_language); asyncStdoutToPython("/set/ui_language", selected_ui_language);
}; };

View File

@@ -3,37 +3,61 @@ import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useLanguageSettings = () => { export const useLanguageSettings = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const { currentEnableMultiTranslation, updateEnableMultiTranslation } = useStore_EnableMultiTranslation(); const {
const { currentSelectedYourLanguages, updateSelectedYourLanguages } = useStore_SelectedYourLanguages(); currentEnableMultiTranslation,
const { currentSelectedTargetLanguages, updateSelectedTargetLanguages } = useStore_SelectedTargetLanguages(); updateEnableMultiTranslation,
const { currentSelectedPresetTabNumber, updateSelectedPresetTabNumber } = useStore_SelectedPresetTabNumber(); pendingEnableMultiTranslation,
const { currentTranslationEngines, updateTranslationEngines } = useStore_TranslationEngines(); } = useStore_EnableMultiTranslation();
const { currentSelectedTranslationEngines, updateSelectedTranslationEngines } = useStore_SelectedTranslationEngines(); const {
currentSelectedYourLanguages,
updateSelectedYourLanguages,
pendingSelectedYourLanguages,
} = useStore_SelectedYourLanguages();
const {
currentSelectedTargetLanguages,
updateSelectedTargetLanguages,
pendingSelectedTargetLanguages,
} = useStore_SelectedTargetLanguages();
const {
currentSelectedPresetTabNumber,
updateSelectedPresetTabNumber,
pendingSelectedPresetTabNumber,
} = useStore_SelectedPresetTabNumber();
const {
currentTranslationEngines,
updateTranslationEngines,
pendingTranslationEngines,
} = useStore_TranslationEngines();
const {
currentSelectedTranslationEngines,
updateSelectedTranslationEngines,
pendingSelectedTranslationEngines,
} = useStore_SelectedTranslationEngines();
const getEnableMultiTranslation = () => { const getEnableMultiTranslation = () => {
updateEnableMultiTranslation(() => new Promise(() => {})); pendingEnableMultiTranslation();
asyncStdoutToPython("/get/multi_language_translation"); asyncStdoutToPython("/get/multi_language_translation");
}; };
const getSelectedPresetTabNumber = () => { const getSelectedPresetTabNumber = () => {
updateSelectedPresetTabNumber(() => new Promise(() => {})); pendingSelectedPresetTabNumber();
asyncStdoutToPython("/get/selected_tab_no"); asyncStdoutToPython("/get/selected_tab_no");
}; };
const setSelectedPresetTabNumber = (preset_number) => { const setSelectedPresetTabNumber = (preset_number) => {
updateSelectedPresetTabNumber(() => new Promise(() => {})); pendingSelectedPresetTabNumber();
asyncStdoutToPython("/set/selected_tab_no", preset_number); asyncStdoutToPython("/set/selected_tab_no", preset_number);
}; };
const getSelectedYourLanguages = () => { const getSelectedYourLanguages = () => {
updateSelectedYourLanguages(() => new Promise(() => {})); pendingSelectedPresetTabNumber();
asyncStdoutToPython("/get/selected_your_languages"); asyncStdoutToPython("/get/selected_your_languages");
}; };
const setSelectedYourLanguages = (selected_language_data) => { const setSelectedYourLanguages = (selected_language_data) => {
// updateSelectedYourLanguages(() => new Promise(() => {})); pendingSelectedYourLanguages();
const send_obj = { const send_obj = {
...currentSelectedYourLanguages.data, ...currentSelectedYourLanguages.data,
[currentSelectedPresetTabNumber.data]: { [currentSelectedPresetTabNumber.data]: {
@@ -48,12 +72,12 @@ export const useLanguageSettings = () => {
const getSelectedTargetLanguages = () => { const getSelectedTargetLanguages = () => {
updateSelectedTargetLanguages(() => new Promise(() => {})); pendingSelectedTargetLanguages();
asyncStdoutToPython("/get/selected_target_languages"); asyncStdoutToPython("/get/selected_target_languages");
}; };
const setSelectedTargetLanguages = (selected_language_data) => { const setSelectedTargetLanguages = (selected_language_data) => {
// updateSelectedTargetLanguages(() => new Promise(() => {})); pendingSelectedTargetLanguages();
let send_obj = currentSelectedTargetLanguages.data; let send_obj = currentSelectedTargetLanguages.data;
send_obj[currentSelectedPresetTabNumber.data].primary.language = selected_language_data.language, send_obj[currentSelectedPresetTabNumber.data].primary.language = selected_language_data.language,
@@ -64,21 +88,19 @@ export const useLanguageSettings = () => {
const getTranslationEngines = () => { const getTranslationEngines = () => {
updateTranslationEngines(() => new Promise(() => {})); pendingTranslationEngines();
asyncStdoutToPython("/get/list_translation_engines"); asyncStdoutToPython("/get/list_translation_engines");
}; };
const getSelectedTranslationEngines = () => { const getSelectedTranslationEngines = () => {
updateSelectedTranslationEngines(() => new Promise(() => {})); pendingSelectedTranslationEngines();
asyncStdoutToPython("/get/selected_translator_engines"); asyncStdoutToPython("/get/selected_translator_engines");
}; };
const setSelectedTranslationEngines = (selected_translator) => { const setSelectedTranslationEngines = (selected_translator) => {
// updateSelectedTranslationEngines(() => new Promise(() => {})); pendingSelectedTranslationEngines();
let send_obj = currentSelectedTranslationEngines; let send_obj = currentSelectedTranslationEngines.data;
send_obj[currentSelectedPresetTabNumber.data] = selected_translator; send_obj[currentSelectedPresetTabNumber.data] = selected_translator;
asyncStdoutToPython("/set/selected_translator_engines", send_obj); asyncStdoutToPython("/set/selected_translator_engines", send_obj);
}; };

View File

@@ -13,17 +13,17 @@ export const useMainFunction = () => {
const { const {
currentTranslationStatus, currentTranslationStatus,
updateTranslationStatus, updateTranslationStatus,
asyncUpdateTranslationStatus, pendingTranslationStatus,
} = useStore_TranslationStatus(); } = useStore_TranslationStatus();
const { const {
currentTranscriptionSendStatus, currentTranscriptionSendStatus,
updateTranscriptionSendStatus, updateTranscriptionSendStatus,
asyncUpdateTranscriptionSendStatus, pendingTranscriptionSendStatus,
} = useStore_TranscriptionSendStatus(); } = useStore_TranscriptionSendStatus();
const { const {
currentTranscriptionReceiveStatus, currentTranscriptionReceiveStatus,
updateTranscriptionReceiveStatus, updateTranscriptionReceiveStatus,
asyncUpdateTranscriptionReceiveStatus, pendingTranscriptionReceiveStatus,
} = useStore_TranscriptionReceiveStatus(); } = useStore_TranscriptionReceiveStatus();
const { const {
currentForegroundStatus, currentForegroundStatus,
@@ -32,9 +32,8 @@ export const useMainFunction = () => {
const { asyncStdoutToPython } = useStdoutToPython(); const { asyncStdoutToPython } = useStdoutToPython();
const asyncPending = () => new Promise(() => {});
const toggleTranslation = () => { const toggleTranslation = () => {
asyncUpdateTranslationStatus(asyncPending); pendingTranslationStatus();
if (currentTranslationStatus.data) { if (currentTranslationStatus.data) {
asyncStdoutToPython("/set/disable_translation"); asyncStdoutToPython("/set/disable_translation");
} else { } else {
@@ -43,7 +42,7 @@ export const useMainFunction = () => {
}; };
const toggleTranscriptionSend = () => { const toggleTranscriptionSend = () => {
asyncUpdateTranscriptionSendStatus(asyncPending); pendingTranscriptionSendStatus();
if (currentTranscriptionSendStatus.data) { if (currentTranscriptionSendStatus.data) {
asyncStdoutToPython("/set/disable_transcription_send"); asyncStdoutToPython("/set/disable_transcription_send");
} else { } else {
@@ -52,7 +51,7 @@ export const useMainFunction = () => {
}; };
const toggleTranscriptionReceive = () => { const toggleTranscriptionReceive = () => {
asyncUpdateTranscriptionReceiveStatus(asyncPending); pendingTranscriptionReceiveStatus();
if (currentTranscriptionReceiveStatus.data) { if (currentTranscriptionReceiveStatus.data) {
asyncStdoutToPython("/set/disable_transcription_receive"); asyncStdoutToPython("/set/disable_transcription_receive");
} else { } else {

View File

@@ -17,8 +17,11 @@ export const store = {
}; };
const generatePropertyNames = (base_ame) => ({ const generatePropertyNames = (base_ame) => ({
error: `error${base_ame}`,
pending: `pending${base_ame}`,
current: `current${base_ame}`, current: `current${base_ame}`,
update: `update${base_ame}`, update: `update${base_ame}`,
updatePart: `updatePart${base_ame}`,
async_update: `asyncUpdate${base_ame}`, async_update: `asyncUpdate${base_ame}`,
add: `add${base_ame}`, add: `add${base_ame}`,
async_add: `asyncAdd${base_ame}`, async_add: `asyncAdd${base_ame}`,
@@ -94,64 +97,136 @@ const createAsyncAtomWithHook = (initialValue, base_ame) => {
return { atomInstance, useHook }; return { atomInstance, useHook };
}; };
export const { atomInstance: Atom_SoftwareVersion, useHook: useStore_SoftwareVersion } = createAtomWithHook("-", "SoftwareVersion");
export const { atomInstance: Atom_TranslationStatus, useHook: useStore_TranslationStatus } = createAsyncAtomWithHook(false, "TranslationStatus"); const createAtomWithHook_WIP = (initialValue, base_ame, options) => {
export const { atomInstance: Atom_TranscriptionSendStatus, useHook: useStore_TranscriptionSendStatus } = createAsyncAtomWithHook(false, "TranscriptionSendStatus"); const property_names = generatePropertyNames(base_ame);
export const { atomInstance: Atom_TranscriptionReceiveStatus, useHook: useStore_TranscriptionReceiveStatus } = createAsyncAtomWithHook(false, "TranscriptionReceiveStatus"); const atomInstance = atom({
export const { atomInstance: Atom_ForegroundStatus, useHook: useStore_ForegroundStatus } = createAsyncAtomWithHook(false, "ForegroundStatus"); state: (options?.is_state_ok) ? "ok" : "pending",
data: initialValue,
});
export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook(generateTestData(20), "MessageLogs"); const useHook = () => {
export const { atomInstance: Atom_IsMainPageCompactMode, useHook: useStore_IsMainPageCompactMode } = createAtomWithHook(false, "IsMainPageCompactMode"); const currentAtom = useAtomValue(atomInstance);
const setAtom = useSetAtom(atomInstance);
export const { atomInstance: Atom_IsOpenedLanguageSelector, useHook: useStore_IsOpenedLanguageSelector } = createAtomWithHook( const pendingAtom = () => {
setAtom((old_value) => {
let new_value = {
state: "pending",
data: old_value.data,
};
return new_value;
});
};
const updateAtom = (payload) => {
setAtom((currentValue) => {
if (typeof payload === "function") {
const updated_data = payload(currentValue);
return {
state: "ok",
data: updated_data,
};
} else {
return {
state: "ok",
data: payload,
};
}
});
};
const errorAtom = () => {
setAtom((old_value) => {
let new_value = {
state: "error",
data: old_value.data,
};
return new_value;
});
};
const addAtom = (value) => {
setAtom((old_value) => {
return {
state: "ok",
data: [...old_value.data, value],
};
});
};
return {
[property_names.error]: errorAtom,
[property_names.pending]: pendingAtom,
[property_names.current]: currentAtom,
[property_names.update]: updateAtom,
[property_names.add]: addAtom,
};
};
return { atomInstance, useHook };
};
export const { atomInstance: Atom_SoftwareVersion, useHook: useStore_SoftwareVersion } = createAtomWithHook_WIP("-", "SoftwareVersion");
export const { atomInstance: Atom_TranslationStatus, useHook: useStore_TranslationStatus } = createAtomWithHook_WIP(false, "TranslationStatus", {is_state_ok: true});
export const { atomInstance: Atom_TranscriptionSendStatus, useHook: useStore_TranscriptionSendStatus } = createAtomWithHook_WIP(false, "TranscriptionSendStatus", {is_state_ok: true});
export const { atomInstance: Atom_TranscriptionReceiveStatus, useHook: useStore_TranscriptionReceiveStatus } = createAtomWithHook_WIP(false, "TranscriptionReceiveStatus", {is_state_ok: true});
export const { atomInstance: Atom_ForegroundStatus, useHook: useStore_ForegroundStatus } = createAtomWithHook_WIP(false, "ForegroundStatus", {is_state_ok: true});
export const { atomInstance: Atom_MessageLogs, useHook: useStore_MessageLogs } = createAtomWithHook_WIP(generateTestData(20), "MessageLogs");
export const { atomInstance: Atom_IsMainPageCompactMode, useHook: useStore_IsMainPageCompactMode } = createAtomWithHook_WIP(false, "IsMainPageCompactMode");
export const { atomInstance: Atom_IsOpenedLanguageSelector, useHook: useStore_IsOpenedLanguageSelector } = createAtomWithHook_WIP(
{ your_language: false, target_language: false }, { your_language: false, target_language: false },
"IsOpenedLanguageSelector" "IsOpenedLanguageSelector"
); );
export const { atomInstance: Atom_SelectableLanguageList, useHook: useStore_SelectableLanguageList } = createAtomWithHook([], "SelectableLanguageList"); export const { atomInstance: Atom_SelectableLanguageList, useHook: useStore_SelectableLanguageList } = createAtomWithHook_WIP([], "SelectableLanguageList");
export const { atomInstance: Atom_SelectedPresetTabNumber, useHook: useStore_SelectedPresetTabNumber } = createAsyncAtomWithHook("", "SelectedPresetTabNumber"); export const { atomInstance: Atom_SelectedPresetTabNumber, useHook: useStore_SelectedPresetTabNumber } = createAtomWithHook_WIP("", "SelectedPresetTabNumber");
export const { atomInstance: Atom_EnableMultiTranslation, useHook: useStore_EnableMultiTranslation } = createAsyncAtomWithHook(false, "EnableMultiTranslation"); export const { atomInstance: Atom_EnableMultiTranslation, useHook: useStore_EnableMultiTranslation } = createAtomWithHook_WIP(false, "EnableMultiTranslation");
export const { atomInstance: Atom_SelectedYourLanguages, useHook: useStore_SelectedYourLanguages } = createAsyncAtomWithHook({}, "SelectedYourLanguages"); export const { atomInstance: Atom_SelectedYourLanguages, useHook: useStore_SelectedYourLanguages } = createAtomWithHook_WIP({}, "SelectedYourLanguages");
export const { atomInstance: Atom_SelectedTargetLanguages, useHook: useStore_SelectedTargetLanguages } = createAsyncAtomWithHook({}, "SelectedTargetLanguages"); export const { atomInstance: Atom_SelectedTargetLanguages, useHook: useStore_SelectedTargetLanguages } = createAtomWithHook_WIP({}, "SelectedTargetLanguages");
export const { atomInstance: Atom_TranslationEngines, useHook: useStore_TranslationEngines } = createAsyncAtomWithHook(translator_status, "TranslationEngines"); export const { atomInstance: Atom_TranslationEngines, useHook: useStore_TranslationEngines } = createAtomWithHook_WIP(translator_status, "TranslationEngines");
export const { atomInstance: Atom_SelectedTranslationEngines, useHook: useStore_SelectedTranslationEngines } = createAtomWithHook({}, "SelectedTranslationEngines"); export const { atomInstance: Atom_SelectedTranslationEngines, useHook: useStore_SelectedTranslationEngines } = createAtomWithHook_WIP({}, "SelectedTranslationEngines");
export const { atomInstance: Atom_IsOpenedConfigPage, useHook: useStore_IsOpenedConfigPage } = createAtomWithHook(false, "IsOpenedConfigPage"); export const { atomInstance: Atom_IsOpenedConfigPage, useHook: useStore_IsOpenedConfigPage } = createAtomWithHook_WIP(false, "IsOpenedConfigPage");
export const { atomInstance: Atom_SelectedConfigTabId, useHook: useStore_SelectedConfigTabId } = createAtomWithHook("device", "SelectedConfigTabId"); export const { atomInstance: Atom_SelectedConfigTabId, useHook: useStore_SelectedConfigTabId } = createAtomWithHook_WIP("device", "SelectedConfigTabId");
export const { atomInstance: Atom_IsOpenedDropdownMenu, useHook: useStore_IsOpenedDropdownMenu } = createAtomWithHook("", "IsOpenedDropdownMenu"); export const { atomInstance: Atom_IsOpenedDropdownMenu, useHook: useStore_IsOpenedDropdownMenu } = createAtomWithHook_WIP("", "IsOpenedDropdownMenu");
// Config Page // Config Page
export const { atomInstance: Atom_EnableAutoMicSelect, useHook: useStore_EnableAutoMicSelect } = createAsyncAtomWithHook(true, "EnableAutoMicSelect"); export const { atomInstance: Atom_EnableAutoMicSelect, useHook: useStore_EnableAutoMicSelect } = createAtomWithHook_WIP(true, "EnableAutoMicSelect");
export const { atomInstance: Atom_EnableAutoSpeakerSelect, useHook: useStore_EnableAutoSpeakerSelect } = createAsyncAtomWithHook(true, "EnableAutoSpeakerSelect"); export const { atomInstance: Atom_EnableAutoSpeakerSelect, useHook: useStore_EnableAutoSpeakerSelect } = createAtomWithHook_WIP(true, "EnableAutoSpeakerSelect");
export const { atomInstance: Atom_MicHostList, useHook: useStore_MicHostList } = createAsyncAtomWithHook({}, "MicHostList"); export const { atomInstance: Atom_MicHostList, useHook: useStore_MicHostList } = createAtomWithHook_WIP({}, "MicHostList");
export const { atomInstance: Atom_SelectedMicHost, useHook: useStore_SelectedMicHost } = createAsyncAtomWithHook("Nothing Selected", "SelectedMicHost"); export const { atomInstance: Atom_SelectedMicHost, useHook: useStore_SelectedMicHost } = createAtomWithHook_WIP("Nothing Selected", "SelectedMicHost");
export const { atomInstance: Atom_MicDeviceList, useHook: useStore_MicDeviceList } = createAsyncAtomWithHook({}, "MicDeviceList"); export const { atomInstance: Atom_MicDeviceList, useHook: useStore_MicDeviceList } = createAtomWithHook_WIP({}, "MicDeviceList");
export const { atomInstance: Atom_SelectedMicDevice, useHook: useStore_SelectedMicDevice } = createAsyncAtomWithHook("Nothing Selected", "SelectedMicDevice"); export const { atomInstance: Atom_SelectedMicDevice, useHook: useStore_SelectedMicDevice } = createAtomWithHook_WIP("Nothing Selected", "SelectedMicDevice");
export const { atomInstance: Atom_SpeakerDeviceList, useHook: useStore_SpeakerDeviceList } = createAsyncAtomWithHook({}, "SpeakerDeviceList"); export const { atomInstance: Atom_SpeakerDeviceList, useHook: useStore_SpeakerDeviceList } = createAtomWithHook_WIP({}, "SpeakerDeviceList");
export const { atomInstance: Atom_SelectedSpeakerDevice, useHook: useStore_SelectedSpeakerDevice } = createAsyncAtomWithHook("Nothing Selected", "SelectedSpeakerDevice"); export const { atomInstance: Atom_SelectedSpeakerDevice, useHook: useStore_SelectedSpeakerDevice } = createAtomWithHook_WIP("Nothing Selected", "SelectedSpeakerDevice");
export const { atomInstance: Atom_MicVolume, useHook: useStore_MicVolume } = createAsyncAtomWithHook(0, "MicVolume"); export const { atomInstance: Atom_MicVolume, useHook: useStore_MicVolume } = createAtomWithHook_WIP(0, "MicVolume");
export const { atomInstance: Atom_SpeakerVolume, useHook: useStore_SpeakerVolume } = createAsyncAtomWithHook(0, "SpeakerVolume"); export const { atomInstance: Atom_SpeakerVolume, useHook: useStore_SpeakerVolume } = createAtomWithHook_WIP(0, "SpeakerVolume");
export const { atomInstance: Atom_MicThresholdCheckStatus, useHook: useStore_MicThresholdCheckStatus } = createAsyncAtomWithHook(false, "MicThresholdCheckStatus"); export const { atomInstance: Atom_MicThresholdCheckStatus, useHook: useStore_MicThresholdCheckStatus } = createAtomWithHook_WIP(false, "MicThresholdCheckStatus", {is_state_ok: true});
export const { atomInstance: Atom_SpeakerThresholdCheckStatus, useHook: useStore_SpeakerThresholdCheckStatus } = createAsyncAtomWithHook(false, "SpeakerThresholdCheckStatus"); export const { atomInstance: Atom_SpeakerThresholdCheckStatus, useHook: useStore_SpeakerThresholdCheckStatus } = createAtomWithHook_WIP(false, "SpeakerThresholdCheckStatus", {is_state_ok: true});
export const { atomInstance: Atom_MicThreshold, useHook: useStore_MicThreshold } = createAtomWithHook(0, "MicThreshold"); export const { atomInstance: Atom_MicThreshold, useHook: useStore_MicThreshold } = createAtomWithHook_WIP(0, "MicThreshold");
export const { atomInstance: Atom_SpeakerThreshold, useHook: useStore_SpeakerThreshold } = createAtomWithHook(0, "SpeakerThreshold"); export const { atomInstance: Atom_SpeakerThreshold, useHook: useStore_SpeakerThreshold } = createAtomWithHook_WIP(0, "SpeakerThreshold");
export const { atomInstance: Atom_EnableAutomaticMicThreshold, useHook: useStore_EnableAutomaticMicThreshold } = createAsyncAtomWithHook(false, "EnableAutomaticMicThreshold"); export const { atomInstance: Atom_EnableAutomaticMicThreshold, useHook: useStore_EnableAutomaticMicThreshold } = createAtomWithHook_WIP(false, "EnableAutomaticMicThreshold");
export const { atomInstance: Atom_EnableAutomaticSpeakerThreshold, useHook: useStore_EnableAutomaticSpeakerThreshold } = createAsyncAtomWithHook(false, "EnableAutomaticSpeakerThreshold"); export const { atomInstance: Atom_EnableAutomaticSpeakerThreshold, useHook: useStore_EnableAutomaticSpeakerThreshold } = createAtomWithHook_WIP(false, "EnableAutomaticSpeakerThreshold");
// Appearance // Appearance
export const { atomInstance: Atom_UiLanguage, useHook: useStore_UiLanguage } = createAsyncAtomWithHook("en", "UiLanguage"); export const { atomInstance: Atom_UiLanguage, useHook: useStore_UiLanguage } = createAtomWithHook_WIP("en", "UiLanguage");
@@ -181,16 +256,16 @@ export const { atomInstance: Atom_ReceivedMessageFormatWithT, useHook: useStore_
is_message_first: true, is_message_first: true,
}, "ReceivedMessageFormatWithT"); }, "ReceivedMessageFormatWithT");
export const { atomInstance: Atom_IsOpenedWordFilterList, useHook: useStore_IsOpenedWordFilterList } = createAtomWithHook(false, "IsOpenedWordFilterList"); export const { atomInstance: Atom_IsOpenedWordFilterList, useHook: useStore_IsOpenedWordFilterList } = createAtomWithHook_WIP(false, "IsOpenedWordFilterList");
export const { atomInstance: Atom_WordFilterList, useHook: useStore_WordFilterList } = createAtomWithHook(word_filter_list, "WordFilterList"); export const { atomInstance: Atom_WordFilterList, useHook: useStore_WordFilterList } = createAtomWithHook_WIP(word_filter_list, "WordFilterList");
// Others // Others
export const { atomInstance: Atom_EnableAutoClearMessageBox, useHook: useStore_EnableAutoClearMessageBox } = createAsyncAtomWithHook(true, "EnableAutoClearMessageBox"); export const { atomInstance: Atom_EnableAutoClearMessageBox, useHook: useStore_EnableAutoClearMessageBox } = createAtomWithHook_WIP(true, "EnableAutoClearMessageBox");
export const { atomInstance: Atom_SendMessageButtonType, useHook: useStore_SendMessageButtonType } = createAsyncAtomWithHook("show", "SendMessageButtonType"); export const { atomInstance: Atom_SendMessageButtonType, useHook: useStore_SendMessageButtonType } = createAtomWithHook_WIP("show", "SendMessageButtonType");
export const { atomInstance: Atom_IsOpenedTranslatorSelector, useHook: useStore_IsOpenedTranslatorSelector } = createAtomWithHook(false, "IsOpenedTranslatorSelector"); export const { atomInstance: Atom_IsOpenedTranslatorSelector, useHook: useStore_IsOpenedTranslatorSelector } = createAtomWithHook_WIP(false, "IsOpenedTranslatorSelector");
export const { atomInstance: Atom_VrctPosterIndex, useHook: useStore_VrctPosterIndex } = createAtomWithHook(0, "VrctPosterIndex"); export const { atomInstance: Atom_VrctPosterIndex, useHook: useStore_VrctPosterIndex } = createAtomWithHook_WIP(0, "VrctPosterIndex");
export const { atomInstance: Atom_PosterShowcaseWorldPageIndex, useHook: useStore_PosterShowcaseWorldPageIndex } = createAtomWithHook(0, "PosterShowcaseWorldPageIndex"); export const { atomInstance: Atom_PosterShowcaseWorldPageIndex, useHook: useStore_PosterShowcaseWorldPageIndex } = createAtomWithHook_WIP(0, "PosterShowcaseWorldPageIndex");