2023-12-07 11:56:02 +00:00
|
|
|
import { StrictMode } from "react";
|
2023-12-07 14:11:12 +00:00
|
|
|
import ReactDOM from "react-dom/client";
|
2024-10-02 14:29:27 -05:00
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
2023-12-07 00:13:11 +00:00
|
|
|
import { CurrentDesktopState, RqbitDesktopConfig } from "./configuration";
|
2023-12-06 22:38:55 +00:00
|
|
|
import { RqbitDesktop } from "./rqbit-desktop";
|
2023-12-14 10:37:29 +00:00
|
|
|
import "./styles/index.css";
|
2023-12-06 12:14:26 +00:00
|
|
|
|
2023-12-06 15:29:11 +00:00
|
|
|
async function get_version(): Promise<string> {
|
2023-12-07 14:11:12 +00:00
|
|
|
return invoke<string>("get_version");
|
2023-12-06 15:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function get_default_config(): Promise<RqbitDesktopConfig> {
|
2023-12-07 14:11:12 +00:00
|
|
|
return invoke<RqbitDesktopConfig>("config_default");
|
2023-12-06 15:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-07 00:13:11 +00:00
|
|
|
async function get_current_config(): Promise<CurrentDesktopState> {
|
2023-12-07 14:11:12 +00:00
|
|
|
return invoke<CurrentDesktopState>("config_current");
|
2023-12-07 00:13:11 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-07 14:11:12 +00:00
|
|
|
Promise.all([get_version(), get_default_config(), get_current_config()]).then(
|
|
|
|
|
([version, defaultConfig, currentState]) => {
|
2024-08-21 22:58:02 +01:00
|
|
|
console.log(version, defaultConfig, currentState);
|
2023-12-07 14:11:12 +00:00
|
|
|
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
|
|
|
<StrictMode>
|
2023-12-08 19:47:48 +00:00
|
|
|
<RqbitDesktop
|
|
|
|
|
version={version}
|
|
|
|
|
defaultConfig={defaultConfig}
|
|
|
|
|
currentState={currentState}
|
|
|
|
|
/>
|
2023-12-07 14:11:12 +00:00
|
|
|
</StrictMode>
|
2023-12-06 12:14:26 +00:00
|
|
|
);
|
2023-12-07 14:11:12 +00:00
|
|
|
}
|
|
|
|
|
);
|