Merge branch 'ui' into for_webui

This commit is contained in:
Sakamoto Shiina
2024-09-21 00:59:58 +09:00
18 changed files with 41 additions and 83 deletions

View File

@@ -31,8 +31,8 @@ import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClear
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
import { useUiLanguage } from "@logics_configs/useUiLanguage";
import { useLanguageSettings } from "@logics/useLanguageSettings";
import { useSelectableLanguageList } from "@logics/useSelectableLanguageList";
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
const StartPythonFacadeComponent = () => {
const { asyncStartPython } = useStartPython();
@@ -103,7 +103,7 @@ const UiLanguageController = () => {
return null;
};
import { useVolume } from "@logics/useVolume";
import { useVolume } from "@logics_common/useVolume";
import { useStore_IsOpenedConfigPage } from "@store";
const ConfigPageCloseTrigger = () => {
const { currentIsOpenedConfigPage } = useStore_IsOpenedConfigPage();

View File

@@ -3,7 +3,7 @@ import styles from "./ThresholdComponent.module.scss";
import { SliderAndMeter } from "./slider_and_meter/SliderAndMeter";
import { ThresholdEntry } from "./threshold_entry/ThresholdEntry";
import { VolumeCheckButton } from "./volume_check_button/VolumeCheckButton";
import { useVolume } from "@logics/useVolume";
import { useVolume } from "@logics_common/useVolume";
export const ThresholdComponent = (props) => {
return (
<div className={styles.container}>

View File

@@ -18,7 +18,7 @@ export const MainSection = () => {
};
import { useLanguageSettings } from "@logics/useLanguageSettings";
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
const HandleLanguageSelector = () => {
const { currentIsOpenedLanguageSelector } = useStore_IsOpenedLanguageSelector();
const {

View File

@@ -1,6 +1,6 @@
import { useTranslation } from "react-i18next";
import { useSelectableLanguageList } from "@logics/useSelectableLanguageList";
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
import styles from "./LanguageSelector.module.scss";
import { LanguageSelectorTopBar } from "./language_selector_top_bar/LanguageSelectorTopBar";

View File

@@ -2,7 +2,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from "react";
import styles from "./LogBox.module.scss";
import { useStore_MessageLogs, store } from "@store";
import { MessageContainer } from "./message_container/MessageContainer";
import { scrollToBottom } from "@logics/scrollToBottom";
import { scrollToBottom } from "@utils/scrollToBottom";
export const LogBox = () => {
const { currentMessageLogs } = useStore_MessageLogs();

View File

@@ -1,9 +1,9 @@
import { useState } from "react";
import styles from "./MessageInputBox.module.scss";
import SendMessageSvg from "@images/send_message.svg?react";
import { useMessage } from "@logics/useMessage";
import { useMessage } from "@logics_common/useMessage";
import { store } from "@store";
import { scrollToBottom } from "@logics/scrollToBottom";
import { scrollToBottom } from "@utils/scrollToBottom";
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClearMessageBox";

View File

@@ -23,8 +23,8 @@ export const LanguageSettings = () => {
import MicSvg from "@images/mic.svg?react";
import HeadphonesSvg from "@images/headphones.svg?react";
import { useStore_IsOpenedLanguageSelector } from "@store";
import { useMainFunction } from "@logics/useMainFunction";
import { useLanguageSettings } from "@logics/useLanguageSettings";
import { useMainFunction } from "@logics_main/useMainFunction";
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
// 言語セレクターをトグルする処理を関数化
const toggleSelector = (selector, currentStatus, updateSelector) => {

View File

@@ -12,7 +12,7 @@ export const PresetTabSelector = () => {
import clsx from "clsx";
import { useLanguageSettings } from "@logics/useLanguageSettings";
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
const Tab = (props) => {
const { currentSelectedPresetTabNumber, setSelectedPresetTabNumber } = useLanguageSettings();

View File

@@ -7,7 +7,7 @@ import HeadphonesSvg from "@images/headphones.svg?react";
import ForegroundSvg from "@images/foreground.svg?react";
import { useStore_IsMainPageCompactMode } from "@store";
import { useMainFunction } from "@logics/useMainFunction";
import { useMainFunction } from "@logics_main/useMainFunction";
export const MainFunctionSwitch = () => {
const { t } = useTranslation();

View File

@@ -1,9 +1,9 @@
import { arrayToObject } from "@utils/arrayToObject";
import { useMainFunction } from "./useMainFunction";
import { useMessage } from "./useMessage";
import { useSelectableLanguageList } from "./useSelectableLanguageList";
import { useLanguageSettings } from "./useLanguageSettings";
import { useVolume } from "./useVolume";
import { useMainFunction } from "@logics_main/useMainFunction";
import { useMessage } from "@logics_common/useMessage";
import { useSelectableLanguageList } from "@logics_main/useSelectableLanguageList";
import { useLanguageSettings } from "@logics_main/useLanguageSettings";
import { useVolume } from "@logics_common/useVolume";
import { useSoftwareVersion } from "@logics_configs/useSoftwareVersion";
import { useEnableAutoMicSelect } from "@logics_configs/useEnableAutoMicSelect";
@@ -21,14 +21,12 @@ import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonTy
import { useUiLanguage } from "@logics_configs/useUiLanguage";
export const useReceiveRoutes = () => {
const {
updateTranslationStatus,
updateTranscriptionSendStatus,
updateTranscriptionReceiveStatus,
} = useMainFunction();
const {
updateSelectedPresetTabNumber,
updateEnableMultiTranslation,
@@ -36,34 +34,25 @@ export const useReceiveRoutes = () => {
updateSelectedTargetLanguages
} = useLanguageSettings();
const { updateSelectableLanguageList } = useSelectableLanguageList();
const {
updateSentMessageLogById,
addSentMessageLog,
addReceivedMessageLog,
} = useMessage();
const { updateSoftwareVersion } = useSoftwareVersion();
const { updateEnableAutoMicSelect } = useEnableAutoMicSelect();
const { updateEnableAutoSpeakerSelect } = useEnableAutoSpeakerSelect();
const { updateMicHostList } = useMicHostList();
const { updateSelectedMicHost } = useSelectedMicHost();
const { updateMicDeviceList } = useMicDeviceList();
const { updateSelectedMicDevice } = useSelectedMicDevice();
const { updateSpeakerDeviceList } = useSpeakerDeviceList();
const { updateSelectedSpeakerDevice } = useSelectedSpeakerDevice();
const { updateMicThreshold, updateEnableAutomaticMicThreshold } = useMicThreshold();
const { updateSpeakerThreshold, updateEnableAutomaticSpeakerThreshold } = useSpeakerThreshold();
const { updateEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
const { updateSendMessageButtonType } = useSendMessageButtonType();
const { updateUiLanguage } = useUiLanguage();
const {
updateVolumeVariable_Mic,
updateVolumeVariable_Speaker,
@@ -72,6 +61,8 @@ export const useReceiveRoutes = () => {
} = useVolume();
const routes = {
// Main Page
// Main Functions
"/set/enable_translation": updateTranslationStatus,
"/set/disable_translation": updateTranslationStatus,
"/set/enable_transcription_send": updateTranscriptionSendStatus,
@@ -79,6 +70,7 @@ export const useReceiveRoutes = () => {
"/set/enable_transcription_receive": updateTranscriptionReceiveStatus,
"/set/disable_transcription_receive": updateTranscriptionReceiveStatus,
// Language Settings
"/get/selected_tab_no": updateSelectedPresetTabNumber,
"/set/selected_tab_no": updateSelectedPresetTabNumber,
"/get/multi_language_translation": updateEnableMultiTranslation,
@@ -87,10 +79,20 @@ export const useReceiveRoutes = () => {
"/get/selected_target_languages": updateSelectedTargetLanguages,
"/set/selected_target_languages": updateSelectedTargetLanguages,
// Language Selector
"/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,
// Device Tab
"/get/auto_mic_select": updateEnableAutoMicSelect,
"/set/enable_auto_mic_select": updateEnableAutoMicSelect,
"/set/disable_auto_mic_select": updateEnableAutoMicSelect,
@@ -120,13 +122,6 @@ export const useReceiveRoutes = () => {
"/set/enable_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,
"/set/mic_energy_threshold": updateMicThreshold,
"/get/speaker_energy_threshold": updateSpeakerThreshold,
@@ -137,14 +132,19 @@ export const useReceiveRoutes = () => {
"/set/disable_mic_dynamic_energy_threshold": updateEnableAutomaticMicThreshold,
"/get/speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/set/enable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
"/set/disable_speaker_dynamic_energy_threshold": updateEnableAutomaticSpeakerThreshold,
// Appearance
"/get/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,
"/action/transcription_send_mic_message": addSentMessageLog,
"/action/transcription_receive_speaker_message": addReceivedMessageLog
"/get/send_message_button_type": updateSendMessageButtonType,
"/set/send_message_button_type": updateSendMessageButtonType,
};
const receiveRoutes = (parsed_data) => {

View File

@@ -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 };
};

View File

@@ -40,6 +40,8 @@ export default defineConfig(async () => ({
"@images": path.resolve(__dirname, "src-ui/assets"),
"@utils": path.resolve(__dirname, "src-ui/utils"),
"@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"),
},
},