[Update] update tauri v1-> v2 (development)

This commit is contained in:
Sakamoto Shiina
2025-05-03 08:47:02 +09:00
parent c6f669336a
commit 3210d5c898
26 changed files with 9570 additions and 7229 deletions

View File

@@ -26,7 +26,6 @@ import { AppErrorBoundary } from "./error_boundary/AppErrorBoundary";
export const App = () => {
const { currentIsVrctAvailable } = useIsVrctAvailable();
const { currentIsBackendReady } = useIsBackendReady();
const { WindowGeometryController } = useWindow();
const { i18n } = useTranslation();
return (
@@ -40,7 +39,6 @@ export const App = () => {
<UiSizeController />
<FontFamilyController />
<TransparencyController />
<WindowGeometryController />
{(currentIsBackendReady.data === false || currentIsVrctAvailable.data === false)
? <SplashComponent />
@@ -54,9 +52,11 @@ export const App = () => {
};
const Contents = () => {
const { WindowGeometryController } = useWindow();
const { currentIsSoftwareUpdating } = useIsSoftwareUpdating();
return (
<>
<WindowGeometryController />
<PluginsController />
<WindowTitleBar />

View File

@@ -1,4 +1,4 @@
import { invoke } from "@tauri-apps/api/tauri";
import { invoke } from "@tauri-apps/api/core";
import { useEffect, useRef } from "react";
import { useStartPython } from "@logics/useStartPython";
import { useStdoutToPython } from "@logics/useStdoutToPython";

View File

@@ -126,7 +126,6 @@ export const MergePluginsController = () => {
}
}
console.log("merged plugin data", new_data);
return new_data;
});
};

View File

@@ -24,7 +24,8 @@
html, body {
height: 100%;
font-family: var(--font_family); /* If not found the font family where 'root:' that is selected by user*/
border-radius: 1.8rem;
border-radius: 10px; /* fixed by px */
overflow: hidden;
}

View File

@@ -1,5 +1,5 @@
import { useState } from "react";
import { appWindow } from "@tauri-apps/api/window";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { ErrorBoundary } from "react-error-boundary";
import XMarkSvg from "@images/cancel.svg?react";
import CopySvg from "@images/copy.svg?react";
@@ -65,12 +65,14 @@ const ErrorContainer = ({error}) => {
};
const CloseButtonContainer = () => {
const close = () => {
const asyncClose = async () => {
const appWindow = await getCurrentWindow();
appWindow.close();
};
return (
<button className={styles.close_button_wrapper} onClick={close}>
<button className={styles.close_button_wrapper} onClick={asyncClose}>
<div className={styles.close_button}>
<XMarkSvg className={styles.x_mark_svg}/>
</div>

View File

@@ -5,7 +5,7 @@ import { useMessage } from "@logics_common";
import { useSendMessageButtonType, useEnableAutoClearMessageInputBox } from "@logics_configs";
import { useMessageLogScroll } from "@logics_main";
import { store } from "@store";
import { appWindow } from "@tauri-apps/api/window";
import { getCurrentWindow } from "@tauri-apps/api/window";
export const MessageInputBox = () => {
const [message_history, setMessageHistory] = useState([]);
@@ -41,6 +41,7 @@ export const MessageInputBox = () => {
const onSubmitFunction = (e) => {
e.preventDefault();
// const appWindow = getCurrentWindow();
// appWindow.minimize();
if (!currentMessageInputValue.data.trim()) return updateMessageInputValue("");

View File

@@ -4,7 +4,7 @@ import { StartUpProgressContainer } from "./start_up_progress_container/StartUpP
import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer/";
import MegaphoneSvg from "@images/megaphone.svg?react";
import XMarkSvg from "@images/cancel.svg?react";
import { appWindow } from "@tauri-apps/api/window";
import { getCurrentWindow } from "@tauri-apps/api/window";
import clsx from "clsx";
export const SplashComponent = () => {
@@ -73,12 +73,13 @@ const AnnouncementsContainer = () => {
const CloseButtonContainer = () => {
const close = () => {
const asyncClose = async () => {
const appWindow = await getCurrentWindow();
appWindow.close();
};
return (
<button className={styles.close_button_wrapper} onClick={close}>
<button className={styles.close_button_wrapper} onClick={asyncClose}>
<div className={styles.close_button}>
<XMarkSvg className={styles.x_mark_svg}/>
</div>

View File

@@ -5,15 +5,17 @@ import SquareSvg from "@images/square.svg?react";
import LineSvg from "@images/line.svg?react";
import VrctSvg from "@images/vrct.svg?react";
import { appWindow } from "@tauri-apps/api/window";
import { getCurrentWindow } from "@tauri-apps/api/window";
export const WindowTitleBar = () => {
const minimize = () => {
const asyncMinimize = async () => {
const appWindow = await getCurrentWindow();
appWindow.minimize();
};
const maximize = async () => {
const asyncMaximize = async () => {
const appWindow = await getCurrentWindow();
const maximizeState = await appWindow.isMaximized();
if (!maximizeState) {
appWindow.maximize();
@@ -22,7 +24,8 @@ export const WindowTitleBar = () => {
}
};
const close = () => {
const asyncClose = async () => {
const appWindow = await getCurrentWindow();
appWindow.close();
};
@@ -34,13 +37,13 @@ export const WindowTitleBar = () => {
</div>
<div className={styles.window_control_wrapper}>
<div className={styles.minimize_button} onClick={minimize}>
<div className={styles.minimize_button} onClick={asyncMinimize}>
<LineSvg className={styles.line_svg}/>
</div>
<div className={styles.maximize_button} onClick={maximize}>
<div className={styles.maximize_button} onClick={asyncMaximize}>
<SquareSvg className={styles.square_svg}/>
</div>
<div className={styles.close_button} onClick={close}>
<div className={styles.close_button} onClick={asyncClose}>
<XMarkSvg className={styles.x_mark_svg}/>
</div>
</div>