|
|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
|
|
import Collapsible from '@/components/Collapsible' |
|
|
|
import FollowButton from '@/components/FollowButton' |
|
|
|
import FollowButton from '@/components/FollowButton' |
|
|
|
import Nip05 from '@/components/Nip05' |
|
|
|
import Nip05 from '@/components/Nip05' |
|
|
|
import NoteList from '@/components/NoteList' |
|
|
|
import NoteList from '@/components/NoteList' |
|
|
|
@ -18,12 +19,11 @@ import { SecondaryPageLink, useSecondaryPage } from '@/PageManager' |
|
|
|
import { useMuteList } from '@/providers/MuteListProvider' |
|
|
|
import { useMuteList } from '@/providers/MuteListProvider' |
|
|
|
import { useNostr } from '@/providers/NostrProvider' |
|
|
|
import { useNostr } from '@/providers/NostrProvider' |
|
|
|
import { Link, Zap } from 'lucide-react' |
|
|
|
import { Link, Zap } from 'lucide-react' |
|
|
|
import { forwardRef, useMemo } from 'react' |
|
|
|
import { forwardRef, useCallback, useEffect, useMemo, useState } from 'react' |
|
|
|
import { useTranslation } from 'react-i18next' |
|
|
|
import { useTranslation } from 'react-i18next' |
|
|
|
import NotFoundPage from '../NotFoundPage' |
|
|
|
import NotFoundPage from '../NotFoundPage' |
|
|
|
import Followings from './Followings' |
|
|
|
import Followings from './Followings' |
|
|
|
import Relays from './Relays' |
|
|
|
import Relays from './Relays' |
|
|
|
import Collapsible from '@/components/Collapsible' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { |
|
|
|
const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => { |
|
|
|
const { t } = useTranslation() |
|
|
|
const { t } = useTranslation() |
|
|
|
@ -41,7 +41,35 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, |
|
|
|
() => (profile?.pubkey ? generateImageByPubkey(profile?.pubkey) : ''), |
|
|
|
() => (profile?.pubkey ? generateImageByPubkey(profile?.pubkey) : ''), |
|
|
|
[profile] |
|
|
|
[profile] |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
const [topContainerHeight, setTopContainerHeight] = useState(0) |
|
|
|
const isSelf = accountPubkey === profile?.pubkey |
|
|
|
const isSelf = accountPubkey === profile?.pubkey |
|
|
|
|
|
|
|
const [topContainer, setTopContainer] = useState<HTMLDivElement | null>(null) |
|
|
|
|
|
|
|
const topContainerRef = useCallback((node: HTMLDivElement | null) => { |
|
|
|
|
|
|
|
if (node) { |
|
|
|
|
|
|
|
setTopContainer(node) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
if (!topContainer) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const checkHeight = () => { |
|
|
|
|
|
|
|
console.log('checkHeight', topContainer.scrollHeight) |
|
|
|
|
|
|
|
setTopContainerHeight(topContainer.scrollHeight) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checkHeight() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const observer = new ResizeObserver(() => { |
|
|
|
|
|
|
|
checkHeight() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
observer.observe(topContainer) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return () => { |
|
|
|
|
|
|
|
observer.disconnect() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, [topContainer]) |
|
|
|
|
|
|
|
|
|
|
|
if (!profile && isFetching) { |
|
|
|
if (!profile && isFetching) { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
@ -64,6 +92,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, |
|
|
|
const { banner, username, about, avatar, pubkey, website, lightningAddress } = profile |
|
|
|
const { banner, username, about, avatar, pubkey, website, lightningAddress } = profile |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<SecondaryPageLayout index={index} title={username} displayScrollToTopButton ref={ref}> |
|
|
|
<SecondaryPageLayout index={index} title={username} displayScrollToTopButton ref={ref}> |
|
|
|
|
|
|
|
<div ref={topContainerRef}> |
|
|
|
<div className="sm:px-4"> |
|
|
|
<div className="sm:px-4"> |
|
|
|
<div className="relative bg-cover bg-center mb-2"> |
|
|
|
<div className="relative bg-cover bg-center mb-2"> |
|
|
|
<ProfileBanner |
|
|
|
<ProfileBanner |
|
|
|
@ -147,7 +176,13 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<NoteList author={pubkey} className="mt-2" filterMutedNotes={false} /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<NoteList |
|
|
|
|
|
|
|
author={pubkey} |
|
|
|
|
|
|
|
className="mt-2" |
|
|
|
|
|
|
|
filterMutedNotes={false} |
|
|
|
|
|
|
|
topSpace={topContainerHeight + 100} |
|
|
|
|
|
|
|
/> |
|
|
|
</SecondaryPageLayout> |
|
|
|
</SecondaryPageLayout> |
|
|
|
) |
|
|
|
) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|