diff --git a/src/components/GameCard.tsx b/src/components/GameCard.tsx
index 1b34432..0d76af9 100644
--- a/src/components/GameCard.tsx
+++ b/src/components/GameCard.tsx
@@ -1,7 +1,7 @@
-import { useNavigate } from 'react-router-dom'
+import { Link } from 'react-router-dom'
+import { getGamePageRoute } from 'routes'
import '../styles/cardGames.css'
import { handleGameImageError } from '../utils'
-import { getGamePageRoute } from 'routes'
type GameCardProps = {
title: string
@@ -9,13 +9,10 @@ type GameCardProps = {
}
export const GameCard = ({ title, imageUrl }: GameCardProps) => {
- const navigate = useNavigate()
+ const route = getGamePageRoute(title)
return (
-
navigate(getGamePageRoute(title))}
- >
+
{
-
+
)
}
diff --git a/src/components/ProfileSection.tsx b/src/components/ProfileSection.tsx
index 58a82c5..fa4d6e8 100644
--- a/src/components/ProfileSection.tsx
+++ b/src/components/ProfileSection.tsx
@@ -1,3 +1,4 @@
+import { FALLBACK_PROFILE_IMAGE } from 'constants.ts'
import { Event, Filter, kinds, nip19, UnsignedEvent } from 'nostr-tools'
import { QRCodeSVG } from 'qrcode.react'
import { useState } from 'react'
@@ -9,16 +10,21 @@ import {
UserRelaysType
} from '../controllers'
import { useAppSelector, useDidMount } from '../hooks'
-import { getProfilePageRoute } from '../routes'
+import { appRoutes, getProfilePageRoute } from '../routes'
import '../styles/author.css'
import '../styles/innerPage.css'
import '../styles/socialPosts.css'
import { UserProfile } from '../types'
-import { copyTextToClipboard, log, LogType, now, npubToHex } from '../utils'
+import {
+ copyTextToClipboard,
+ hexToNpub,
+ log,
+ LogType,
+ now,
+ npubToHex
+} from '../utils'
import { LoadingSpinner } from './LoadingSpinner'
import { ZapPopUp } from './Zap'
-import { NDKUserProfile } from '@nostr-dev-kit/ndk'
-import _ from 'lodash'
type Props = {
pubkey: string
@@ -34,13 +40,22 @@ export const ProfileSection = ({ pubkey }: Props) => {
})
})
- if (!profile) return null
+ const displayName =
+ profile?.displayName || profile?.name || '[name not set up]'
+ const about = profile?.bio || profile?.about || '[bio not set up]'
return (
@@ -91,12 +106,26 @@ export const ProfileSection = ({ pubkey }: Props) => {
}
type ProfileProps = {
- profile: NDKUserProfile
+ pubkey: string
+ displayName: string
+ about: string
+ image?: string
+ nip05?: string
+ lud16?: string
}
-export const Profile = ({ profile }: ProfileProps) => {
+export const Profile = ({
+ pubkey,
+ displayName,
+ about,
+ image,
+ nip05,
+ lud16
+}: ProfileProps) => {
+ const npub = hexToNpub(pubkey)
+
const handleCopy = async () => {
- copyTextToClipboard(profile.npub as string).then((isCopied) => {
+ copyTextToClipboard(npub).then((isCopied) => {
if (isCopied) {
toast.success('Npub copied to clipboard!')
} else {
@@ -107,25 +136,15 @@ export const Profile = ({ profile }: ProfileProps) => {
})
}
- const hexPubkey = npubToHex(profile.pubkey as string)
-
- if (!hexPubkey) return null
-
- const profileRoute = getProfilePageRoute(
- nip19.nprofileEncode({
- pubkey: hexPubkey
- })
- )
-
- const npub = (profile.npub as string) || ''
- const displayName =
- profile.displayName ||
- profile.name ||
- _.truncate(npub, {
- length: 16
- })
- const nip05 = profile.nip05 || ''
- const about = profile.bio || profile.about || ''
+ let profileRoute = appRoutes.home
+ const hexPubkey = npubToHex(pubkey)
+ if (hexPubkey) {
+ profileRoute = getProfilePageRoute(
+ nip19.nprofileEncode({
+ pubkey: hexPubkey
+ })
+ )
+ }
return (
@@ -142,7 +161,7 @@ export const Profile = ({ profile }: ProfileProps) => {
className='IBMSMSMSSS_Author_Top_PP'
style={{
background: `url('${
- profile.image || ''
+ image || FALLBACK_PROFILE_IMAGE
}') center / cover no-repeat`
}}
>
@@ -151,7 +170,9 @@ export const Profile = ({ profile }: ProfileProps) => {
{displayName}
-
{nip05}
+ {nip05 && (
+
{nip05}
+ )}
@@ -182,8 +203,8 @@ export const Profile = ({ profile }: ProfileProps) => {
-
-
+
+ {lud16 &&
}
@@ -196,7 +217,7 @@ export const Profile = ({ profile }: ProfileProps) => {
>
-