Merge branch 'ui' into for_webui
This commit is contained in:
@@ -31,8 +31,8 @@ import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClear
|
|||||||
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
|
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
|
||||||
import { useUiLanguage } from "@logics_configs/useUiLanguage";
|
import { useUiLanguage } from "@logics_configs/useUiLanguage";
|
||||||
|
|
||||||
import { useLanguageSettings } from "@logics/useLanguageSettings";
|
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
|
||||||
import { useSelectableLanguageList } from "@logics/useSelectableLanguageList";
|
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
|
||||||
|
|
||||||
const StartPythonFacadeComponent = () => {
|
const StartPythonFacadeComponent = () => {
|
||||||
const { asyncStartPython } = useStartPython();
|
const { asyncStartPython } = useStartPython();
|
||||||
@@ -103,7 +103,7 @@ const UiLanguageController = () => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
import { useVolume } from "@logics/useVolume";
|
import { useVolume } from "@logics_common/useVolume";
|
||||||
import { useStore_IsOpenedConfigPage } from "@store";
|
import { useStore_IsOpenedConfigPage } from "@store";
|
||||||
const ConfigPageCloseTrigger = () => {
|
const ConfigPageCloseTrigger = () => {
|
||||||
const { currentIsOpenedConfigPage } = useStore_IsOpenedConfigPage();
|
const { currentIsOpenedConfigPage } = useStore_IsOpenedConfigPage();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import styles from "./ThresholdComponent.module.scss";
|
|||||||
import { SliderAndMeter } from "./slider_and_meter/SliderAndMeter";
|
import { SliderAndMeter } from "./slider_and_meter/SliderAndMeter";
|
||||||
import { ThresholdEntry } from "./threshold_entry/ThresholdEntry";
|
import { ThresholdEntry } from "./threshold_entry/ThresholdEntry";
|
||||||
import { VolumeCheckButton } from "./volume_check_button/VolumeCheckButton";
|
import { VolumeCheckButton } from "./volume_check_button/VolumeCheckButton";
|
||||||
import { useVolume } from "@logics/useVolume";
|
import { useVolume } from "@logics_common/useVolume";
|
||||||
export const ThresholdComponent = (props) => {
|
export const ThresholdComponent = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const MainSection = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
import { useLanguageSettings } from "@logics/useLanguageSettings";
|
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
|
||||||
const HandleLanguageSelector = () => {
|
const HandleLanguageSelector = () => {
|
||||||
const { currentIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector();
|
const { currentIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector();
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { useSelectableLanguageList } from "@logics/useSelectableLanguageList";
|
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
|
||||||
import styles from "./LanguageSelector.module.scss";
|
import styles from "./LanguageSelector.module.scss";
|
||||||
|
|
||||||
import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar";
|
import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 { useStore_MessageLogs, store } from "@store";
|
||||||
import { MessageContainer } from "./message_container/MessageContainer";
|
import { MessageContainer } from "./message_container/MessageContainer";
|
||||||
import { scrollToBottom } from "@logics/scrollToBottom";
|
import { scrollToBottom } from "@utils/scrollToBottom";
|
||||||
|
|
||||||
export const LogBox = () => {
|
export const LogBox = () => {
|
||||||
const { currentMessageLogs } = useStore_MessageLogs();
|
const { currentMessageLogs } = useStore_MessageLogs();
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import styles from "./MessageInputBox.module.scss";
|
import styles from "./MessageInputBox.module.scss";
|
||||||
import SendMessageSvg from "@images/send_message.svg?react";
|
import SendMessageSvg from "@images/send_message.svg?react";
|
||||||
import { useMessage } from "@logics/useMessage";
|
import { useMessage } from "@logics_common/useMessage";
|
||||||
import { store } from "@store";
|
import { store } from "@store";
|
||||||
import { scrollToBottom } from "@logics/scrollToBottom";
|
import { scrollToBottom } from "@utils/scrollToBottom";
|
||||||
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
|
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
|
||||||
import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClearMessageBox";
|
import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClearMessageBox";
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ export const LanguageSettings = () => {
|
|||||||
import MicSvg from "@images/mic.svg?react";
|
import MicSvg from "@images/mic.svg?react";
|
||||||
import HeadphonesSvg from "@images/headphones.svg?react";
|
import HeadphonesSvg from "@images/headphones.svg?react";
|
||||||
import { useStore_IsOpenedLanguageSelector } from "@store";
|
import { useStore_IsOpenedLanguageSelector } from "@store";
|
||||||
import { useMainFunction } from "@logics/useMainFunction";
|
import { useMainFunction } from "@logics_main/useMainFunction";
|
||||||
import { useLanguageSettings } from "@logics/useLanguageSettings";
|
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
|
||||||
|
|
||||||
// 言語セレクターをトグルする処理を関数化
|
// 言語セレクターをトグルする処理を関数化
|
||||||
const toggleSelector = (selector, currentStatus, updateSelector) => {
|
const toggleSelector = (selector, currentStatus, updateSelector) => {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const PresetTabSelector = () => {
|
|||||||
|
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
import { useLanguageSettings } from "@logics/useLanguageSettings";
|
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
|
||||||
|
|
||||||
const Tab = (props) => {
|
const Tab = (props) => {
|
||||||
const { currentSelectedPresetTabNumber, setSelectedPresetTabNumber } = useLanguageSettings();
|
const { currentSelectedPresetTabNumber, setSelectedPresetTabNumber } = useLanguageSettings();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import HeadphonesSvg from "@images/headphones.svg?react";
|
|||||||
import ForegroundSvg from "@images/foreground.svg?react";
|
import ForegroundSvg from "@images/foreground.svg?react";
|
||||||
import { useStore_IsMainPageCompactMode } from "@store";
|
import { useStore_IsMainPageCompactMode } from "@store";
|
||||||
|
|
||||||
import { useMainFunction } from "@logics/useMainFunction";
|
import { useMainFunction } from "@logics_main/useMainFunction";
|
||||||
|
|
||||||
export const MainFunctionSwitch = () => {
|
export const MainFunctionSwitch = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { arrayToObject } from "@utils/arrayToObject";
|
import { arrayToObject } from "@utils/arrayToObject";
|
||||||
import { useMainFunction } from "./useMainFunction";
|
import { useMainFunction } from "@logics_main/useMainFunction";
|
||||||
import { useMessage } from "./useMessage";
|
import { useMessage } from "@logics_common/useMessage";
|
||||||
import { useSelectableLanguageList } from "./useSelectableLanguageList";
|
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
|
||||||
import { useLanguageSettings } from "./useLanguageSettings";
|
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
|
||||||
import { useVolume } from "./useVolume";
|
import { useVolume } from "@logics_common/useVolume";
|
||||||
|
|
||||||
import { useSoftwareVersion } from "@logics_configs/useSoftwareVersion";
|
import { useSoftwareVersion } from "@logics_configs/useSoftwareVersion";
|
||||||
import { useEnableAutoMicSelect } from "@logics_configs/useEnableAutoMicSelect";
|
import { useEnableAutoMicSelect } from "@logics_configs/useEnableAutoMicSelect";
|
||||||
@@ -21,14 +21,12 @@ import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonTy
|
|||||||
|
|
||||||
import { useUiLanguage } from "@logics_configs/useUiLanguage";
|
import { useUiLanguage } from "@logics_configs/useUiLanguage";
|
||||||
|
|
||||||
|
|
||||||
export const useReceiveRoutes = () => {
|
export const useReceiveRoutes = () => {
|
||||||
const {
|
const {
|
||||||
updateTranslationStatus,
|
updateTranslationStatus,
|
||||||
updateTranscriptionSendStatus,
|
updateTranscriptionSendStatus,
|
||||||
updateTranscriptionReceiveStatus,
|
updateTranscriptionReceiveStatus,
|
||||||
} = useMainFunction();
|
} = useMainFunction();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
updateSelectedPresetTabNumber,
|
updateSelectedPresetTabNumber,
|
||||||
updateEnableMultiTranslation,
|
updateEnableMultiTranslation,
|
||||||
@@ -36,34 +34,25 @@ export const useReceiveRoutes = () => {
|
|||||||
updateSelectedTargetLanguages
|
updateSelectedTargetLanguages
|
||||||
} = useLanguageSettings();
|
} = useLanguageSettings();
|
||||||
const { updateSelectableLanguageList } = useSelectableLanguageList();
|
const { updateSelectableLanguageList } = useSelectableLanguageList();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
updateSentMessageLogById,
|
updateSentMessageLogById,
|
||||||
addSentMessageLog,
|
addSentMessageLog,
|
||||||
addReceivedMessageLog,
|
addReceivedMessageLog,
|
||||||
} = useMessage();
|
} = useMessage();
|
||||||
|
|
||||||
const { updateSoftwareVersion } = useSoftwareVersion();
|
const { updateSoftwareVersion } = useSoftwareVersion();
|
||||||
|
|
||||||
const { updateEnableAutoMicSelect } = useEnableAutoMicSelect();
|
const { updateEnableAutoMicSelect } = useEnableAutoMicSelect();
|
||||||
const { updateEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect();
|
const { updateEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect();
|
||||||
|
|
||||||
const { updateMicHostList } = useMicHostList();
|
const { updateMicHostList } = useMicHostList();
|
||||||
const { updateSelectedMicHost } = useSelectedMicHost();
|
const { updateSelectedMicHost } = useSelectedMicHost();
|
||||||
const { updateMicDeviceList } = useMicDeviceList();
|
const { updateMicDeviceList } = useMicDeviceList();
|
||||||
const { updateSelectedMicDevice } = useSelectedMicDevice();
|
const { updateSelectedMicDevice } = useSelectedMicDevice();
|
||||||
const { updateSpeakerDeviceList } = useSpeakerDeviceList();
|
const { updateSpeakerDeviceList } = useSpeakerDeviceList();
|
||||||
const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice();
|
const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice();
|
||||||
|
|
||||||
const { updateMicThreshold, updateEnableAutomaticMicThreshold } = useMicThreshold();
|
const { updateMicThreshold, updateEnableAutomaticMicThreshold } = useMicThreshold();
|
||||||
const { updateSpeakerThreshold, updateEnableAutomaticSpeakerThreshold } = useSpeakerThreshold();
|
const { updateSpeakerThreshold, updateEnableAutomaticSpeakerThreshold } = useSpeakerThreshold();
|
||||||
|
|
||||||
const { updateEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
|
const { updateEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
|
||||||
const { updateSendMessageButtonType } = useSendMessageButtonType();
|
const { updateSendMessageButtonType } = useSendMessageButtonType();
|
||||||
|
|
||||||
const { updateUiLanguage } = useUiLanguage();
|
const { updateUiLanguage } = useUiLanguage();
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
updateVolumeVariable_Mic,
|
updateVolumeVariable_Mic,
|
||||||
updateVolumeVariable_Speaker,
|
updateVolumeVariable_Speaker,
|
||||||
@@ -72,6 +61,8 @@ export const useReceiveRoutes = () => {
|
|||||||
} = useVolume();
|
} = useVolume();
|
||||||
|
|
||||||
const routes = {
|
const routes = {
|
||||||
|
// Main Page
|
||||||
|
// Main Functions
|
||||||
"/set/enable_translation": updateTranslationStatus,
|
"/set/enable_translation": updateTranslationStatus,
|
||||||
"/set/disable_translation": updateTranslationStatus,
|
"/set/disable_translation": updateTranslationStatus,
|
||||||
"/set/enable_transcription_send": updateTranscriptionSendStatus,
|
"/set/enable_transcription_send": updateTranscriptionSendStatus,
|
||||||
@@ -79,6 +70,7 @@ export const useReceiveRoutes = () => {
|
|||||||
"/set/enable_transcription_receive": updateTranscriptionReceiveStatus,
|
"/set/enable_transcription_receive": updateTranscriptionReceiveStatus,
|
||||||
"/set/disable_transcription_receive": updateTranscriptionReceiveStatus,
|
"/set/disable_transcription_receive": updateTranscriptionReceiveStatus,
|
||||||
|
|
||||||
|
// Language Settings
|
||||||
"/get/selected_tab_no": updateSelectedPresetTabNumber,
|
"/get/selected_tab_no": updateSelectedPresetTabNumber,
|
||||||
"/set/selected_tab_no": updateSelectedPresetTabNumber,
|
"/set/selected_tab_no": updateSelectedPresetTabNumber,
|
||||||
"/get/multi_language_translation": updateEnableMultiTranslation,
|
"/get/multi_language_translation": updateEnableMultiTranslation,
|
||||||
@@ -87,10 +79,20 @@ export const useReceiveRoutes = () => {
|
|||||||
"/get/selected_target_languages": updateSelectedTargetLanguages,
|
"/get/selected_target_languages": updateSelectedTargetLanguages,
|
||||||
"/set/selected_target_languages": updateSelectedTargetLanguages,
|
"/set/selected_target_languages": updateSelectedTargetLanguages,
|
||||||
|
|
||||||
|
// Language Selector
|
||||||
"/get/list_languages": updateSelectableLanguageList,
|
"/get/list_languages": updateSelectableLanguageList,
|
||||||
|
|
||||||
|
// Message
|
||||||
|
"/run/send_message_box": updateSentMessageLogById,
|
||||||
|
"/action/transcription_send_mic_message": addSentMessageLog,
|
||||||
|
"/action/transcription_receive_speaker_message": addReceivedMessageLog,
|
||||||
|
|
||||||
|
|
||||||
|
// Config Page
|
||||||
|
// Common
|
||||||
"/get/version": updateSoftwareVersion,
|
"/get/version": updateSoftwareVersion,
|
||||||
|
|
||||||
|
// Device Tab
|
||||||
"/get/auto_mic_select": updateEnableAutoMicSelect,
|
"/get/auto_mic_select": updateEnableAutoMicSelect,
|
||||||
"/set/enable_auto_mic_select": updateEnableAutoMicSelect,
|
"/set/enable_auto_mic_select": updateEnableAutoMicSelect,
|
||||||
"/set/disable_auto_mic_select": updateEnableAutoMicSelect,
|
"/set/disable_auto_mic_select": updateEnableAutoMicSelect,
|
||||||
@@ -120,13 +122,6 @@ export const useReceiveRoutes = () => {
|
|||||||
"/set/enable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
|
"/set/enable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
|
||||||
"/set/disable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
|
"/set/disable_check_speaker_threshold": updateSpeakerThresholdCheckStatus,
|
||||||
|
|
||||||
"/get/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
|
||||||
"/set/enable_auto_clear_message_box": updateEnableAutoClearMessageBox,
|
|
||||||
"/set/disable_auto_clear_message_box": updateEnableAutoClearMessageBox,
|
|
||||||
|
|
||||||
"/get/send_message_button_type": updateSendMessageButtonType,
|
|
||||||
"/set/send_message_button_type": updateSendMessageButtonType,
|
|
||||||
|
|
||||||
"/get/mic_energy_threshold": updateMicThreshold,
|
"/get/mic_energy_threshold": updateMicThreshold,
|
||||||
"/set/mic_energy_threshold": updateMicThreshold,
|
"/set/mic_energy_threshold": updateMicThreshold,
|
||||||
"/get/speaker_energy_threshold": updateSpeakerThreshold,
|
"/get/speaker_energy_threshold": updateSpeakerThreshold,
|
||||||
@@ -137,14 +132,19 @@ export const useReceiveRoutes = () => {
|
|||||||
"/set/disable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
|
"/set/disable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
|
||||||
"/get/speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
|
"/get/speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
|
||||||
"/set/enable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
|
"/set/enable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
|
||||||
|
"/set/disable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
|
||||||
|
|
||||||
|
// Appearance
|
||||||
"/get/ui_language": updateUiLanguage,
|
"/get/ui_language": updateUiLanguage,
|
||||||
"/set/ui_language": updateUiLanguage,
|
"/set/ui_language": updateUiLanguage,
|
||||||
|
|
||||||
|
// Others Tab
|
||||||
|
"/get/auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||||
|
"/set/enable_auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||||
|
"/set/disable_auto_clear_message_box": updateEnableAutoClearMessageBox,
|
||||||
|
|
||||||
"/run/send_message_box": updateSentMessageLogById,
|
"/get/send_message_button_type": updateSendMessageButtonType,
|
||||||
"/action/transcription_send_mic_message": addSentMessageLog,
|
"/set/send_message_button_type": updateSendMessageButtonType,
|
||||||
"/action/transcription_receive_speaker_message": addReceivedMessageLog
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const receiveRoutes = (parsed_data) => {
|
const receiveRoutes = (parsed_data) => {
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
import { WebviewWindow } from "@tauri-apps/api/window";
|
|
||||||
import { store, useStore_IsOpenedConfigPage } from "@store";
|
|
||||||
import { getCurrent } from "@tauri-apps/api/window";
|
|
||||||
|
|
||||||
export const useWindow = () => {
|
|
||||||
const { updateIsOpenedConfigPage } = useStore_IsOpenedConfigPage();
|
|
||||||
|
|
||||||
const createConfigPage = async () => {
|
|
||||||
const main_page = getCurrent();
|
|
||||||
if (store.config_page === null) {
|
|
||||||
const config_page = new WebviewWindow("vrct_config_page",{
|
|
||||||
url: "./src-ui/windows/config_page/index.html",
|
|
||||||
center: true,
|
|
||||||
width: 1080,
|
|
||||||
height: 700,
|
|
||||||
title: "Settings"
|
|
||||||
});
|
|
||||||
|
|
||||||
config_page.once("tauri://created", function () {
|
|
||||||
store.config_page = config_page;
|
|
||||||
updateIsOpenedConfigPage(true);
|
|
||||||
});
|
|
||||||
config_page.once("tauri://error", function (e) {
|
|
||||||
console.log(e);
|
|
||||||
});
|
|
||||||
|
|
||||||
const unlisten_d = config_page.once("tauri://destroyed", (event) => {
|
|
||||||
store.config_page = null;
|
|
||||||
updateIsOpenedConfigPage(false);
|
|
||||||
unlisten_d();
|
|
||||||
});
|
|
||||||
|
|
||||||
main_page.onCloseRequested((event) => {
|
|
||||||
config_page.close();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const closeConfigPage = () => {
|
|
||||||
store.config_page.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
return { createConfigPage, closeConfigPage };
|
|
||||||
};
|
|
||||||
@@ -40,6 +40,8 @@ export default defineConfig(async () => ({
|
|||||||
"@images": path.resolve(__dirname, "src-ui/assets"),
|
"@images": path.resolve(__dirname, "src-ui/assets"),
|
||||||
"@utils": path.resolve(__dirname, "src-ui/utils"),
|
"@utils": path.resolve(__dirname, "src-ui/utils"),
|
||||||
"@logics": path.resolve(__dirname, "src-ui/logics"),
|
"@logics": path.resolve(__dirname, "src-ui/logics"),
|
||||||
|
"@logics_common": path.resolve(__dirname, "src-ui/logics/common"),
|
||||||
|
"@logics_main": path.resolve(__dirname, "src-ui/logics/main"),
|
||||||
"@logics_configs": path.resolve(__dirname, "src-ui/logics/configs"),
|
"@logics_configs": path.resolve(__dirname, "src-ui/logics/configs"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user