import { NostrAccount } from "@lume/system"; import { Spinner } from "@lume/ui"; import { createLazyFileRoute } from "@tanstack/react-router"; import { message } from "@tauri-apps/plugin-dialog"; import { useState } from "react"; export const Route = createLazyFileRoute("/auth/remote")({ component: Screen, }); function Screen() { const navigate = Route.useNavigate(); const [uri, setUri] = useState(""); const [loading, setLoading] = useState(false); const submit = async () => { if (!uri.startsWith("bunker://")) { return await message( "You need to enter a valid Connect URI starts with bunker://", { title: "Nostr Connect", kind: "info" }, ); } try { setLoading(true); const remoteAccount = await NostrAccount.connectRemoteAccount(uri); if (remoteAccount?.length) { navigate({ to: "/", replace: true }); } } catch (e) { setLoading(false); await message(String(e), { title: "Nostr Connect", kind: "error" }); } }; return (
Waiting confirmation...
) : null}