This commit is contained in:
Ren Amamiya
2023-05-01 07:42:34 +07:00
parent 4be369b671
commit 2922b1c025
15 changed files with 100 additions and 44 deletions

View File

@@ -1,4 +1,5 @@
import { ArrowLeft, ArrowRight } from 'iconoir-react';
import ArrowLeftIcon from '@lume/shared/icons/arrowLeft';
import ArrowRightIcon from '@lume/shared/icons/arrowRight';
let platformName = 'darwin';
@@ -29,13 +30,13 @@ export function LayoutOnboarding({ children }: { children: React.ReactNode }) {
onClick={() => goBack()}
className="group inline-flex h-6 w-6 items-center justify-center rounded-md hover:bg-zinc-900"
>
<ArrowLeft width={16} height={16} className="text-zinc-500 group-hover:text-zinc-300" />
<ArrowLeftIcon width={16} height={16} className="text-zinc-500 group-hover:text-zinc-300" />
</button>
<button
onClick={() => goForward()}
className="group inline-flex h-6 w-6 items-center justify-center rounded-md hover:bg-zinc-900"
>
<ArrowRight width={16} height={16} className="text-zinc-500 group-hover:text-zinc-300" />
<ArrowRightIcon width={16} height={16} className="text-zinc-500 group-hover:text-zinc-300" />
</button>
</div>
</div>

View File

@@ -1,6 +1,7 @@
import EyeOffIcon from '@lume/shared/icons/eyeOff';
import EyeOnIcon from '@lume/shared/icons/eyeOn';
import { onboardingAtom } from '@lume/stores/onboarding';
import { EyeClose, EyeEmpty } from 'iconoir-react';
import { useSetAtom } from 'jotai';
import { generatePrivateKey, getPublicKey, nip19 } from 'nostr-tools';
import { useMemo, useState } from 'react';
@@ -60,9 +61,9 @@ export function Page() {
className="group absolute right-2 top-1/2 -translate-y-1/2 transform rounded p-1 hover:bg-zinc-700"
>
{type === 'password' ? (
<EyeClose width={20} height={20} className="text-zinc-500 group-hover:text-zinc-200" />
<EyeOffIcon width={20} height={20} className="text-zinc-500 group-hover:text-zinc-200" />
) : (
<EyeEmpty width={20} height={20} className="text-zinc-500 group-hover:text-zinc-200" />
<EyeOnIcon width={20} height={20} className="text-zinc-500 group-hover:text-zinc-200" />
)}
</button>
</div>

View File

@@ -1,11 +1,11 @@
import User from '@lume/auth/components/user';
import CheckCircleIcon from '@lume/shared/icons/checkCircle';
import { RelayContext } from '@lume/shared/relayProvider';
import { WRITEONLY_RELAYS } from '@lume/stores/constants';
import { onboardingAtom } from '@lume/stores/onboarding';
import { createAccount, createPleb } from '@lume/utils/storage';
import { arrayToNIP02 } from '@lume/utils/transform';
import { CheckCircle } from 'iconoir-react';
import { useAtom } from 'jotai';
import { getEventHash, signEvent } from 'nostr-tools';
import { useContext, useState } from 'react';
@@ -100,7 +100,7 @@ export function Page() {
.then((res) => {
if (res) {
for (const tag of follows) {
fetch(`https://rbr.bio/${tag}/metadata.json`)
fetch(`https://us.rbr.bio/${tag}/metadata.json`)
.then((data) => data.json())
.then((data) => createPleb(tag, data ?? ''));
}
@@ -140,7 +140,7 @@ export function Page() {
<User pubkey={item.pubkey} />
{follows.includes(item.pubkey) && (
<div>
<CheckCircle width={16} height={16} className="text-green-400" />
<CheckCircleIcon width={16} height={16} className="text-green-400" />
</div>
)}
</button>

View File

@@ -1,5 +1,5 @@
import { RelayContext } from '@lume/shared/relayProvider';
import { DEFAULT_AVATAR } from '@lume/stores/constants';
import { DEFAULT_AVATAR, READONLY_RELAYS } from '@lume/stores/constants';
import { onboardingAtom } from '@lume/stores/onboarding';
import { shortenKey } from '@lume/utils/shortenKey';
import { createAccount, createPleb } from '@lume/utils/storage';
@@ -17,7 +17,7 @@ export function Page() {
const [onboarding, setOnboarding] = useAtom(onboardingAtom);
const pubkey = useMemo(() => (onboarding.privkey ? getPublicKey(onboarding.privkey) : ''), [onboarding.privkey]);
const { data: user, error } = useSWRSubscription(pubkey && !loading ? pubkey : null, (key, { next }) => {
const { data, error } = useSWRSubscription(pubkey ? pubkey : null, (key, { next }) => {
const unsubscribe = pool.subscribe(
[
{
@@ -25,7 +25,7 @@ export function Page() {
authors: [key],
},
],
null,
READONLY_RELAYS,
(event: any) => {
switch (event.kind) {
case 0:
@@ -58,7 +58,7 @@ export function Page() {
.then((res) => {
if (res) {
for (const tag of onboarding.follows) {
fetch(`https://rbr.bio/${tag[1]}/metadata.json`)
fetch(`https://us.rbr.bio/${tag[1]}/metadata.json`)
.then((data) => data.json())
.then((data) => createPleb(tag[1], data ?? ''));
}
@@ -78,7 +78,7 @@ export function Page() {
</div>
<div className="w-full rounded-lg border border-zinc-800 bg-zinc-900 p-4">
{error && <div>Failed to load profile</div>}
{!user ? (
{!data ? (
<div className="w-full">
<div className="flex items-center gap-2">
<div className="h-11 w-11 animate-pulse rounded-lg bg-zinc-800"></div>
@@ -93,12 +93,12 @@ export function Page() {
<div className="flex items-center gap-2">
<img
className="relative inline-flex h-11 w-11 rounded-lg ring-2 ring-zinc-900"
src={user.picture || DEFAULT_AVATAR}
src={data.picture || DEFAULT_AVATAR}
alt={pubkey}
/>
<div>
<h3 className="font-medium leading-none text-zinc-200">{user.display_name || user.name}</h3>
<p className="text-sm text-zinc-400">{user.nip05 || shortenKey(pubkey)}</p>
<h3 className="font-medium leading-none text-zinc-200">{data.display_name || data.name}</h3>
<p className="text-sm text-zinc-400">{data.nip05 || shortenKey(pubkey)}</p>
</div>
</div>
<button

View File

@@ -1,4 +1,4 @@
import { ArrowRight } from 'iconoir-react';
import ArrowRightIcon from '@lume/shared/icons/arrowRight';
const PLEBS = [
'https://133332.xyz/p.jpg',
@@ -99,7 +99,7 @@ export function Page() {
className="relative inline-flex h-14 w-64 items-center justify-center gap-2 rounded-full bg-zinc-900 px-6 text-lg font-medium ring-1 ring-zinc-800 hover:bg-zinc-800"
>
Create new key
<ArrowRight width={20} height={20} />
<ArrowRightIcon width={20} height={20} />
</a>
<a
href="/auth/import"