2024-05-03 20:27:18 +00:00
|
|
|
import { makeStyles, typographyStyles } from "@fluentui/react-components";
|
2024-04-29 20:14:16 +00:00
|
|
|
import { ServerApi } from "./api/ServerApi";
|
2024-05-02 20:14:20 +00:00
|
|
|
import { AuthRouteWidget } from "./routes/AuthRouteWidget";
|
2024-04-29 20:14:16 +00:00
|
|
|
import { AsyncWidget } from "./widgets/AsyncWidget";
|
2024-05-03 20:27:18 +00:00
|
|
|
import { MainMenu } from "./widgets/MainMenu";
|
2024-05-04 07:11:30 +00:00
|
|
|
import { SystemInfoWidget } from "./widgets/SystemInfoWidget";
|
2024-05-04 07:12:51 +00:00
|
|
|
import { VirtualMachinesWidget } from "./widgets/VirtualMachinesWidget";
|
2024-05-03 20:03:25 +00:00
|
|
|
|
|
|
|
const useStyles = makeStyles({
|
|
|
|
title: typographyStyles.title2,
|
|
|
|
});
|
2024-04-29 20:14:16 +00:00
|
|
|
|
|
|
|
export function App() {
|
|
|
|
return (
|
|
|
|
<AsyncWidget
|
|
|
|
loadKey={1}
|
|
|
|
errMsg="Failed to load server configuration!"
|
|
|
|
load={ServerApi.LoadConfig}
|
|
|
|
loadingMessage="Loading server configuration..."
|
2024-05-02 20:14:20 +00:00
|
|
|
build={() => <AppInner />}
|
2024-04-29 20:14:16 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2024-05-02 20:14:20 +00:00
|
|
|
|
|
|
|
function AppInner(): React.ReactElement {
|
2024-05-03 20:03:25 +00:00
|
|
|
const styles = useStyles();
|
|
|
|
|
2024-05-02 20:14:20 +00:00
|
|
|
if (!ServerApi.Config.authenticated && !ServerApi.Config.disable_auth)
|
|
|
|
return <AuthRouteWidget />;
|
2024-05-03 20:03:25 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
2024-05-04 07:11:30 +00:00
|
|
|
width: "95%",
|
2024-05-03 20:03:25 +00:00
|
|
|
maxWidth: "1000px",
|
|
|
|
margin: "50px auto",
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
|
|
|
<span className={styles.title}>VirtWebRemote</span>
|
2024-05-03 20:27:18 +00:00
|
|
|
<MainMenu />
|
2024-05-03 20:03:25 +00:00
|
|
|
</div>
|
2024-05-04 07:12:51 +00:00
|
|
|
<VirtualMachinesWidget />
|
2024-05-04 07:11:30 +00:00
|
|
|
<SystemInfoWidget />
|
2024-05-03 20:03:25 +00:00
|
|
|
</div>
|
|
|
|
);
|
2024-05-02 20:14:20 +00:00
|
|
|
}
|