import { Box, Button, CssBaseline, LinearProgress, Typography, } from "@mui/material"; import { appWindow } from "@tauri-apps/api/window"; import "./styles.css"; import logo from "../../assets/icon.svg"; import { useEffect, useState } from 'react'; export default function App() { const [error, setError] = useState(false); useEffect(() => { const unlisten = appWindow.listen("app://download-error", () => { setError(true); }); return () => { unlisten.then((unlisten) => unlisten()); } }, []); useEffect(() => { const unlisten = appWindow.listen("app://download", () => { setError(false); }); return () => { unlisten.then((unlisten) => unlisten()); } }, []); return ( <> {error ? : } ); } function DownloadIndicator() { const [progress, setProgress] = useState(null); useEffect(() => { const unlisten = appWindow.listen("app://download-progress", (event) => { setProgress(event.payload as number); }); return () => { unlisten.then((unlisten) => unlisten()); } }, []); return ( <> Updating the GUI components... ); } function DownloadFailed() { return ( <> Failed to update the GUI components. ); } function LinearProgressWithLabel(props: { value: number | null }) { const { value } = props; return ( {value !== null && ( {`${Math.round(value)}%`} )} ); }