support nip94 and fix some bugs
This commit is contained in:
@@ -9,6 +9,7 @@ import { updateAccount } from '@libs/storage';
|
||||
import { ArrowRightCircleIcon, CheckCircleIcon, LoaderIcon } from '@shared/icons';
|
||||
|
||||
import { useAccount } from '@utils/hooks/useAccount';
|
||||
import { useNostr } from '@utils/hooks/useNostr';
|
||||
import { usePublish } from '@utils/hooks/usePublish';
|
||||
import { arrayToNIP02 } from '@utils/transform';
|
||||
|
||||
@@ -17,6 +18,7 @@ export function OnboardStep1Screen() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { publish } = usePublish();
|
||||
const { fetchNotes } = useNostr();
|
||||
const { account } = useAccount();
|
||||
const { status, data } = useQuery(['trending-profiles'], async () => {
|
||||
const res = await fetch('https://api.nostr.band/v0/trending/profiles');
|
||||
@@ -45,8 +47,10 @@ export function OnboardStep1Screen() {
|
||||
const event = await publish({ content: '', kind: 3, tags: tags });
|
||||
await updateAccount('follows', follows);
|
||||
|
||||
const notes = await fetchNotes();
|
||||
|
||||
// redirect to next step
|
||||
if (event) {
|
||||
if (event && notes) {
|
||||
setTimeout(() => {
|
||||
queryClient.invalidateQueries(['currentAccount']);
|
||||
navigate('/auth/onboarding/step-2', { replace: true });
|
||||
|
||||
@@ -109,6 +109,13 @@ export function OnboardStep3Screen() {
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<LoaderIcon className="h-4 w-4 animate-spin text-white" />
|
||||
</div>
|
||||
) : relaysAsArray.length === 0 ? (
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
<p className="text-center text-white/50">
|
||||
Can't found any relays, you can skip this step and use default relays
|
||||
instead
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
relaysAsArray.map((item, index) => (
|
||||
<button
|
||||
@@ -118,7 +125,7 @@ export function OnboardStep3Screen() {
|
||||
className="inline-flex transform items-start justify-between bg-white/10 px-4 py-2 hover:bg-white/20"
|
||||
>
|
||||
<div className="flex flex-col items-start gap-1">
|
||||
{item.replace(/\/+$/, '')}
|
||||
<p className="max-w-[15rem] truncate">{item.replace(/\/+$/, '')}</p>
|
||||
<UserRelay pubkey={data.get(item)} />
|
||||
</div>
|
||||
{relays.has(item) && (
|
||||
|
||||
Reference in New Issue
Block a user