fix(feed): event links
This commit is contained in:
parent
d7bf7acc36
commit
84d5400872
@ -3,7 +3,12 @@ import { formatDate } from 'date-fns'
|
|||||||
import { useDidMount, useNDKContext } from 'hooks'
|
import { useDidMount, useNDKContext } from 'hooks'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useParams, useLocation, Link } from 'react-router-dom'
|
import { useParams, useLocation, Link } from 'react-router-dom'
|
||||||
import { getModPageRoute, getBlogPageRoute, getProfilePageRoute } from 'routes'
|
import {
|
||||||
|
getModPageRoute,
|
||||||
|
getBlogPageRoute,
|
||||||
|
getProfilePageRoute,
|
||||||
|
appRoutes
|
||||||
|
} from 'routes'
|
||||||
import { CommentEvent, UserProfile } from 'types'
|
import { CommentEvent, UserProfile } from 'types'
|
||||||
import { hexToNpub } from 'utils'
|
import { hexToNpub } from 'utils'
|
||||||
import { Reactions } from './Reactions'
|
import { Reactions } from './Reactions'
|
||||||
@ -20,12 +25,15 @@ export const Comment = ({ comment }: CommentProps) => {
|
|||||||
const { ndk } = useNDKContext()
|
const { ndk } = useNDKContext()
|
||||||
const isMod = location.pathname.includes('/mod/')
|
const isMod = location.pathname.includes('/mod/')
|
||||||
const isBlog = location.pathname.includes('/blog/')
|
const isBlog = location.pathname.includes('/blog/')
|
||||||
|
const isNote = location.pathname.includes('/feed')
|
||||||
const baseUrl = naddr
|
const baseUrl = naddr
|
||||||
? isMod
|
? isMod
|
||||||
? getModPageRoute(naddr)
|
? getModPageRoute(naddr)
|
||||||
: isBlog
|
: isBlog
|
||||||
? getBlogPageRoute(naddr)
|
? getBlogPageRoute(naddr)
|
||||||
: undefined
|
: undefined
|
||||||
|
: isNote
|
||||||
|
? `${appRoutes.feed}/`
|
||||||
: undefined
|
: undefined
|
||||||
const [commentEvents, setCommentEvents] = useState<CommentEvent[]>([])
|
const [commentEvents, setCommentEvents] = useState<CommentEvent[]>([])
|
||||||
const [profile, setProfile] = useState<UserProfile>()
|
const [profile, setProfile] = useState<UserProfile>()
|
||||||
@ -121,8 +129,6 @@ export const Comment = ({ comment }: CommentProps) => {
|
|||||||
{typeof profile?.lud16 !== 'undefined' && profile.lud16 !== '' && (
|
{typeof profile?.lud16 !== 'undefined' && profile.lud16 !== '' && (
|
||||||
<Zap {...comment.event.rawEvent()} />
|
<Zap {...comment.event.rawEvent()} />
|
||||||
)}
|
)}
|
||||||
{comment.event.kind === NDKKind.GenericReply && (
|
|
||||||
<>
|
|
||||||
<Link
|
<Link
|
||||||
className='IBMSMSMBSSCL_CAElement IBMSMSMBSSCL_CAEReplies'
|
className='IBMSMSMBSSCL_CAElement IBMSMSMBSSCL_CAEReplies'
|
||||||
to={baseUrl + comment.event.encode()}
|
to={baseUrl + comment.event.encode()}
|
||||||
@ -137,9 +143,7 @@ export const Comment = ({ comment }: CommentProps) => {
|
|||||||
>
|
>
|
||||||
<path d='M256 32C114.6 32 .0272 125.1 .0272 240c0 49.63 21.35 94.98 56.97 130.7c-12.5 50.37-54.27 95.27-54.77 95.77c-2.25 2.25-2.875 5.734-1.5 8.734C1.979 478.2 4.75 480 8 480c66.25 0 115.1-31.76 140.6-51.39C181.2 440.9 217.6 448 256 448c141.4 0 255.1-93.13 255.1-208S397.4 32 256 32z'></path>
|
<path d='M256 32C114.6 32 .0272 125.1 .0272 240c0 49.63 21.35 94.98 56.97 130.7c-12.5 50.37-54.27 95.27-54.77 95.77c-2.25 2.25-2.875 5.734-1.5 8.734C1.979 478.2 4.75 480 8 480c66.25 0 115.1-31.76 140.6-51.39C181.2 440.9 217.6 448 256 448c141.4 0 255.1-93.13 255.1-208S397.4 32 256 32z'></path>
|
||||||
</svg>
|
</svg>
|
||||||
<p className='IBMSMSMBSSCL_CAElementText'>
|
<p className='IBMSMSMBSSCL_CAElementText'>{commentEvents.length}</p>
|
||||||
{commentEvents.length}
|
|
||||||
</p>
|
|
||||||
<p className='IBMSMSMBSSCL_CAElementText'>Replies</p>
|
<p className='IBMSMSMBSSCL_CAElementText'>Replies</p>
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
@ -148,8 +152,6 @@ export const Comment = ({ comment }: CommentProps) => {
|
|||||||
>
|
>
|
||||||
<p className='IBMSMSMBSSCL_CAElementText'>Reply</p>
|
<p className='IBMSMSMBSSCL_CAElementText'>Reply</p>
|
||||||
</Link>
|
</Link>
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,17 +33,16 @@ export const CommentsPopup = () => {
|
|||||||
useBodyScrollDisable(true)
|
useBodyScrollDisable(true)
|
||||||
const isMod = location.pathname.includes('/mod/')
|
const isMod = location.pathname.includes('/mod/')
|
||||||
const isBlog = location.pathname.includes('/blog/')
|
const isBlog = location.pathname.includes('/blog/')
|
||||||
const isNote = location.pathname.includes('/feed/')
|
const isNote = location.pathname.includes('/feed')
|
||||||
const baseUrl = naddr
|
const baseUrl = naddr
|
||||||
? isMod
|
? isMod
|
||||||
? getModPageRoute(naddr)
|
? getModPageRoute(naddr)
|
||||||
: isBlog
|
: isBlog
|
||||||
? getBlogPageRoute(naddr)
|
? getBlogPageRoute(naddr)
|
||||||
|
: undefined
|
||||||
: isNote
|
: isNote
|
||||||
? appRoutes.feed
|
? `${appRoutes.feed}/`
|
||||||
: undefined
|
: undefined
|
||||||
: undefined
|
|
||||||
|
|
||||||
const { event } = useLoaderData() as CommentsLoaderResult
|
const { event } = useLoaderData() as CommentsLoaderResult
|
||||||
const {
|
const {
|
||||||
size,
|
size,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user