From 2922b1c02559cd6d88753688fcc49b3fced802bf Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Mon, 1 May 2023 07:42:34 +0700 Subject: [PATCH] clean up --- package.json | 3 +-- pnpm-lock.yaml | 20 ++++--------------- src/app/channel/components/metadata.tsx | 4 ++-- src/app/channel/components/updateModal.tsx | 7 ++++--- .../newsfeed/pages/following/index.page.tsx | 2 -- src/auth/layout.tsx | 7 ++++--- src/auth/pages/create/index.page.tsx | 7 ++++--- src/auth/pages/create/step-3/index.page.tsx | 6 +++--- src/auth/pages/import/step-2/index.page.tsx | 16 +++++++-------- src/auth/pages/index/index.page.tsx | 4 ++-- src/shared/icons/checkCircle.tsx | 14 +++++++++++++ src/shared/icons/copy.tsx | 15 ++++++++++++++ src/shared/icons/edit.tsx | 15 ++++++++++++++ src/shared/icons/eyeOff.tsx | 12 +++++++++++ src/shared/icons/eyeOn.tsx | 12 +++++++++++ 15 files changed, 100 insertions(+), 44 deletions(-) create mode 100644 src/shared/icons/checkCircle.tsx create mode 100644 src/shared/icons/copy.tsx create mode 100644 src/shared/icons/edit.tsx create mode 100644 src/shared/icons/eyeOff.tsx create mode 100644 src/shared/icons/eyeOn.tsx diff --git a/package.json b/package.json index 93c2c9df..618cd5d8 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "@vidstack/react": "^0.4.5", "dayjs": "^1.11.7", "destr": "^1.2.2", - "iconoir-react": "^6.6.0", "jotai": "^2.0.4", "nostr-relaypool": "^0.6.27", "nostr-tools": "^1.10.1", @@ -68,7 +67,7 @@ "tailwindcss": "^3.3.2", "typescript": "^4.9.5", "vite": "^4.3.3", - "vite-plugin-ssr": "^0.4.119", + "vite-plugin-ssr": "^0.4.120", "vite-plugin-top-level-await": "^1.3.0", "vite-tsconfig-paths": "^4.2.0", "ws": "^8.13.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9912ce22..5ab6b606 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,9 +31,6 @@ dependencies: destr: specifier: ^1.2.2 version: 1.2.2 - iconoir-react: - specifier: ^6.6.0 - version: 6.6.0(react@18.2.0) jotai: specifier: ^2.0.4 version: 2.0.4(react@18.2.0) @@ -160,8 +157,8 @@ devDependencies: specifier: ^4.3.3 version: 4.3.3(@types/node@18.16.3) vite-plugin-ssr: - specifier: ^0.4.119 - version: 0.4.119(vite@4.3.3) + specifier: ^0.4.120 + version: 0.4.120(vite@4.3.3) vite-plugin-top-level-await: specifier: ^1.3.0 version: 1.3.0(vite@4.3.3) @@ -2592,15 +2589,6 @@ packages: hasBin: true dev: true - /iconoir-react@6.6.0(react@18.2.0): - resolution: - { integrity: sha512-7ueB0jQlSZFjEa4qUCaGbfWLRjGBtOc0E+RYHEb3Ek3zDwQuNh4VLtV9kwGoiATRfBYVv8bgCmXI0nr52TRXsw== } - peerDependencies: - react: ^16.8.6 || ^17 || ^18 - dependencies: - react: 18.2.0 - dev: false - /iconv-lite@0.6.3: resolution: { integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== } @@ -4283,9 +4271,9 @@ packages: type-fest: 3.9.0 dev: false - /vite-plugin-ssr@0.4.119(vite@4.3.3): + /vite-plugin-ssr@0.4.120(vite@4.3.3): resolution: - { integrity: sha512-YAStY1PEdF+tw1h5qYjvngJaHkNy+vLT89po9wEHuBbJGgd7WieDZdZJIb3TbVPiyAyxB+3z2nkpVKPDPUCZtg== } + { integrity: sha512-crttExXYt98bEVeLJgqlJ6peaMgzN7YrL0TNIAWEjabWHaXgpQUO+pRXOf0MIyI/xcNh13e6kvalSPo9UEpPxQ== } engines: { node: '>=12.19.0' } hasBin: true peerDependencies: diff --git a/src/app/channel/components/metadata.tsx b/src/app/channel/components/metadata.tsx index 13721fa3..1dcb1542 100644 --- a/src/app/channel/components/metadata.tsx +++ b/src/app/channel/components/metadata.tsx @@ -1,7 +1,7 @@ +import CopyIcon from '@lume/shared/icons/copy'; import { DEFAULT_AVATAR } from '@lume/stores/constants'; import { useChannelProfile } from '@lume/utils/hooks/useChannelProfile'; -import { Copy } from 'iconoir-react'; import { nip19 } from 'nostr-tools'; export default function ChannelMetadata({ id, pubkey }: { id: string; pubkey: string }) { @@ -28,7 +28,7 @@ export default function ChannelMetadata({ id, pubkey }: { id: string; pubkey: st
{metadata?.name}

