import { commands } from "@/commands.gen"; import { Frame, GoBack } from "@/components"; import { Spinner } from "@/components/spinner"; import { createLazyFileRoute } from "@tanstack/react-router"; import { readText } from "@tauri-apps/plugin-clipboard-manager"; import { message } from "@tauri-apps/plugin-dialog"; import { useState, useTransition } from "react"; export const Route = createLazyFileRoute("/new-account/watch")({ component: Screen, }); function Screen() { const navigate = Route.useNavigate(); const [key, setKey] = useState(""); const [isPending, startTransition] = useTransition(); const pasteFromClipboard = async () => { const val = await readText(); setKey(val); }; const submit = () => { startTransition(async () => { if (!key.startsWith("npub") && !key.startsWith("nprofile")) { await message( "You need to enter a valid public key starts with npub or nprofile", { kind: "info" }, ); return; } const res = await commands.watchAccount(key); if (res.status === "ok") { navigate({ to: "/", replace: true }); } else { await message(res.error, { kind: "error", }); return; } }); }; return (

Continue with Public Key (Watch Mode)

setKey(e.target.value)} className="pl-3 pr-12 rounded-lg w-full h-10 bg-transparent border border-neutral-200 dark:border-neutral-700 focus:border-blue-500 focus:outline-none placeholder:text-neutral-400" />
Go back to previous screen
); }