2023-06-11 19:18:58 +05:00
|
|
|
|
<script lang="ts">
|
2026-01-04 22:50:34 +05:00
|
|
|
|
import { onMount, onDestroy } from "svelte"
|
2026-01-06 23:32:58 +05:00
|
|
|
|
import { invoke } from "@tauri-apps/api/core"
|
|
|
|
|
|
import { Notification, Space, Button } from "@svelteuidev/core"
|
2026-01-04 22:50:34 +05:00
|
|
|
|
import { InfoCircled } from "radix-icons-svelte"
|
|
|
|
|
|
|
2023-06-11 19:18:58 +05:00
|
|
|
|
import SearchBar from "@/components/elements/SearchBar.svelte"
|
|
|
|
|
|
import ArcReactor from "@/components/elements/ArcReactor.svelte"
|
|
|
|
|
|
import HDivider from "@/components/elements/HDivider.svelte"
|
|
|
|
|
|
import Stats from "@/components/elements/Stats.svelte"
|
|
|
|
|
|
import Footer from "@/components/Footer.svelte"
|
|
|
|
|
|
|
2026-01-06 23:32:58 +05:00
|
|
|
|
import { isJarvisRunning, updateJarvisStats } from "@/stores"
|
2023-06-11 19:18:58 +05:00
|
|
|
|
|
2026-01-06 23:32:58 +05:00
|
|
|
|
let running = false
|
|
|
|
|
|
let launching = false
|
|
|
|
|
|
|
|
|
|
|
|
isJarvisRunning.subscribe(value => {
|
|
|
|
|
|
running = value
|
2026-01-04 22:50:34 +05:00
|
|
|
|
})
|
2023-06-11 19:18:58 +05:00
|
|
|
|
|
2026-01-04 22:50:34 +05:00
|
|
|
|
onMount(() => {
|
|
|
|
|
|
document.body.classList.add("assist-page")
|
|
|
|
|
|
})
|
2023-06-11 19:18:58 +05:00
|
|
|
|
|
2026-01-04 22:50:34 +05:00
|
|
|
|
onDestroy(() => {
|
|
|
|
|
|
document.body.classList.remove("assist-page")
|
|
|
|
|
|
})
|
2026-01-06 23:32:58 +05:00
|
|
|
|
|
|
|
|
|
|
async function runAssistant() {
|
|
|
|
|
|
launching = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
await invoke("run_jarvis_app")
|
|
|
|
|
|
// wait a bit then check if it's running
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
updateJarvisStats()
|
|
|
|
|
|
launching = false
|
|
|
|
|
|
}, 2000)
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error("Failed to run jarvis-app:", err)
|
|
|
|
|
|
launching = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-11 19:18:58 +05:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<HDivider />
|
2026-01-04 22:50:34 +05:00
|
|
|
|
|
2026-01-06 23:32:58 +05:00
|
|
|
|
{#if !running}
|
2026-01-04 22:50:34 +05:00
|
|
|
|
<Notification
|
|
|
|
|
|
title="Внимание!"
|
|
|
|
|
|
icon={InfoCircled}
|
|
|
|
|
|
color="cyan"
|
|
|
|
|
|
withCloseButton={false}
|
|
|
|
|
|
>
|
2026-01-06 23:32:58 +05:00
|
|
|
|
В данный момент ассистент не запущен.<br />
|
|
|
|
|
|
Но вы всё еще можете изменять его настройки.<br />
|
|
|
|
|
|
<br />
|
|
|
|
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
color="lime"
|
|
|
|
|
|
radius="md"
|
|
|
|
|
|
size="sm"
|
|
|
|
|
|
uppercase
|
|
|
|
|
|
ripple
|
|
|
|
|
|
fullSize
|
|
|
|
|
|
on:click={runAssistant}
|
|
|
|
|
|
disabled={launching}
|
|
|
|
|
|
>
|
|
|
|
|
|
{launching ? "Запуск..." : "Запустить"}
|
|
|
|
|
|
</Button>
|
2026-01-04 22:50:34 +05:00
|
|
|
|
</Notification>
|
2023-06-11 19:18:58 +05:00
|
|
|
|
{:else}
|
2026-01-04 22:50:34 +05:00
|
|
|
|
<ArcReactor />
|
2023-06-11 19:18:58 +05:00
|
|
|
|
{/if}
|
2026-01-04 22:50:34 +05:00
|
|
|
|
|
|
|
|
|
|
<HDivider noMargin />
|
2023-06-11 19:18:58 +05:00
|
|
|
|
<Stats />
|
2026-01-06 23:32:58 +05:00
|
|
|
|
<Footer />
|