diff --git a/src/app/channel/components/updateModal.tsx b/src/app/channel/components/updateModal.tsx index 4a89c5b5..303c70f1 100644 --- a/src/app/channel/components/updateModal.tsx +++ b/src/app/channel/components/updateModal.tsx @@ -1,4 +1,6 @@ import { AvatarUploader } from '@lume/shared/avatarUploader'; +import CancelIcon from '@lume/shared/icons/cancel'; +import EditIcon from '@lume/shared/icons/edit'; import { RelayContext } from '@lume/shared/relayProvider'; import { DEFAULT_AVATAR, WRITEONLY_RELAYS } from '@lume/stores/constants'; import { dateToUnix } from '@lume/utils/getDate'; @@ -6,7 +8,6 @@ import { useActiveAccount } from '@lume/utils/hooks/useActiveAccount'; import { getChannel, updateChannelMetadata } from '@lume/utils/storage'; import { Dialog, Transition } from '@headlessui/react'; -import { Cancel, EditPencil } from 'iconoir-react'; import { getEventHash, signEvent } from 'nostr-tools'; import { Fragment, useContext, useEffect, useState } from 'react'; import { useForm } from 'react-hook-form'; @@ -83,7 +84,7 @@ export default function ChannelUpdateModal({ id }: { id: string }) { onClick={() => openModal()} className="group inline-flex h-8 w-8 items-center justify-center rounded-md bg-zinc-900 hover:bg-zinc-800 focus:outline-none" > - +

@@ -124,7 +125,7 @@ export default function ChannelUpdateModal({ id }: { id: string }) { autoFocus={false} className="inline-flex h-5 w-5 items-center justify-center rounded hover:bg-zinc-900" > - + diff --git a/src/app/newsfeed/pages/following/index.page.tsx b/src/app/newsfeed/pages/following/index.page.tsx index 3bcc705b..32642006 100644 --- a/src/app/newsfeed/pages/following/index.page.tsx +++ b/src/app/newsfeed/pages/following/index.page.tsx @@ -7,7 +7,6 @@ import { getNotes } from '@lume/utils/storage'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useVirtualizer } from '@tanstack/react-virtual'; -import { ArrowUp } from 'iconoir-react'; import { useAtom } from 'jotai'; import { useEffect, useRef } from 'react'; @@ -55,7 +54,6 @@ export function Page() { {hasNewerNote && (
diff --git a/src/auth/layout.tsx b/src/auth/layout.tsx index ccab797c..20e0d93c 100644 --- a/src/auth/layout.tsx +++ b/src/auth/layout.tsx @@ -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" > - + diff --git a/src/auth/pages/create/index.page.tsx b/src/auth/pages/create/index.page.tsx index ebf97f16..9c512ba0 100644 --- a/src/auth/pages/create/index.page.tsx +++ b/src/auth/pages/create/index.page.tsx @@ -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' ? ( - + ) : ( - + )} diff --git a/src/auth/pages/create/step-3/index.page.tsx b/src/auth/pages/create/step-3/index.page.tsx index 46c26bd7..17d15b91 100644 --- a/src/auth/pages/create/step-3/index.page.tsx +++ b/src/auth/pages/create/step-3/index.page.tsx @@ -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() { {follows.includes(item.pubkey) && (
- +
)} diff --git a/src/auth/pages/import/step-2/index.page.tsx b/src/auth/pages/import/step-2/index.page.tsx index ca572cec..c3a1bb63 100644 --- a/src/auth/pages/import/step-2/index.page.tsx +++ b/src/auth/pages/import/step-2/index.page.tsx @@ -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() {
{error &&
Failed to load profile
} - {!user ? ( + {!data ? (
@@ -93,12 +93,12 @@ export function Page() {
{pubkey}
-

{user.display_name || user.name}

-

{user.nip05 || shortenKey(pubkey)}

+

{data.display_name || data.name}

+

{data.nip05 || shortenKey(pubkey)}