Browse Source

feat: display website link in profile

imwald
codytseng 1 year ago
parent
commit
6c049001f6
  1. 1
      src/lib/event.ts
  2. 11
      src/pages/secondary/ProfilePage/index.tsx
  3. 1
      src/types.ts

1
src/lib/event.ts

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

11
src/pages/secondary/ProfilePage/index.tsx

@ -28,6 +28,7 @@ import { useNostr } from '@/providers/NostrProvider' @@ -28,6 +28,7 @@ import { useNostr } from '@/providers/NostrProvider'
import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import NotFoundPage from '../NotFoundPage'
import { Globe, Link } from 'lucide-react'
const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, ref) => {
const { t } = useTranslation()
@ -73,7 +74,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, @@ -73,7 +74,7 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
}
if (!profile) return <NotFoundPage />
const { banner, username, about, avatar, pubkey } = profile
const { banner, username, about, avatar, pubkey, website } = profile
return (
<SecondaryPageLayout index={index} title={username} displayScrollToTopButton ref={ref}>
<div className="px-4">
@ -117,6 +118,14 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number }, @@ -117,6 +118,14 @@ const ProfilePage = forwardRef(({ id, index }: { id?: string; index?: number },
<QrCodePopover pubkey={pubkey} />
</div>
<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">
<SecondaryPageLink
to={toFollowingList(pubkey)}

1
src/types.ts

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

Loading…
Cancel
Save