import { useArk } from "@lume/ark"; import { ArrowLeftIcon, CancelIcon, ChevronDownIcon, LoaderIcon, PlusIcon, } from "@lume/icons"; import { cn } from "@lume/utils"; import * as Accordion from "@radix-ui/react-accordion"; import { useQuery } from "@tanstack/react-query"; import { motion } from "framer-motion"; import { nip19 } from "nostr-tools"; import { useState } from "react"; import { useNavigate } from "react-router-dom"; import { toast } from "sonner"; import { User } from "../user"; const POPULAR_USERS = [ "npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6", "npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m", "npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s", "npub1gcxzte5zlkncx26j68ez60fzkvtkm9e0vrwdcvsjakxf9mu9qewqlfnj5z", "npub1az9xj85cmxv8e9j9y80lvqp97crsqdu2fpu3srwthd99qfu9qsgstam8y8", "npub1a2cww4kn9wqte4ry70vyfwqyqvpswksna27rtxd8vty6c74era8sdcw83a", "npub168ghgug469n4r2tuyw05dmqhqv5jcwm7nxytn67afmz8qkc4a4zqsu2dlc", "npub133vj8ycevdle0cq8mtgddq0xtn34kxkwxvak983dx0u5vhqnycyqj6tcza", "npub18ams6ewn5aj2n3wt2qawzglx9mr4nzksxhvrdc4gzrecw7n5tvjqctp424", "npub1r0rs5q2gk0e3dk3nlc7gnu378ec6cnlenqp8a3cjhyzu6f8k5sgs4sq9ac", "npub1prya33fnqerq0fljwjtp77ehtu7jlsjt5ydhwveuwmqdsdm6k8esk42xcv", "npub19mduaf5569jx9xz555jcx3v06mvktvtpu0zgk47n4lcpjsz43zzqhj6vzk", ]; const LUME_USERS = [ "npub1zfss807aer0j26mwp2la0ume0jqde3823rmu97ra6sgyyg956e0s6xw445", ]; export function OnboardingFollowScreen() { const ark = useArk(); const navigate = useNavigate(); const { isLoading, isError, data } = useQuery({ queryKey: ["trending-users"], queryFn: async ({ signal }: { signal: AbortSignal }) => { const res = await fetch("https://api.nostr.band/v0/trending/profiles", { signal, }); if (!res.ok) { throw new Error("Failed to fetch trending users from nostr.band API."); } return res.json(); }, }); const [loading, setLoading] = useState(false); const [follows, setFollows] = useState([]); // toggle follow state const toggleFollow = (pubkey: string) => { const arr = follows.includes(pubkey) ? follows.filter((i) => i !== pubkey) : [...follows, pubkey]; setFollows(arr); }; const submit = async () => { try { setLoading(true); if (!follows.length) return navigate("/finish"); const publish = await ark.newContactList({ tags: follows.map((item) => { if (item.startsWith("npub1")) return ["p", nip19.decode(item).data as string]; return ["p", item]; }), }); if (publish) { setLoading(false); return navigate("/finish"); } } catch (e) { setLoading(false); toast.error(e); } }; return (
Dive into the nostrverse

Nostr is fun when we are together. Try following some users that interest you to build up your timeline.

Recommended
{POPULAR_USERS.map((pubkey) => (
))}
Trending users
{isLoading ? (
) : isError ? (
Error. Cannot get trending users
) : ( data?.profiles.map((item: { pubkey: string }) => (
)) )}
Lume HQ
{LUME_USERS.map((pubkey) => (
))}
); }