mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 11:13:30 +00:00
update create account flow
This commit is contained in:
parent
5a6dd172b1
commit
8e513404c3
@ -41,6 +41,7 @@
|
|||||||
"@void-cat/api": "^1.0.7",
|
"@void-cat/api": "^1.0.7",
|
||||||
"dayjs": "^1.11.9",
|
"dayjs": "^1.11.9",
|
||||||
"destr": "^2.0.1",
|
"destr": "^2.0.1",
|
||||||
|
"framer-motion": "^10.16.4",
|
||||||
"get-urls": "^12.1.0",
|
"get-urls": "^12.1.0",
|
||||||
"html-to-text": "^9.0.5",
|
"html-to-text": "^9.0.5",
|
||||||
"light-bolt11-decoder": "^3.0.0",
|
"light-bolt11-decoder": "^3.0.0",
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Image } from '@shared/image';
|
import { Image } from '@shared/image';
|
||||||
|
|
||||||
import { useProfile } from '@utils/hooks/useProfile';
|
import { useProfile } from '@utils/hooks/useProfile';
|
||||||
import { displayNpub } from '@utils/shortenKey';
|
|
||||||
|
|
||||||
export function User({ pubkey, fallback }: { pubkey: string; fallback?: string }) {
|
export function User({ pubkey, fallback }: { pubkey: string; fallback?: string }) {
|
||||||
const { status, user } = useProfile(pubkey, fallback);
|
const { status, user } = useProfile(pubkey, fallback);
|
||||||
@ -19,19 +18,19 @@ export function User({ pubkey, fallback }: { pubkey: string; fallback?: string }
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2.5">
|
<div className="flex items-start gap-2.5 py-2">
|
||||||
<Image
|
<Image
|
||||||
src={user?.picture || user?.image}
|
src={user?.picture || user?.image}
|
||||||
alt={pubkey}
|
alt={pubkey}
|
||||||
className="h-10 w-10 shrink-0 rounded-lg object-cover"
|
className="h-11 w-11 shrink-0 rounded-lg object-cover"
|
||||||
/>
|
/>
|
||||||
<div className="flex w-full flex-1 flex-col items-start text-start">
|
<div className="flex w-full flex-1 flex-col items-start text-start">
|
||||||
<p className="max-w-[15rem] truncate font-medium leading-tight text-white">
|
<p className="max-w-[15rem] truncate font-semibold text-white">
|
||||||
{user?.name || user?.display_name}
|
{user?.name || user?.display_name}
|
||||||
</p>
|
</p>
|
||||||
<span className="max-w-[15rem] truncate leading-tight text-white/50">
|
<div className="line-clamp-4 break-all text-sm text-white/70">
|
||||||
{displayNpub(pubkey, 16)}
|
{user?.about || user?.bio || 'No bio'}
|
||||||
</span>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { BaseDirectory, writeTextFile } from '@tauri-apps/api/fs';
|
import { writeText } from '@tauri-apps/api/clipboard';
|
||||||
|
import { message, save } from '@tauri-apps/api/dialog';
|
||||||
|
import { writeTextFile } from '@tauri-apps/api/fs';
|
||||||
|
import { downloadDir } from '@tauri-apps/api/path';
|
||||||
import { generatePrivateKey, getPublicKey, nip19 } from 'nostr-tools';
|
import { generatePrivateKey, getPublicKey, nip19 } from 'nostr-tools';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import { useStorage } from '@libs/storage/provider';
|
import { useStorage } from '@libs/storage/provider';
|
||||||
|
|
||||||
import { Button } from '@shared/button';
|
import { CopyIcon } from '@shared/icons';
|
||||||
import { EyeOffIcon, EyeOnIcon, LoaderIcon } from '@shared/icons';
|
|
||||||
import { ArrowRightCircleIcon } from '@shared/icons/arrowRightCircle';
|
|
||||||
|
|
||||||
import { useOnboarding } from '@stores/onboarding';
|
import { useOnboarding } from '@stores/onboarding';
|
||||||
import { useStronghold } from '@stores/stronghold';
|
import { useStronghold } from '@stores/stronghold';
|
||||||
@ -21,8 +22,8 @@ export function CreateStep1Screen() {
|
|||||||
const setPubkey = useOnboarding((state) => state.setPubkey);
|
const setPubkey = useOnboarding((state) => state.setPubkey);
|
||||||
const setStep = useOnboarding((state) => state.setStep);
|
const setStep = useOnboarding((state) => state.setStep);
|
||||||
|
|
||||||
const [privkeyInput, setPrivkeyInput] = useState('password');
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
const [downloaded, setDownloaded] = useState(false);
|
const [downloaded, setDownloaded] = useState(false);
|
||||||
|
|
||||||
const privkey = useMemo(() => generatePrivateKey(), []);
|
const privkey = useMemo(() => generatePrivateKey(), []);
|
||||||
@ -30,24 +31,36 @@ export function CreateStep1Screen() {
|
|||||||
const npub = nip19.npubEncode(pubkey);
|
const npub = nip19.npubEncode(pubkey);
|
||||||
const nsec = nip19.nsecEncode(privkey);
|
const nsec = nip19.nsecEncode(privkey);
|
||||||
|
|
||||||
// toggle private key
|
const download = async () => {
|
||||||
const showPrivateKey = () => {
|
try {
|
||||||
if (privkeyInput === 'password') {
|
const downloadPath = await downloadDir();
|
||||||
setPrivkeyInput('text');
|
const fileName = `nostr_keys_${new Date().toISOString()}.txt`;
|
||||||
} else {
|
const filePath = await save({
|
||||||
setPrivkeyInput('password');
|
defaultPath: downloadPath + '/' + fileName,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (filePath) {
|
||||||
|
await writeTextFile(
|
||||||
|
filePath,
|
||||||
|
`Generated by Lume (lume.nu)\nPublic key: ${npub}\nPrivate key: ${nsec}`
|
||||||
|
);
|
||||||
|
|
||||||
|
setDownloaded(true);
|
||||||
|
} // else { user cancel action }
|
||||||
|
} catch (e) {
|
||||||
|
await message(e, { title: 'Cannot download account keys', type: 'error' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const download = async () => {
|
const copyPrivkey = async () => {
|
||||||
await writeTextFile(
|
try {
|
||||||
`nostr_keys_${new Date().toISOString().slice(0, 10)}.txt`,
|
await writeText(nsec);
|
||||||
`Generated by Lume (lume.nu)\nPublic key: ${npub}\nPrivate key: ${nsec}`,
|
setCopied(true);
|
||||||
{
|
|
||||||
dir: BaseDirectory.Download,
|
setTimeout(() => setCopied(false), 3000);
|
||||||
}
|
} catch (e) {
|
||||||
);
|
await message(e, { title: 'Cannot copy private key', type: 'error' });
|
||||||
setDownloaded(true);
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
@ -72,76 +85,68 @@ export function CreateStep1Screen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-md">
|
<div className="mx-auto w-full max-w-md">
|
||||||
<div className="mb-8 text-center">
|
<div className="mb-4 border-b border-white/10 pb-4">
|
||||||
<h1 className="text-xl font-semibold text-white">Save your access key!</h1>
|
<h1 className="mb-2 text-center text-2xl font-semibold text-white">
|
||||||
|
This is your new Nostr account
|
||||||
|
</h1>
|
||||||
|
<p className="mb-2 text-white/70">
|
||||||
|
Your private key is your password. If you lose this key, you will lose access to
|
||||||
|
your account! Copy it and keep it in a safe place. There is no way to reset your
|
||||||
|
private key.
|
||||||
|
</p>
|
||||||
|
<p className="text-white/70">
|
||||||
|
Public key is used for sharing with other people so that they can find you using
|
||||||
|
the public key.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-8">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-3">
|
||||||
<span className="text-base font-semibold text-white/50">Public Key</span>
|
<div className="flex flex-col gap-1">
|
||||||
<input
|
<span className="font-medium text-white">Private Key</span>
|
||||||
readOnly
|
<div className="relative">
|
||||||
value={npub}
|
<input
|
||||||
className="relative h-11 w-full rounded-lg bg-white/10 px-3.5 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
readOnly
|
||||||
/>
|
value={nsec.substring(0, 5) + '**************************************'}
|
||||||
</div>
|
className="relative h-12 w-full rounded-lg border-t border-white/10 bg-white/20 py-1 pl-3.5 pr-11 text-white !outline-none backdrop-blur-xl placeholder:text-white/70"
|
||||||
<div className="flex flex-col gap-1">
|
/>
|
||||||
<span className="text-base font-semibold text-white/50">Private Key</span>
|
<button
|
||||||
<div className="relative">
|
type="button"
|
||||||
|
onClick={() => copyPrivkey()}
|
||||||
|
className="group absolute right-2 top-1/2 inline-flex h-7 -translate-y-1/2 transform items-center gap-1.5 rounded-md bg-white/20 px-2.5 text-sm hover:bg-white/30"
|
||||||
|
>
|
||||||
|
<CopyIcon className="h-4 w-4 text-white/70 group-hover:text-white" />
|
||||||
|
{copied ? 'Copied' : 'Copy'}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col gap-1">
|
||||||
|
<span className="font-medium text-white">Public Key</span>
|
||||||
<input
|
<input
|
||||||
readOnly
|
readOnly
|
||||||
type={privkeyInput}
|
value={npub}
|
||||||
value={nsec}
|
className="relative h-12 w-full rounded-lg border-t border-white/10 bg-white/20 px-3.5 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/70"
|
||||||
className="relative h-11 w-full rounded-lg bg-white/10 py-1 pl-3.5 pr-11 text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
|
||||||
/>
|
/>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => showPrivateKey()}
|
|
||||||
className="group absolute right-2 top-1/2 -translate-y-1/2 transform rounded p-1 backdrop-blur-xl hover:bg-white/10"
|
|
||||||
>
|
|
||||||
{privkeyInput === 'password' ? (
|
|
||||||
<EyeOffIcon className="h-4 w-4 text-white/50 group-hover:text-white" />
|
|
||||||
) : (
|
|
||||||
<EyeOnIcon className="h-4 w-4 text-white/50 group-hover:text-white" />
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div className="mt-2 text-sm text-white/50">
|
|
||||||
<p>
|
|
||||||
Your private key is your password. If you lose this key, you will lose
|
|
||||||
access to your account! Copy it and keep it in a safe place. There is no way
|
|
||||||
to reset your private key.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => submit()}
|
onClick={() => download()}
|
||||||
className="inline-flex h-11 w-full items-center justify-between gap-2 rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
className="inline-flex h-12 w-full items-center justify-center rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
||||||
>
|
>
|
||||||
{loading ? (
|
{downloaded ? 'Downloaded' : 'Download account keys'}
|
||||||
<>
|
|
||||||
<span className="w-5" />
|
|
||||||
<span>Creating...</span>
|
|
||||||
<LoaderIcon className="h-5 w-5 animate-spin text-white" />
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<span className="w-5" />
|
|
||||||
<span>I have saved my key, continue</span>
|
|
||||||
<ArrowRightCircleIcon className="h-5 w-5" />
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</button>
|
</button>
|
||||||
{downloaded ? (
|
<button
|
||||||
<span className="inline-flex h-11 w-full items-center justify-center text-sm text-white/50">
|
type="button"
|
||||||
Saved in Download folder
|
onClick={() => submit()}
|
||||||
</span>
|
className="inline-flex h-12 w-full items-center justify-center rounded-lg border-t border-white/10 bg-white/20 px-6 font-medium leading-none text-white hover:bg-white/30 focus:outline-none"
|
||||||
) : (
|
>
|
||||||
<Button preset="large-alt" onClick={() => download()}>
|
{loading ? 'Creating...' : 'Continue'}
|
||||||
Download
|
</button>
|
||||||
</Button>
|
<span className="text-center text-sm text-white/50">
|
||||||
)}
|
By clicking 'Continue', you are ensuring that your keys are saved in
|
||||||
|
a safe place. You cannot recover these keys if they are lost.
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,10 +86,16 @@ export function CreateStep2Screen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-md">
|
<div className="mx-auto w-full max-w-md">
|
||||||
<div className="mb-8 text-center">
|
<div className="mb-4 border-b border-white/10 pb-4">
|
||||||
<h1 className="text-xl font-semibold text-white">
|
<h1 className="mb-2 text-center text-2xl font-semibold text-white">
|
||||||
Set password to secure your key
|
Set password to secure your key
|
||||||
</h1>
|
</h1>
|
||||||
|
<p className="text-white/70">
|
||||||
|
Password is not related to your Nostr account. It is only used to secure your
|
||||||
|
keys stored on your local machine and to unlock the app (like unlocking your
|
||||||
|
phone with a passcode). When you move to other Nostr clients, you just need to
|
||||||
|
copy your private key.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-3">
|
<form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-3">
|
||||||
@ -98,12 +104,12 @@ export function CreateStep2Screen() {
|
|||||||
<input
|
<input
|
||||||
{...register('password', { required: true })}
|
{...register('password', { required: true })}
|
||||||
type={passwordInput}
|
type={passwordInput}
|
||||||
className="relative h-11 w-full rounded-lg bg-white/10 px-3.5 py-1 text-center text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
className="relative h-12 w-full rounded-lg border-t border-white/10 bg-white/20 px-3.5 py-1 text-center tracking-widest text-white !outline-none backdrop-blur-xl placeholder:text-white/70"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => showPassword()}
|
onClick={() => showPassword()}
|
||||||
className="group absolute right-2 top-1/2 -translate-y-1/2 transform rounded p-1 backdrop-blur-xl hover:bg-white/10"
|
className="group absolute right-2 top-1/2 -translate-y-1/2 transform rounded p-1 backdrop-blur-xl hover:bg-white/20"
|
||||||
>
|
>
|
||||||
{passwordInput === 'password' ? (
|
{passwordInput === 'password' ? (
|
||||||
<EyeOffIcon className="h-4 w-4 text-white/50 group-hover:text-white" />
|
<EyeOffIcon className="h-4 w-4 text-white/50 group-hover:text-white" />
|
||||||
@ -112,13 +118,6 @@ export function CreateStep2Screen() {
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm text-white/50">
|
|
||||||
<p>
|
|
||||||
Password is use to secure your key store in local machine, when you move
|
|
||||||
to other clients, you just need to copy your private key as nsec or
|
|
||||||
hexstring
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<span className="text-sm text-red-400">
|
<span className="text-sm text-red-400">
|
||||||
{errors.password && <p>{errors.password.message}</p>}
|
{errors.password && <p>{errors.password.message}</p>}
|
||||||
</span>
|
</span>
|
||||||
@ -127,12 +126,12 @@ export function CreateStep2Screen() {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!isDirty || !isValid}
|
disabled={!isDirty || !isValid}
|
||||||
className="inline-flex h-11 w-full items-center justify-between gap-2 rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
className="inline-flex h-12 w-full items-center justify-between gap-2 rounded-lg border-t border-white/10 bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<>
|
<>
|
||||||
<span className="w-5" />
|
<span className="w-5" />
|
||||||
<span>Creating...</span>
|
<span>Securing your account...</span>
|
||||||
<LoaderIcon className="h-5 w-5 animate-spin text-white" />
|
<LoaderIcon className="h-5 w-5 animate-spin text-white" />
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
@ -61,15 +61,22 @@ export function CreateStep3Screen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-md">
|
<div className="mx-auto w-full max-w-md">
|
||||||
<div className="mb-8 text-center">
|
<div className="mb-4 border-b border-white/10 pb-4">
|
||||||
<h1 className="text-xl font-semibold text-white">Create your profile</h1>
|
<h1 className="mb-2 text-center text-2xl font-semibold text-white">
|
||||||
|
Personalize your Nostr profile
|
||||||
|
</h1>
|
||||||
|
<p className="text-white/70">
|
||||||
|
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.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full overflow-hidden rounded-xl bg-white/10 backdrop-blur-xl">
|
<div className="w-full overflow-hidden rounded-xl bg-white/10 backdrop-blur-xl">
|
||||||
<form onSubmit={handleSubmit(onSubmit)} className="mb-0 flex flex-col">
|
<form onSubmit={handleSubmit(onSubmit)} className="mb-0 flex flex-col">
|
||||||
<input type={'hidden'} {...register('picture')} value={picture} />
|
<input type={'hidden'} {...register('picture')} value={picture} />
|
||||||
<input type={'hidden'} {...register('banner')} value={banner} />
|
<input type={'hidden'} {...register('banner')} value={banner} />
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div className="relative h-44 w-full bg-white/10 backdrop-blur-xl">
|
<div className="relative h-36 w-full bg-white/10 backdrop-blur-xl">
|
||||||
{banner ? (
|
{banner ? (
|
||||||
<Image
|
<Image
|
||||||
src={banner}
|
src={banner}
|
||||||
@ -77,18 +84,18 @@ export function CreateStep3Screen() {
|
|||||||
className="h-full w-full object-cover"
|
className="h-full w-full object-cover"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="h-full w-full bg-black/50" />
|
<div className="h-full w-full bg-white/20" />
|
||||||
)}
|
)}
|
||||||
<div className="absolute left-1/2 top-1/2 z-10 h-full w-full -translate-x-1/2 -translate-y-1/2 transform">
|
<div className="absolute left-1/2 top-1/2 z-10 h-full w-full -translate-x-1/2 -translate-y-1/2 transform">
|
||||||
<BannerUploader setBanner={setBanner} />
|
<BannerUploader setBanner={setBanner} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-5 px-4">
|
<div className="mb-5 px-4">
|
||||||
<div className="relative z-10 -mt-7 h-14 w-14">
|
<div className="relative z-10 -mt-8 h-16 w-16">
|
||||||
<Image
|
<Image
|
||||||
src={picture}
|
src={picture}
|
||||||
alt="user's avatar"
|
alt="user's avatar"
|
||||||
className="h-14 w-14 rounded-lg object-cover ring-2 ring-white/10"
|
className="h-16 w-16 rounded-lg object-cover ring-2 ring-white/20"
|
||||||
/>
|
/>
|
||||||
<div className="absolute left-1/2 top-1/2 z-10 h-full w-full -translate-x-1/2 -translate-y-1/2 transform">
|
<div className="absolute left-1/2 top-1/2 z-10 h-full w-full -translate-x-1/2 -translate-y-1/2 transform">
|
||||||
<AvatarUploader setPicture={setPicture} />
|
<AvatarUploader setPicture={setPicture} />
|
||||||
@ -98,10 +105,7 @@ export function CreateStep3Screen() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-4 px-4 pb-4">
|
<div className="flex flex-col gap-4 px-4 pb-4">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<label
|
<label htmlFor="name" className="font-medium text-white">
|
||||||
htmlFor="name"
|
|
||||||
className="text-sm font-semibold uppercase tracking-wider text-white/50"
|
|
||||||
>
|
|
||||||
Name *
|
Name *
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@ -111,42 +115,35 @@ export function CreateStep3Screen() {
|
|||||||
minLength: 4,
|
minLength: 4,
|
||||||
})}
|
})}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
className="relative h-11 w-full rounded-lg bg-white/10 px-3 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
className="relative h-12 w-full rounded-lg bg-white/20 px-3 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/70"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<label
|
<label htmlFor="about" className="font-medium text-white">
|
||||||
htmlFor="about"
|
|
||||||
className="text-sm font-semibold uppercase tracking-wider text-white/50"
|
|
||||||
>
|
|
||||||
Bio
|
Bio
|
||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
{...register('about')}
|
{...register('about')}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
className="relative h-20 w-full resize-none rounded-lg bg-white/10 px-3 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
className="relative h-20 w-full resize-none rounded-lg bg-white/20 px-3 py-2 text-white !outline-none backdrop-blur-xl placeholder:text-white/70"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<label
|
<label htmlFor="website" className="font-medium text-white">
|
||||||
htmlFor="website"
|
|
||||||
className="text-sm font-semibold uppercase tracking-wider text-white/50"
|
|
||||||
>
|
|
||||||
Website
|
Website
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type={'text'}
|
|
||||||
{...register('website', {
|
{...register('website', {
|
||||||
required: false,
|
required: false,
|
||||||
})}
|
})}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
className="relative h-11 w-full rounded-lg bg-white/10 px-3 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
className="relative h-12 w-full rounded-lg bg-white/20 px-3 py-1 text-white !outline-none backdrop-blur-xl placeholder:text-white/70"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!isDirty || !isValid}
|
disabled={!isDirty || !isValid}
|
||||||
className="inline-flex h-11 w-full items-center justify-between gap-2 rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
className="inline-flex h-12 w-full items-center justify-between gap-2 rounded-lg border-t border-white/10 bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<>
|
<>
|
||||||
|
@ -19,7 +19,7 @@ export function OnboardStep1Screen() {
|
|||||||
|
|
||||||
const { publish, fetchUserData, prefetchEvents } = useNostr();
|
const { publish, fetchUserData, prefetchEvents } = useNostr();
|
||||||
const { db } = useStorage();
|
const { db } = useStorage();
|
||||||
const { status, data } = useQuery(['trending-profiles'], async () => {
|
const { status, data } = useQuery(['trending-profiles-widget'], async () => {
|
||||||
const res = await fetch('https://api.nostr.band/v0/trending/profiles');
|
const res = await fetch('https://api.nostr.band/v0/trending/profiles');
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error('Error');
|
throw new Error('Error');
|
||||||
@ -69,14 +69,18 @@ export function OnboardStep1Screen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-md">
|
<div className="mx-auto w-full max-w-md">
|
||||||
<div className="mb-8 text-center">
|
<div className="mb-4 border-b border-white/10 pb-4">
|
||||||
<h1 className="text-xl font-semibold text-white">
|
<h1 className="mb-2 text-center text-2xl font-semibold text-white">
|
||||||
{loading ? 'Prefetching data...' : 'Enrich your network'}
|
{loading ? 'Prefetching data...' : 'Enrich your network'}
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm text-white/50">Choose account you want to follow</p>
|
<p className="text-white/70">
|
||||||
|
Choose the account you want to follow. These accounts are trending in the last
|
||||||
|
24 hours. If none of the accounts interest you, you can explore more options and
|
||||||
|
add them later.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<div className="scrollbar-hide flex h-[500px] w-full flex-col overflow-y-auto rounded-xl bg-white/10 py-2 backdrop-blur-xl">
|
<div className="scrollbar-hide flex h-[450px] w-full flex-col divide-y divide-white/5 overflow-y-auto rounded-xl bg-white/20 backdrop-blur-xl">
|
||||||
{status === 'loading' ? (
|
{status === 'loading' ? (
|
||||||
<div className="flex h-full w-full items-center justify-center">
|
<div className="flex h-full w-full items-center justify-center">
|
||||||
<LoaderIcon className="h-4 w-4 animate-spin text-white" />
|
<LoaderIcon className="h-4 w-4 animate-spin text-white" />
|
||||||
@ -88,11 +92,11 @@ export function OnboardStep1Screen() {
|
|||||||
key={item.pubkey}
|
key={item.pubkey}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => toggleFollow(item.pubkey)}
|
onClick={() => toggleFollow(item.pubkey)}
|
||||||
className="inline-flex transform items-center justify-between px-4 py-2 hover:bg-white/20"
|
className="relative px-4 py-2 hover:bg-white/10"
|
||||||
>
|
>
|
||||||
<User pubkey={item.pubkey} fallback={item.profile?.content} />
|
<User pubkey={item.pubkey} fallback={item.profile?.content} />
|
||||||
{follows.includes(item.pubkey) && (
|
{follows.includes(item.pubkey) && (
|
||||||
<div>
|
<div className="absolute right-2 top-2">
|
||||||
<CheckCircleIcon className="h-4 w-4 text-green-400" />
|
<CheckCircleIcon className="h-4 w-4 text-green-400" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -106,7 +110,7 @@ export function OnboardStep1Screen() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={submit}
|
onClick={submit}
|
||||||
disabled={loading || follows.length === 0}
|
disabled={loading || follows.length === 0}
|
||||||
className="inline-flex h-11 w-full items-center justify-between gap-2 rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none disabled:opacity-50"
|
className="inline-flex h-12 w-full items-center justify-between gap-2 rounded-lg border-t border-white/10 bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<>
|
<>
|
||||||
@ -122,12 +126,14 @@ export function OnboardStep1Screen() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
<Link
|
{!loading ? (
|
||||||
to="/auth/onboarding/step-2"
|
<Link
|
||||||
className="inline-flex h-11 w-full items-center justify-center rounded-lg px-6 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/10 focus:outline-none"
|
to="/auth/onboarding/step-2"
|
||||||
>
|
className="inline-flex h-12 w-full items-center justify-center rounded-lg border-t border-white/10 bg-white/20 px-6 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/30 focus:outline-none"
|
||||||
Skip, you can add later
|
>
|
||||||
</Link>
|
Skip, you can add later
|
||||||
|
</Link>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,6 +12,7 @@ import { WidgetKinds } from '@stores/widgets';
|
|||||||
const data = [
|
const data = [
|
||||||
{ hashtag: '#bitcoin' },
|
{ hashtag: '#bitcoin' },
|
||||||
{ hashtag: '#nostr' },
|
{ hashtag: '#nostr' },
|
||||||
|
{ hashtag: '#nostrdesign' },
|
||||||
{ hashtag: '#zap' },
|
{ hashtag: '#zap' },
|
||||||
{ hashtag: '#LFG' },
|
{ hashtag: '#LFG' },
|
||||||
{ hashtag: '#zapchain' },
|
{ hashtag: '#zapchain' },
|
||||||
@ -20,6 +21,10 @@ const data = [
|
|||||||
{ hashtag: '#hodl' },
|
{ hashtag: '#hodl' },
|
||||||
{ hashtag: '#stacksats' },
|
{ hashtag: '#stacksats' },
|
||||||
{ hashtag: '#nokyc' },
|
{ hashtag: '#nokyc' },
|
||||||
|
{ hashtag: '#meme' },
|
||||||
|
{ hashtag: '#memes' },
|
||||||
|
{ hashtag: '#memestr' },
|
||||||
|
{ hashtag: '#penisbutter' },
|
||||||
{ hashtag: '#anime' },
|
{ hashtag: '#anime' },
|
||||||
{ hashtag: '#waifu' },
|
{ hashtag: '#waifu' },
|
||||||
{ hashtag: '#manga' },
|
{ hashtag: '#manga' },
|
||||||
@ -58,7 +63,7 @@ export function OnboardStep2Screen() {
|
|||||||
|
|
||||||
navigate('/auth/onboarding/step-3', { replace: true });
|
navigate('/auth/onboarding/step-3', { replace: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await message(e, { title: 'Error', type: 'error' });
|
await message(e, { title: 'Lume', type: 'error' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,20 +74,23 @@ export function OnboardStep2Screen() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-md">
|
<div className="mx-auto w-full max-w-md">
|
||||||
<div className="mb-8 text-center">
|
<div className="mb-4 border-b border-white/10 pb-4">
|
||||||
<h1 className="text-xl font-semibold text-white">
|
<h1 className="mb-2 text-center text-2xl font-semibold text-white">
|
||||||
Choose {tags.size}/3 your favorite tags
|
Choose {tags.size}/3 your favorite hashtags
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-sm text-white/50">Customize your space which hashtag widget</p>
|
<p className="text-white/70">
|
||||||
|
Hashtags are an easy way to discover more content. By adding a hashtag, Lume
|
||||||
|
will show all related posts. You can always add more later.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<div className="scrollbar-hide flex h-[500px] w-full flex-col overflow-y-auto rounded-xl bg-white/10 backdrop-blur-xl">
|
<div className="scrollbar-hide flex h-[450px] w-full flex-col divide-y divide-white/5 overflow-y-auto rounded-xl bg-white/20 backdrop-blur-xl">
|
||||||
{data.map((item: { hashtag: string }) => (
|
{data.map((item: { hashtag: string }) => (
|
||||||
<button
|
<button
|
||||||
key={item.hashtag}
|
key={item.hashtag}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => toggleTag(item.hashtag)}
|
onClick={() => toggleTag(item.hashtag)}
|
||||||
className="inline-flex transform items-center justify-between bg-white/10 px-4 py-2 backdrop-blur-xl hover:bg-white/20"
|
className="inline-flex transform items-center justify-between px-4 py-2 hover:bg-white/10"
|
||||||
>
|
>
|
||||||
<p className="text-white">{item.hashtag}</p>
|
<p className="text-white">{item.hashtag}</p>
|
||||||
{tags.has(item.hashtag) && (
|
{tags.has(item.hashtag) && (
|
||||||
@ -98,7 +106,7 @@ export function OnboardStep2Screen() {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={submit}
|
onClick={submit}
|
||||||
disabled={loading || tags.size === 0 || tags.size > 3}
|
disabled={loading || tags.size === 0 || tags.size > 3}
|
||||||
className="inline-flex h-11 w-full items-center justify-between gap-2 rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none disabled:opacity-50"
|
className="inline-flex h-12 w-full items-center justify-between gap-2 rounded-lg border-t border-white/10 bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<>
|
<>
|
||||||
@ -114,12 +122,14 @@ export function OnboardStep2Screen() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
<Link
|
{!loading ? (
|
||||||
to="/auth/onboarding/step-3"
|
<Link
|
||||||
className="inline-flex h-11 w-full items-center justify-center rounded-lg px-6 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/10 focus:outline-none"
|
to="/auth/onboarding/step-3"
|
||||||
>
|
className="inline-flex h-12 w-full items-center justify-center rounded-lg border-t border-white/10 bg-white/20 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/30 focus:outline-none"
|
||||||
Skip, you can add later
|
>
|
||||||
</Link>
|
Skip, you can add later
|
||||||
|
</Link>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,10 +38,10 @@ export function WelcomeScreen() {
|
|||||||
Nostr
|
Nostr
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="inline-flex w-full flex-col items-center gap-2 px-4 pb-10">
|
<div className="inline-flex w-full flex-col items-center gap-3 px-4 pb-10">
|
||||||
<Link
|
<Link
|
||||||
to="/auth/import"
|
to="/auth/import"
|
||||||
className="inline-flex h-11 w-2/3 items-center justify-between gap-2 rounded-lg bg-fuchsia-500 px-6 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
className="inline-flex h-12 w-3/4 items-center justify-between gap-2 rounded-lg border-t border-white/10 bg-fuchsia-500 px-4 font-medium leading-none text-white hover:bg-fuchsia-600 focus:outline-none"
|
||||||
>
|
>
|
||||||
<span className="w-5" />
|
<span className="w-5" />
|
||||||
<span>Login with private key</span>
|
<span>Login with private key</span>
|
||||||
@ -49,14 +49,14 @@ export function WelcomeScreen() {
|
|||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
to="/auth/create"
|
to="/auth/create"
|
||||||
className="inline-flex h-11 w-2/3 items-center justify-center gap-2 rounded-lg bg-white/10 px-6 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/20 focus:outline-none"
|
className="inline-flex h-12 w-3/4 items-center justify-center gap-2 rounded-lg border-t border-white/10 bg-white/20 font-medium leading-none text-white backdrop-blur-xl hover:bg-white/30 focus:outline-none"
|
||||||
>
|
>
|
||||||
Create new key
|
Create new key
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-1 items-end justify-center pb-10">
|
<div className="flex flex-1 items-end justify-center pb-6">
|
||||||
<img src="/lume.png" alt="lume" className="h-auto w-1/3" />
|
<img src="/lume.png" alt="lume" className="h-auto w-1/4" />
|
||||||
</div>
|
</div>
|
||||||
</Frame>
|
</Frame>
|
||||||
);
|
);
|
||||||
|
@ -2,14 +2,14 @@ import { Dispatch, SetStateAction, useState } from 'react';
|
|||||||
|
|
||||||
import { LoaderIcon, PlusIcon } from '@shared/icons';
|
import { LoaderIcon, PlusIcon } from '@shared/icons';
|
||||||
|
|
||||||
import { useImageUploader } from '@utils/hooks/useUploader';
|
import { useNostr } from '@utils/hooks/useNostr';
|
||||||
|
|
||||||
export function AvatarUploader({
|
export function AvatarUploader({
|
||||||
setPicture,
|
setPicture,
|
||||||
}: {
|
}: {
|
||||||
setPicture: Dispatch<SetStateAction<string>>;
|
setPicture: Dispatch<SetStateAction<string>>;
|
||||||
}) {
|
}) {
|
||||||
const upload = useImageUploader();
|
const { upload } = useNostr();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const uploadAvatar = async () => {
|
const uploadAvatar = async () => {
|
||||||
|
@ -2,14 +2,14 @@ import { Dispatch, SetStateAction, useState } from 'react';
|
|||||||
|
|
||||||
import { LoaderIcon, PlusIcon } from '@shared/icons';
|
import { LoaderIcon, PlusIcon } from '@shared/icons';
|
||||||
|
|
||||||
import { useImageUploader } from '@utils/hooks/useUploader';
|
import { useNostr } from '@utils/hooks/useNostr';
|
||||||
|
|
||||||
export function BannerUploader({
|
export function BannerUploader({
|
||||||
setBanner,
|
setBanner,
|
||||||
}: {
|
}: {
|
||||||
setBanner: Dispatch<SetStateAction<string>>;
|
setBanner: Dispatch<SetStateAction<string>>;
|
||||||
}) {
|
}) {
|
||||||
const upload = useImageUploader();
|
const { upload } = useNostr();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const uploadBanner = async () => {
|
const uploadBanner = async () => {
|
||||||
@ -25,13 +25,14 @@ export function BannerUploader({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => uploadBanner()}
|
onClick={() => uploadBanner()}
|
||||||
className="inline-flex h-full w-full items-center justify-center bg-black/40 hover:bg-black/50"
|
className="inline-flex h-full w-full flex-col items-center justify-center gap-1 bg-black/40 hover:bg-black/50"
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<LoaderIcon className="h-8 w-8 animate-spin text-white" />
|
<LoaderIcon className="h-6 w-6 animate-spin text-white" />
|
||||||
) : (
|
) : (
|
||||||
<PlusIcon className="h-8 w-8 text-white" />
|
<PlusIcon className="h-6 w-6 text-white" />
|
||||||
)}
|
)}
|
||||||
|
<p className="text-sm font-medium text-white/70">Add a banner image</p>
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user