import { Spinner } from "@/components"; import { NostrAccount } from "@/system"; import type { ColumnRouteSearch } from "@/types"; import { createFileRoute } from "@tanstack/react-router"; import { message } from "@tauri-apps/plugin-dialog"; import { useState } from "react"; export const Route = createFileRoute("/create-newsfeed/f2f")({ validateSearch: (search: Record): ColumnRouteSearch => { return { account: search.account, label: search.label, name: search.name, }; }, component: Screen, }); function Screen() { const navigate = Route.useNavigate(); const { redirect } = Route.useSearch(); const [npub, setNpub] = useState(""); const [isLoading, setIsLoading] = useState(false); const submit = async () => { if (!npub.startsWith("npub1")) { return await message("You must enter a valid npub.", { title: "Create Newsfeed", kind: "info", }); } try { setIsLoading(true); const sync = await NostrAccount.f2f(npub); if (sync) { return navigate({ to: redirect }); } } catch (e) { setIsLoading(false); await message(String(e), { title: "Create Newsfeed", kind: "error", }); } }; return (

You already have a friend on Nostr?

Instead of building the timeline by yourself.

Just enter your friend's{" "} npub.

You will have the same experience as your friend. Of course, you always can edit your network later.

setNpub(e.target.value)} spellCheck={false} className="px-3 bg-transparent border rounded-lg h-11 border-neutral-200 dark:border-neutral-800 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:placeholder:text-neutral-400" />
); }