[Update] Config Page: Device Tab. To be selectable mic host and device.
This commit is contained in:
@@ -37,7 +37,8 @@ export const DropdownMenu = (props) => {
|
|||||||
|
|
||||||
const getSelectedText = () => {
|
const getSelectedText = () => {
|
||||||
if (props.state !== "hasData") return;
|
if (props.state !== "hasData") return;
|
||||||
return (props.list[props.selected_id]) ? props.list[props.selected_id] : "Nothing selected";
|
return props.selected_id;
|
||||||
|
// return (props.list[props.selected_id]) ? props.list[props.selected_id] : "Nothing selected";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import {
|
|||||||
useMicDeviceList,
|
useMicDeviceList,
|
||||||
} from "@store";
|
} from "@store";
|
||||||
|
|
||||||
|
import { useConfig } from "@logics/useConfig";
|
||||||
|
|
||||||
export const Device = () => {
|
export const Device = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const {
|
const {
|
||||||
@@ -17,20 +19,25 @@ export const Device = () => {
|
|||||||
} = useSettingBox();
|
} = useSettingBox();
|
||||||
|
|
||||||
|
|
||||||
const { currentMicHostList, updateMicHostList } = useMicHostList();
|
const { currentMicHostList } = useMicHostList();
|
||||||
const { currentSelectedMicHost, updateSelectedMicHost } = useSelectedMicHost();
|
const { currentSelectedMicHost } = useSelectedMicHost();
|
||||||
|
|
||||||
const { currentMicDeviceList } = useMicDeviceList();
|
const { currentMicDeviceList } = useMicDeviceList();
|
||||||
const { currentSelectedMicDevice, updateSelectedMicDevice } = useSelectedMicDevice();
|
const { currentSelectedMicDevice } = useSelectedMicDevice();
|
||||||
|
|
||||||
|
const {
|
||||||
|
setSelectedMicHost,
|
||||||
|
setSelectedMicDevice,
|
||||||
|
} = useConfig();
|
||||||
|
|
||||||
const selectFunction = (selected_data) => {
|
const selectFunction = (selected_data) => {
|
||||||
switch (selected_data.dropdown_id) {
|
switch (selected_data.dropdown_id) {
|
||||||
case "mic_host":
|
case "mic_host":
|
||||||
|
setSelectedMicHost(selected_data.selected_id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "mic_device":
|
case "mic_device":
|
||||||
|
setSelectedMicDevice(selected_data.selected_id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ export const useConfig = () => {
|
|||||||
updateSelectedMicHost: (payload) => {
|
updateSelectedMicHost: (payload) => {
|
||||||
updateSelectedMicHost(payload.data);
|
updateSelectedMicHost(payload.data);
|
||||||
},
|
},
|
||||||
|
setSelectedMicHost: (selected_mic_host) => {
|
||||||
|
asyncStdoutToPython("/controller/callback_set_mic_host", selected_mic_host);
|
||||||
|
},
|
||||||
|
|
||||||
getMicDeviceList: () => asyncStdoutToPython("/controller/list_mic_device"),
|
getMicDeviceList: () => asyncStdoutToPython("/controller/list_mic_device"),
|
||||||
updateMicDeviceList: (payload) => {
|
updateMicDeviceList: (payload) => {
|
||||||
@@ -41,6 +44,14 @@ export const useConfig = () => {
|
|||||||
updateSelectedMicDevice: (payload) => {
|
updateSelectedMicDevice: (payload) => {
|
||||||
updateSelectedMicDevice(payload.data);
|
updateSelectedMicDevice(payload.data);
|
||||||
},
|
},
|
||||||
|
setSelectedMicDevice: (selected_mic_device) => {
|
||||||
|
asyncStdoutToPython("/controller/callback_set_mic_device", selected_mic_device);
|
||||||
|
},
|
||||||
|
|
||||||
|
updateMicHostAndDevice: (payload) => {
|
||||||
|
updateSelectedMicHost(payload.data.host);
|
||||||
|
updateSelectedMicDevice(payload.data.device);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export const useReceiveRoutes = () => {
|
|||||||
updateSelectedMicHost,
|
updateSelectedMicHost,
|
||||||
updateMicDeviceList,
|
updateMicDeviceList,
|
||||||
updateSelectedMicDevice,
|
updateSelectedMicDevice,
|
||||||
|
updateMicHostAndDevice,
|
||||||
} = useConfig();
|
} = useConfig();
|
||||||
|
|
||||||
const routes = {
|
const routes = {
|
||||||
@@ -36,6 +37,8 @@ export const useReceiveRoutes = () => {
|
|||||||
"/config/choice_mic_host": updateSelectedMicHost,
|
"/config/choice_mic_host": updateSelectedMicHost,
|
||||||
"/controller/list_mic_device": updateMicDeviceList,
|
"/controller/list_mic_device": updateMicDeviceList,
|
||||||
"/config/choice_mic_device": updateSelectedMicDevice,
|
"/config/choice_mic_device": updateSelectedMicDevice,
|
||||||
|
"/controller/callback_set_mic_host": updateMicHostAndDevice,
|
||||||
|
"/controller/callback_set_mic_device": updateSelectedMicDevice,
|
||||||
|
|
||||||
"/controller/callback_messagebox_send": updateSentMessageLog,
|
"/controller/callback_messagebox_send": updateSentMessageLog,
|
||||||
"/action/transcription_send_mic_message": addSentMessageLog,
|
"/action/transcription_send_mic_message": addSentMessageLog,
|
||||||
|
|||||||
Reference in New Issue
Block a user