feat: display website link in profile

This commit is contained in:
codytseng
2025-02-01 14:23:36 +08:00
parent 7c34042da3
commit 6c049001f6
3 changed files with 12 additions and 1 deletions

View File

@@ -119,6 +119,7 @@ export function getProfileFromProfileEvent(event: Event) {
original_username: username, original_username: username,
nip05: profileObj.nip05, nip05: profileObj.nip05,
about: profileObj.about, about: profileObj.about,
website: profileObj.website,
created_at: event.created_at created_at: event.created_at
} }
} catch (err) { } catch (err) {

View File

@@ -28,6 +28,7 @@ import { useNostr } from '@/providers/NostrProvider'
import { forwardRef, useMemo } from 'react' import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import NotFoundPage from '../NotFoundPage' import NotFoundPage from '../NotFoundPage'
import { Globe, Link } from 'lucide-react'
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()
@@ -73,7 +74,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
} }
if (!profile) return <NotFoundPage /> if (!profile) return <NotFoundPage />
const { banner, username, about, avatar, pubkey } = profile const { banner, username, about, avatar, pubkey, website } = profile
return ( return (
<SecondaryPageLayout index={index} title={username} displayScrollToTopButton ref={ref}> <SecondaryPageLayout index={index} title={username} displayScrollToTopButton ref={ref}>
<div className="px-4"> <div className="px-4">
@@ -117,6 +118,14 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
<QrCodePopover pubkey={pubkey} /> <QrCodePopover pubkey={pubkey} />
</div> </div>
<ProfileAbout about={about} className="text-wrap break-words whitespace-pre-wrap mt-2" /> <ProfileAbout about={about} className="text-wrap break-words whitespace-pre-wrap mt-2" />
{website && (
<div className="flex gap-1 items-center text-primary mt-2">
<Link size={14} />
<a href={website} target="_blank" className="hover:underline">
{website}
</a>
</div>
)}
<div className="flex gap-4 items-center mt-2 text-sm"> <div className="flex gap-4 items-center mt-2 text-sm">
<SecondaryPageLink <SecondaryPageLink
to={toFollowingList(pubkey)} to={toFollowingList(pubkey)}

View File

@@ -8,6 +8,7 @@ export type TProfile = {
avatar?: string avatar?: string
nip05?: string nip05?: string
about?: string about?: string
website?: string
created_at?: number created_at?: number
} }
export type TMailboxRelayScope = 'read' | 'write' | 'both' export type TMailboxRelayScope = 'read' | 'write' | 'both'