From ab27bd5f441af14a9a24b670ee9ef2a63bb3eec7 Mon Sep 17 00:00:00 2001 From: reya Date: Sat, 13 Jan 2024 20:24:52 +0700 Subject: [PATCH] feat: polish --- .../src/routes/activty/components/list.tsx | 37 ++++++++++++++---- apps/desktop/src/routes/activty/index.tsx | 2 +- packages/ark/src/ark.ts | 2 + .../src/components/note/primitives/thread.tsx | 7 ++-- packages/ark/src/components/user/avatar.tsx | 3 +- packages/ark/src/components/user/nip05.tsx | 18 +++++---- packages/icons/src/verified.tsx | 38 +++++++++---------- packages/ui/src/layouts/app.tsx | 2 +- packages/ui/src/layouts/auth.tsx | 2 +- packages/ui/src/navigation.tsx | 18 --------- src-tauri/tauri.linux.conf.json | 5 +-- 11 files changed, 70 insertions(+), 64 deletions(-) diff --git a/apps/desktop/src/routes/activty/components/list.tsx b/apps/desktop/src/routes/activty/components/list.tsx index 8640264d..e7accdd5 100644 --- a/apps/desktop/src/routes/activty/components/list.tsx +++ b/apps/desktop/src/routes/activty/components/list.tsx @@ -1,5 +1,5 @@ import { useArk } from "@lume/ark"; -import { LoaderIcon } from "@lume/icons"; +import { ArrowRightCircleIcon, LoaderIcon } from "@lume/icons"; import { FETCH_LIMIT } from "@lume/utils"; import { NDKEvent, NDKKind } from "@nostr-dev-kit/ndk"; import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query"; @@ -25,13 +25,10 @@ export function ActivityList() { }) => { const events = await ark.getInfiniteEvents({ filter: { - kinds: [NDKKind.Zap], - "#p": [ - "126103bfddc8df256b6e0abfd7f3797c80dcc4ea88f7c2f87dd4104220b4d65f", - ark.account.pubkey, - ], + kinds: [NDKKind.Text, NDKKind.Repost, NDKKind.Zap], + "#p": [ark.account.pubkey], }, - limit: 200, + limit: FETCH_LIMIT, pageParam, signal, }); @@ -84,12 +81,36 @@ export function ActivityList() { return (
{isLoading ? ( -
+
+ ) : !allEvents.length ? ( +
+

๐ŸŽ‰

+

Yo! Nothing new yet.

+
) : ( allEvents.map((event) => renderEvenKind(event)) )} +
+ {hasNextPage ? ( + + ) : null} +
); } diff --git a/apps/desktop/src/routes/activty/index.tsx b/apps/desktop/src/routes/activty/index.tsx index a204cd13..84945ffc 100644 --- a/apps/desktop/src/routes/activty/index.tsx +++ b/apps/desktop/src/routes/activty/index.tsx @@ -3,7 +3,7 @@ import { ActivityList } from "./components/list"; export function ActivityScreen() { return ( -
+
Activity diff --git a/packages/ark/src/ark.ts b/packages/ark/src/ark.ts index d0086416..119f085b 100644 --- a/packages/ark/src/ark.ts +++ b/packages/ark/src/ark.ts @@ -552,9 +552,11 @@ export class Ark { if (!res.ok) throw new Error(`Failed to fetch NIP-05 service: ${nip05}`); const data: NIP05 = await res.json(); + if (!data.names) return false; if (data.names[localPath.toLowerCase()] === pubkey) return true; if (data.names[localPath] === pubkey) return true; + return false; } diff --git a/packages/ark/src/components/note/primitives/thread.tsx b/packages/ark/src/components/note/primitives/thread.tsx index 7d33b2b2..4e58bff7 100644 --- a/packages/ark/src/components/note/primitives/thread.tsx +++ b/packages/ark/src/components/note/primitives/thread.tsx @@ -12,17 +12,16 @@ export function ThreadNote({ eventId }: { eventId: string }) { return ( -
- +
- +
ยท - +
diff --git a/packages/ark/src/components/user/avatar.tsx b/packages/ark/src/components/user/avatar.tsx index 0840edab..2c601c40 100644 --- a/packages/ark/src/components/user/avatar.tsx +++ b/packages/ark/src/components/user/avatar.tsx @@ -1,6 +1,7 @@ import { cn } from "@lume/utils"; import * as Avatar from "@radix-ui/react-avatar"; import { minidenticon } from "minidenticons"; +import { nanoid } from "nanoid"; import { useMemo } from "react"; import { useUserContext } from "./provider"; @@ -9,7 +10,7 @@ export function UserAvatar({ className }: { className?: string }) { const fallbackAvatar = useMemo( () => `data:image/svg+xml;utf8,${encodeURIComponent( - minidenticon(user?.pubkey, 90, 50), + minidenticon(user?.pubkey || nanoid(), 90, 50), )}`, [user], ); diff --git a/packages/ark/src/components/user/nip05.tsx b/packages/ark/src/components/user/nip05.tsx index 2fd0ce9f..5b0a1db3 100644 --- a/packages/ark/src/components/user/nip05.tsx +++ b/packages/ark/src/components/user/nip05.tsx @@ -4,19 +4,25 @@ import { useQuery } from "@tanstack/react-query"; import { useArk } from "../../hooks/useArk"; import { useUserContext } from "./provider"; -export function UserNip05({ className }: { className?: string }) { +export function UserNip05({ + pubkey, + className, +}: { pubkey: string; className?: string }) { const ark = useArk(); const user = useUserContext(); const { isLoading, data: verified } = useQuery({ queryKey: ["nip05", user?.nip05], queryFn: async ({ signal }: { signal: AbortSignal }) => { + if (!user) return false; + if (!user.nip05) return false; return ark.validateNIP05({ - pubkey: user?.pubkey, - nip05: user?.nip05, + pubkey, + nip05: user.nip05, signal, }); }, + enabled: !!user, }); if (!user) { @@ -38,10 +44,8 @@ export function UserNip05({ className }: { className?: string }) { : user.nip05}

{!isLoading && verified ? ( - - ) : ( - - )} + + ) : null}
); } diff --git a/packages/icons/src/verified.tsx b/packages/icons/src/verified.tsx index 6e33fd9c..905c550c 100644 --- a/packages/icons/src/verified.tsx +++ b/packages/icons/src/verified.tsx @@ -1,21 +1,21 @@ -import { SVGProps } from 'react'; +import { SVGProps } from "react"; -export function VerifiedIcon(props: JSX.IntrinsicAttributes & SVGProps) { - return ( - - - - ); +export function VerifiedIcon( + props: JSX.IntrinsicAttributes & SVGProps, +) { + return ( + + + + ); } diff --git a/packages/ui/src/layouts/app.tsx b/packages/ui/src/layouts/app.tsx index 584101d1..edb4bc2b 100644 --- a/packages/ui/src/layouts/app.tsx +++ b/packages/ui/src/layouts/app.tsx @@ -13,7 +13,7 @@ export function AppLayout({ platform }: { platform: Platform }) { platform !== "macos" ? "bg-blue-50 dark:bg-blue-950" : "", )} > - {platform !== "macos" ? ( + {platform === "windows" ? ( ) : (
diff --git a/packages/ui/src/layouts/auth.tsx b/packages/ui/src/layouts/auth.tsx index 21785707..18df30ab 100644 --- a/packages/ui/src/layouts/auth.tsx +++ b/packages/ui/src/layouts/auth.tsx @@ -11,7 +11,7 @@ export function AuthLayout({ platform }: { platform: Platform }) { return (
- {platform !== "macos" ? ( + {platform === "windows" ? ( ) : (
diff --git a/packages/ui/src/navigation.tsx b/packages/ui/src/navigation.tsx index 28c146ad..048e6386 100644 --- a/packages/ui/src/navigation.tsx +++ b/packages/ui/src/navigation.tsx @@ -82,24 +82,6 @@ export function Navigation() {
)} - - {({ isActive }) => ( -
- -
- )} -
diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 9e47392d..a60ac0e1 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -11,10 +11,7 @@ "title": "Lume", "center": true, "fullscreen": false, - "hiddenTitle": true, - "fileDropEnabled": true, - "decorations": false, - "transparent": false + "fileDropEnabled": true } ] }