import type { ColumnRouteSearch } from "@lume/types"; import { Spinner } from "@lume/ui"; import { createFileRoute } from "@tanstack/react-router"; import { invoke } from "@tauri-apps/api/core"; import { useState } from "react"; import { toast } from "sonner"; 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 toast.warning("You must enter a valid npub."); try { setIsLoading(true); const sync: boolean = await invoke("friend_to_friend", { npub }); if (sync) { return navigate({ to: redirect }); } } catch (e) { setIsLoading(false); toast.error(String(e)); } }; 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="h-11 rounded-lg bg-transparent border border-neutral-200 dark:border-neutral-800 px-3 placeholder:text-neutral-600 focus:border-blue-500 focus:ring-0 dark:placeholder:text-neutral-400" />
); }