Files
VRCT/src-ui/app/App.jsx
Sakamoto Shiina ac6b898a46 [Perf/bugfix] Separate custom hooks and prevent re-render issues.
Config Page: Device Tab. threshold component. fix problem that the input component focused out when input something each time.
Set threshold data when started python.
2024-09-10 17:21:03 +09:00

66 lines
2.5 KiB
JavaScript

import { getCurrent } from "@tauri-apps/api/window";
import { useEffect, useRef } from "react";
import { useStartPython } from "@logics/useStartPython";
// import { useConfig } from "@logics/useConfig";
import { MainPage } from "./main_page/MainPage";
import { ConfigPage } from "./config_page/ConfigPage";
import styles from "./App.module.scss";
export const App = () => {
return (
<div className={styles.container}>
<StartPythonFacadeComponent />
<ConfigPage />
<MainPage />
</div>
);
};
import { useSoftwareVersion } from "@logics_configs/useSoftwareVersion";
import { useSelectedMicHost } from "@logics_configs/useSelectedMicHost";
import { useSelectedMicDevice } from "@logics_configs/useSelectedMicDevice";
import { useSelectedSpeakerDevice } from "@logics_configs/useSelectedSpeakerDevice";
import { useMicThreshold } from "@logics_configs/useMicThreshold";
import { useSpeakerThreshold } from "@logics_configs/useSpeakerThreshold";
import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClearMessageBox";
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
const StartPythonFacadeComponent = () => {
const { asyncStartPython } = useStartPython();
const hasRunRef = useRef(false);
const main_page = getCurrent();
const { getSoftwareVersion } = useSoftwareVersion();
const { getSelectedMicHost } = useSelectedMicHost();
const { getSelectedMicDevice } = useSelectedMicDevice();
const { getSelectedSpeakerDevice } = useSelectedSpeakerDevice();
const { getMicThreshold } = useMicThreshold();
const { getSpeakerThreshold } = useSpeakerThreshold();
const { getEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
const { getSendMessageButtonType } = useSendMessageButtonType();
useEffect(() => {
main_page.setDecorations(true);
if (!hasRunRef.current) {
asyncStartPython().then((result) => {
getSoftwareVersion();
getSelectedMicHost();
getSelectedMicDevice();
getSelectedSpeakerDevice();
getMicThreshold();
getSpeakerThreshold();
getEnableAutoClearMessageBox();
getSendMessageButtonType();
}).catch((err) => {
console.error(err);
});
}
return () => hasRunRef.current = true;
}, []);
return null;
};