import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { type } from "@tauri-apps/plugin-os"; import { HeaderSize } from "@yaakapp-internal/ui"; import { ActionButton } from "./ActionButton"; import { Sidebar } from "./Sidebar"; import classNames from "classnames"; import { createStore, Provider, useAtomValue } from "jotai"; import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import "./main.css"; import { initHotkeys } from "./hotkeys"; import { listen, rpc } from "./rpc"; import { applyChange, dataAtom, httpExchangesAtom, replaceAll } from "./store"; const queryClient = new QueryClient(); const jotaiStore = createStore(); // Load initial models from the database rpc("list_models", {}).then((res) => { jotaiStore.set(dataAtom, (prev) => replaceAll(prev, "http_exchange", res.httpExchanges), ); }); // Register hotkeys from action metadata initHotkeys(); // Subscribe to model change events from the backend listen("model_write", (payload) => { jotaiStore.set(dataAtom, (prev) => applyChange(prev, "http_exchange", payload.model, payload.change), ); }); function App() { const osType = type(); const exchanges = useAtomValue(httpExchangesAtom); return (
Yaak Proxy
{exchanges.length === 0 ? (

No traffic yet

) : ( {exchanges.map((ex) => ( ))}
Method URL Status
{ex.method} {ex.url} {ex.resStatus ?? "—"}
)}
); } createRoot(document.getElementById("root") as HTMLElement).render( , );