import { NDKKind } from '@nostr-dev-kit/ndk'; import { useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; import { useStorage } from '@libs/storage/provider'; import { AvatarUploader } from '@shared/avatarUploader'; import { BannerUploader } from '@shared/bannerUploader'; import { LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon } from '@shared/icons/arrowRightCircle'; import { Image } from '@shared/image'; import { useOnboarding } from '@stores/onboarding'; import { WidgetKinds } from '@stores/widgets'; import { useNostr } from '@utils/hooks/useNostr'; export function CreateStep2Screen() { const navigate = useNavigate(); const setStep = useOnboarding((state) => state.setStep); const [loading, setLoading] = useState(false); const [picture, setPicture] = useState('https://void.cat/d/5VKmKyuHyxrNMf9bWSVPih'); const [banner, setBanner] = useState(''); const { db } = useStorage(); const { publish } = useNostr(); const { register, handleSubmit, formState: { isDirty, isValid }, } = useForm(); const onSubmit = async (data: { name: string; about: string; website: string }) => { setLoading(true); try { const profile = { ...data, name: data.name, display_name: data.name, bio: data.about, website: data.website, }; const event = await publish({ content: JSON.stringify(profile), kind: NDKKind.Metadata, tags: [], }); // create default widget await db.createWidget(WidgetKinds.other.learnNostr, 'Learn Nostr', ''); if (event) { navigate('/auth/onboarding', { replace: true }); } } catch (e) { console.log('error: ', e); setLoading(false); } }; useEffect(() => { // save current step, if user close app and reopen it setStep('/auth/create/step-3'); }, []); return (

Personalize your Nostr profile

Nostr profile is synchronous across all Nostr clients. If you create a profile on Lume, it will also work well with other Nostr clients. If you update your profile on another Nostr client, it will also sync to Lume.

{banner ? ( user's banner ) : (
)}
user's avatar