@@ -59,15 +59,14 @@ export default function FollowingListPage({ id }: { id?: string }) {
}
function FollowingItem({ pubkey }: { pubkey: string }) {
- const {
- profile: { about, nip05 }
- } = useFetchProfile(pubkey)
+ const { profile } = useFetchProfile(pubkey)
+ const { nip05, about } = profile || {}
return (
-
+
diff --git a/src/renderer/src/pages/secondary/NotePage/index.tsx b/src/renderer/src/pages/secondary/NotePage/index.tsx
index af95f10..81c7d70 100644
--- a/src/renderer/src/pages/secondary/NotePage/index.tsx
+++ b/src/renderer/src/pages/secondary/NotePage/index.tsx
@@ -5,12 +5,12 @@ import UserAvatar from '@renderer/components/UserAvatar'
import Username from '@renderer/components/Username'
import { Card } from '@renderer/components/ui/card'
import { Separator } from '@renderer/components/ui/separator'
+import { Skeleton } from '@renderer/components/ui/skeleton'
import { useFetchEventById } from '@renderer/hooks'
import SecondaryPageLayout from '@renderer/layouts/SecondaryPageLayout'
import { getParentEventId, getRootEventId } from '@renderer/lib/event'
import { toNote } from '@renderer/lib/link'
import { useMemo } from 'react'
-import LoadingPage from '../LoadingPage'
import NotFoundPage from '../NotFoundPage'
export default function NotePage({ id }: { id?: string }) {
@@ -18,7 +18,13 @@ export default function NotePage({ id }: { id?: string }) {
const parentEventId = useMemo(() => getParentEventId(event), [event])
const rootEventId = useMemo(() => getRootEventId(event), [event])
- if (!event && isFetching) return
+ if (!event && isFetching) {
+ return (
+
+
+
+ )
+ }
if (!event) return
return (
@@ -44,7 +50,7 @@ function ParentNote({ eventId }: { eventId?: string }) {
onClick={() => push(toNote(event.id))}
>
-
+
{event.content}
diff --git a/src/renderer/src/pages/secondary/ProfilePage/index.tsx b/src/renderer/src/pages/secondary/ProfilePage/index.tsx
index 1756570..bc22915 100644
--- a/src/renderer/src/pages/secondary/ProfilePage/index.tsx
+++ b/src/renderer/src/pages/secondary/ProfilePage/index.tsx
@@ -18,26 +18,40 @@ import PubkeyCopy from './PubkeyCopy'
import QrCodePopover from './QrCodePopover'
import LoadingPage from '../LoadingPage'
import NotFoundPage from '../NotFoundPage'
+import { Skeleton } from '@renderer/components/ui/skeleton'
export default function ProfilePage({ id }: { id?: string }) {
- const {
- profile: { banner, username, nip05, about, avatar, pubkey },
- isFetching
- } = useFetchProfile(id)
- const relayList = useFetchRelayList(pubkey)
+ const { profile, isFetching } = useFetchProfile(id)
+ const relayList = useFetchRelayList(profile?.pubkey)
const { pubkey: accountPubkey } = useNostr()
const { followings: selfFollowings } = useFollowList()
- const { followings } = useFetchFollowings(pubkey)
+ const { followings } = useFetchFollowings(profile?.pubkey)
const isFollowingYou = useMemo(
- () => !!accountPubkey && accountPubkey !== pubkey && followings.includes(accountPubkey),
- [followings, pubkey]
+ () =>
+ !!accountPubkey && accountPubkey !== profile?.pubkey && followings.includes(accountPubkey),
+ [followings, profile]
)
- const defaultImage = useMemo(() => (pubkey ? generateImageByPubkey(pubkey) : ''), [pubkey])
- const isSelf = accountPubkey === pubkey
+ const defaultImage = useMemo(
+ () => (profile?.pubkey ? generateImageByPubkey(profile?.pubkey) : ''),
+ [profile]
+ )
+ const isSelf = accountPubkey === profile?.pubkey
- if (!pubkey && isFetching) return
- if (!pubkey) return
+ if (!profile && isFetching) {
+ return (
+
+
+
+
+
+
+
+
+ )
+ }
+ if (!profile) return
+ const { banner, username, nip05, about, avatar, pubkey } = profile
return (
diff --git a/src/renderer/src/types.ts b/src/renderer/src/types.ts
index 330abe7..22c0967 100644
--- a/src/renderer/src/types.ts
+++ b/src/renderer/src/types.ts
@@ -1,6 +1,6 @@
export type TProfile = {
username: string
- pubkey?: string
+ pubkey: string
banner?: string
avatar?: string
nip05?: string