diff --git a/locales/en.json b/locales/en.json
index 1d6cc59b..20523a0f 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -80,6 +80,7 @@
"invalid_value": "Invalid value."
},
"side_menu_labels": {
+ "device": "Device",
"appearance": "Appearance",
"translation": "Translation",
"transcription": "Transcription",
diff --git a/locales/ja.json b/locales/ja.json
index b98f5d06..d9bab947 100644
--- a/locales/ja.json
+++ b/locales/ja.json
@@ -78,6 +78,7 @@
"invalid_value": "無効な値です。"
},
"side_menu_labels": {
+ "device": "デバイス",
"appearance": "デザイン",
"translation": "翻訳",
"transcription": "音声認識",
diff --git a/src-ui/app/App.jsx b/src-ui/app/App.jsx
index 98b35cb1..fce5a72f 100644
--- a/src-ui/app/App.jsx
+++ b/src-ui/app/App.jsx
@@ -14,13 +14,19 @@ export const App = () => {
const main_page = getCurrent();
const { currentIsOpenedConfigPage } = useIsOpenedConfigPage();
- const { getSoftwareVersion } = useConfig();
+ const {
+ getSoftwareVersion,
+ getMicHostList,
+ getSelectedMicHost,
+ } = useConfig();
useEffect(() => {
main_page.setDecorations(true);
if (!hasRunRef.current) {
asyncStartPython().then((result) => {
getSoftwareVersion();
+ getMicHostList();
+ getSelectedMicHost();
}).catch((err) => {
});
diff --git a/src-ui/app/config_page/setting_section/setting_box/SettingBox.jsx b/src-ui/app/config_page/setting_section/setting_box/SettingBox.jsx
index 6a0fe095..a38b4f1e 100644
--- a/src-ui/app/config_page/setting_section/setting_box/SettingBox.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/SettingBox.jsx
@@ -1,15 +1,18 @@
import { useSelectedConfigTabId } from "@store";
+import { Device } from "./device/Device";
import { Appearance } from "./appearance/Appearance";
import { AboutVrct } from "./about_vrct/AboutVrct";
export const SettingBox = () => {
const { currentSelectedConfigTabId } = useSelectedConfigTabId();
switch (currentSelectedConfigTabId) {
- case "appearance":
- return ;
- case "about_vrct":
- return ;
+ case "device":
+ return ;
+ // case "appearance":
+ // return ;
+ // case "about_vrct":
+ // return ;
default:
return null;
diff --git a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx
index f15b05fb..fe89e3c6 100644
--- a/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/appearance/Appearance.jsx
@@ -2,11 +2,11 @@ import { useTranslation } from "react-i18next";
import FolderOpenSvg from "@images/folder_open.svg?react";
import { useSettingBox } from "../components/useSettingBox";
-import { useSelectedMicDeviceStatus, useMicDeviceListStatus } from "@store";
+import { useSelectedMicDevice, useMicDeviceList } from "@store";
export const Appearance = () => {
const { t } = useTranslation();
- const { currentSelectedMicDeviceStatus, updateSelectedMicDeviceStatus } = useSelectedMicDeviceStatus();
- const { currentMicDeviceListStatus } = useMicDeviceListStatus();
+ const { currentSelectedMicDevice, updateSelectedMicDevice } = useSelectedMicDevice();
+ const { currentMicDeviceList } = useMicDeviceList();
const {
DropdownMenuContainer,
SliderContainer,
@@ -29,13 +29,13 @@ export const Appearance = () => {
}, 3000);
});
};
- updateSelectedMicDeviceStatus(asyncFunction);
+ updateSelectedMicDevice(asyncFunction);
};
return (
<>
-
+
diff --git a/src-ui/app/config_page/setting_section/setting_box/components/dropdown_menu/DropdownMenu.jsx b/src-ui/app/config_page/setting_section/setting_box/components/dropdown_menu/DropdownMenu.jsx
index 6cc32ff7..c91d2620 100644
--- a/src-ui/app/config_page/setting_section/setting_box/components/dropdown_menu/DropdownMenu.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/components/dropdown_menu/DropdownMenu.jsx
@@ -35,12 +35,18 @@ export const DropdownMenu = (props) => {
[styles["is_opened"]]: (currentIsOpenedDropdownMenu === props.dropdown_id) ? true : false
});
+ const getSelectedText = () => {
+ if (props.state !== "hasData") return;
+ return (props.list[props.selected_id]) ? props.list[props.selected_id] : "Nothing selected";
+ };
+
+
return (
{(props.state === "loading")
?
Loading...
- :
{props.list[props.selected_id]}
+ :
{getSelectedText()}
}
{(props.state === "loading")
?
@@ -49,14 +55,15 @@ export const DropdownMenu = (props) => {
- {
- Object.entries(props.list).map(([key, value]) => {
+ {(props.state === "hasData")
+ ? Object.entries(props.list).map(([key, value]) => {
return (
selectValue(key)}>
{value}
);
})
+ : null
}
diff --git a/src-ui/app/config_page/setting_section/setting_box/components/label_component/LabelComponent.jsx b/src-ui/app/config_page/setting_section/setting_box/components/label_component/LabelComponent.jsx
index 8fea9a02..a4a520db 100644
--- a/src-ui/app/config_page/setting_section/setting_box/components/label_component/LabelComponent.jsx
+++ b/src-ui/app/config_page/setting_section/setting_box/components/label_component/LabelComponent.jsx
@@ -4,7 +4,10 @@ export const LabelComponent = (props) => {
return (
{props.label}
-
{props.desc}
+ {props.desc
+ ?
{props.desc}
+ : null
+ }
);
};
\ No newline at end of file
diff --git a/src-ui/app/config_page/setting_section/setting_box/components/useSettingBox.module.scss b/src-ui/app/config_page/setting_section/setting_box/components/useSettingBox.module.scss
index d3fe8462..6740a057 100644
--- a/src-ui/app/config_page/setting_section/setting_box/components/useSettingBox.module.scss
+++ b/src-ui/app/config_page/setting_section/setting_box/components/useSettingBox.module.scss
@@ -26,6 +26,7 @@
align-items: center;
gap: 2rem;
padding: 2rem;
+ border-bottom: solid 0.1rem var(--dark_800_color);
}
.threshold_switch_section {
diff --git a/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx
new file mode 100644
index 00000000..10952f26
--- /dev/null
+++ b/src-ui/app/config_page/setting_section/setting_box/device/Device.jsx
@@ -0,0 +1,65 @@
+import { useTranslation } from "react-i18next";
+import FolderOpenSvg from "@images/folder_open.svg?react";
+
+import { useSettingBox } from "../components/useSettingBox";
+import {
+ useMicHostList,
+ useSelectedMicHost,
+ useSelectedMicDevice,
+ useMicDeviceList,
+} from "@store";
+
+export const Device = () => {
+ const { t } = useTranslation();
+ const {
+ DropdownMenuContainer,
+ ThresholdContainer,
+ } = useSettingBox();
+
+
+ const { currentMicHostList, updateMicHostList } = useMicHostList();
+ const { currentSelectedMicHost, updateSelectedMicHost } = useSelectedMicHost();
+
+ const { currentMicDeviceList } = useMicDeviceList();
+ const { currentSelectedMicDevice, updateSelectedMicDevice } = useSelectedMicDevice();
+
+ const selectFunction = (selected_data) => {
+ switch (selected_data.dropdown_id) {
+ case "mic_host":
+
+ break;
+
+ default:
+ break;
+ }
+ };
+
+
+ return (
+ <>
+
+ {/*
*/}
+{/*
+
+
+
+
+
+
*/}
+ >
+ );
+};
\ No newline at end of file
diff --git a/src-ui/app/config_page/sidebar_section/SidebarSection.jsx b/src-ui/app/config_page/sidebar_section/SidebarSection.jsx
index 9891bb75..e227989e 100644
--- a/src-ui/app/config_page/sidebar_section/SidebarSection.jsx
+++ b/src-ui/app/config_page/sidebar_section/SidebarSection.jsx
@@ -4,6 +4,7 @@ export const SidebarSection = () => {
return (
+
diff --git a/src-ui/app/config_page/topbar/Topbar.jsx b/src-ui/app/config_page/topbar/Topbar.jsx
index 716ba49d..b9f88ebe 100644
--- a/src-ui/app/config_page/topbar/Topbar.jsx
+++ b/src-ui/app/config_page/topbar/Topbar.jsx
@@ -12,7 +12,6 @@ export const Topbar = () => {
const { currentIsOpenedConfigPage, updateIsOpenedConfigPage } = useIsOpenedConfigPage();
const closeConfigPage = () => {
updateIsOpenedConfigPage(false);
-
};
return (
diff --git a/src-ui/logics/useConfig.js b/src-ui/logics/useConfig.js
index 43ad4aea..05d71086 100644
--- a/src-ui/logics/useConfig.js
+++ b/src-ui/logics/useConfig.js
@@ -1,22 +1,34 @@
import {
useSoftwareVersion,
+ useMicHostList,
+ useSelectedMicHost,
} from "@store";
import { useStdoutToPython } from "./useStdoutToPython";
-export const useConfig = () => {
- const {
- updateSoftwareVersion,
- } = useSoftwareVersion();
+import { arrayToObject } from "@utils/arrayToObject";
+export const useConfig = () => {
const { asyncStdoutToPython } = useStdoutToPython();
+ const { updateSoftwareVersion } = useSoftwareVersion();
+ const { updateMicHostList } = useMicHostList();
+ const { updateSelectedMicHost } = useSelectedMicHost();
+
+
return {
- getSoftwareVersion: () => {
- asyncStdoutToPython("/config/version");
+ getSoftwareVersion: () => asyncStdoutToPython("/config/version"),
+ updateSoftwareVersion: (payload) => updateSoftwareVersion(payload.data),
+
+ getMicHostList: () => asyncStdoutToPython("/controller/list_mic_host"),
+ updateMicHostList: (payload) => {
+ updateMicHostList(arrayToObject(payload.data));
},
- updateSoftwareVersion: (payload) => {
- updateSoftwareVersion(payload.data);
+ getSelectedMicHost: () => asyncStdoutToPython("/config/choice_mic_host"),
+ updateSelectedMicHost: (payload) => {
+ updateSelectedMicHost(payload.data);
},
+
+
};
};
\ No newline at end of file
diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js
index 9b6a3394..28e9c014 100644
--- a/src-ui/logics/useReceiveRoutes.js
+++ b/src-ui/logics/useReceiveRoutes.js
@@ -17,6 +17,8 @@ export const useReceiveRoutes = () => {
const {
updateSoftwareVersion,
+ updateMicHostList,
+ updateSelectedMicHost,
} = useConfig();
const routes = {
@@ -28,6 +30,9 @@ export const useReceiveRoutes = () => {
"/controller/callback_disable_transcription_receive": updateTranscriptionReceiveStatus,
"/config/version": updateSoftwareVersion,
+ "/controller/list_mic_host": updateMicHostList,
+ "/config/choice_mic_host": updateSelectedMicHost,
+
"/controller/callback_messagebox_send": updateSentMessageLog,
"/action/transcription_send_mic_message": addSentMessageLog,
diff --git a/src-ui/store.js b/src-ui/store.js
index a4571eca..196c3a57 100644
--- a/src-ui/store.js
+++ b/src-ui/store.js
@@ -112,12 +112,16 @@ export const { atomInstance: Atom_IsOpenedLanguageSelector, useHook: useIsOpened
export const { atomInstance: Atom_SelectedPresetTabStatus, useHook: useSelectedPresetTabStatus } = createAtomWithHook(1, "SelectedPresetTabStatus");
export const { atomInstance: Atom_IsOpenedConfigPage, useHook: useIsOpenedConfigPage } = createAtomWithHook(false, "IsOpenedConfigPage");
-export const { atomInstance: Atom_SelectedConfigTabId, useHook: useSelectedConfigTabId } = createAtomWithHook("appearance", "SelectedConfigTabId");
+export const { atomInstance: Atom_SelectedConfigTabId, useHook: useSelectedConfigTabId } = createAtomWithHook("device", "SelectedConfigTabId");
export const { atomInstance: Atom_IsOpenedDropdownMenu, useHook: useIsOpenedDropdownMenu } = createAtomWithHook("", "IsOpenedDropdownMenu");
-export const { atomInstance: Atom_SelectedMicDeviceStatus, useHook: useSelectedMicDeviceStatus } = createAsyncAtomWithHook("device b", "SelectedMicDeviceStatus");
-export const { atomInstance: Atom_MicDeviceListStatus, useHook: useMicDeviceListStatus } = createAtomWithHook(test_device_list, "MicDeviceListStatus");
+// Config Page
+export const { atomInstance: Atom_MicHostList, useHook: useMicHostList } = createAsyncAtomWithHook([], "MicHostList");
+export const { atomInstance: Atom_SelectedMicHost, useHook: useSelectedMicHost } = createAsyncAtomWithHook("Nothing Selected", "SelectedMicHost");
+export const { atomInstance: Atom_MicDeviceList, useHook: useMicDeviceList } = createAsyncAtomWithHook(test_device_list, "MicDeviceList");
+export const { atomInstance: Atom_SelectedMicDevice, useHook: useSelectedMicDevice } = createAsyncAtomWithHook("device b", "SelectedMicDevice");
+
export const { atomInstance: Atom_SendMessageFormat, useHook: useSendMessageFormat } = createAtomWithHook({
before: "",
diff --git a/src-ui/utils/arrayToObject.js b/src-ui/utils/arrayToObject.js
new file mode 100644
index 00000000..69e7b597
--- /dev/null
+++ b/src-ui/utils/arrayToObject.js
@@ -0,0 +1,6 @@
+export const arrayToObject = (array) => {
+ return array.reduce((obj, item) => {
+ obj[item] = item;
+ return obj;
+ }, {});
+};
\ No newline at end of file