import { commands } from "@/commands.gen"; import { Spinner, User } from "@/components"; import { Lock } from "@phosphor-icons/react"; import { createLazyFileRoute } from "@tanstack/react-router"; import { getCurrentWindow } from "@tauri-apps/api/window"; import { message } from "@tauri-apps/plugin-dialog"; import { useState, useTransition } from "react"; export const Route = createLazyFileRoute("/set-signer/$id")({ component: Screen, }); function Screen() { const { id } = Route.useParams(); const [password, setPassword] = useState(""); const [isPending, startTransition] = useTransition(); const unlock = () => { startTransition(async () => { if (!password.length) { await message("Password is required", { kind: "info" }); return; } const window = getCurrentWindow(); const res = await commands.setSigner(id, password); if (res.status === "ok") { await window.close(); } else { await message(res.error, { kind: "error" }); return; } }); }; return (