Add settings button to desktop
This commit is contained in:
parent
ea4193aa2e
commit
e4543e1ba2
3 changed files with 58 additions and 23 deletions
|
|
@ -4,7 +4,7 @@ import { APIContext, RqbitWebUI } from "./rqbit-webui-src/rqbit-web";
|
|||
import { API } from "./api";
|
||||
import { invoke } from "@tauri-apps/api";
|
||||
import { RqbitDesktopConfig } from "./configuration";
|
||||
import { ConfigModal } from "./configure";
|
||||
import { RqbitDesktop } from "./rqbit-desktop";
|
||||
|
||||
async function get_version(): Promise<string> {
|
||||
return invoke<string>("get_version");
|
||||
|
|
@ -14,18 +14,6 @@ async function get_default_config(): Promise<RqbitDesktopConfig> {
|
|||
return invoke<RqbitDesktopConfig>("config_default");
|
||||
}
|
||||
|
||||
const RqbitDesktop: React.FC<{
|
||||
version: string,
|
||||
defaultConfig: RqbitDesktopConfig,
|
||||
}> = ({ version, defaultConfig }) => {
|
||||
let [configured, setConfigured] = useState<boolean>(false);
|
||||
|
||||
if (configured) {
|
||||
return <RqbitWebUI title={`Rqbit Desktop v${version}`}></RqbitWebUI>
|
||||
}
|
||||
return <ConfigModal handleOk={() => setConfigured(true)} initialConfig={defaultConfig}></ConfigModal>;
|
||||
}
|
||||
|
||||
Promise.all([get_version(), get_default_config()]).then(([version, config]) => {
|
||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
<StrictMode>
|
||||
|
|
@ -34,7 +22,4 @@ Promise.all([get_version(), get_default_config()]).then(([version, config]) => {
|
|||
</APIContext.Provider>
|
||||
</StrictMode>
|
||||
);
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue