From 84d54008722caefe811b664bc6da472a82b1c2cd Mon Sep 17 00:00:00 2001 From: en Date: Fri, 14 Feb 2025 19:16:24 +0100 Subject: [PATCH] fix(feed): event links --- src/components/comment/Comment.tsx | 62 ++++++++++++------------ src/components/comment/CommentsPopup.tsx | 7 ++- 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/components/comment/Comment.tsx b/src/components/comment/Comment.tsx index 25cf56d..44fcdd7 100644 --- a/src/components/comment/Comment.tsx +++ b/src/components/comment/Comment.tsx @@ -3,7 +3,12 @@ import { formatDate } from 'date-fns' import { useDidMount, useNDKContext } from 'hooks' import { useState } from 'react' 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 { hexToNpub } from 'utils' import { Reactions } from './Reactions' @@ -20,12 +25,15 @@ export const Comment = ({ comment }: CommentProps) => { const { ndk } = useNDKContext() const isMod = location.pathname.includes('/mod/') const isBlog = location.pathname.includes('/blog/') + const isNote = location.pathname.includes('/feed') const baseUrl = naddr ? isMod ? getModPageRoute(naddr) : isBlog ? getBlogPageRoute(naddr) : undefined + : isNote + ? `${appRoutes.feed}/` : undefined const [commentEvents, setCommentEvents] = useState([]) const [profile, setProfile] = useState() @@ -121,35 +129,29 @@ export const Comment = ({ comment }: CommentProps) => { {typeof profile?.lud16 !== 'undefined' && profile.lud16 !== '' && ( )} - {comment.event.kind === NDKKind.GenericReply && ( - <> - - - - -

- {commentEvents.length} -

-

Replies

- - -

Reply

- - - )} + + + + +

{commentEvents.length}

+

Replies

+ + +

Reply

+ diff --git a/src/components/comment/CommentsPopup.tsx b/src/components/comment/CommentsPopup.tsx index 662923b..9a89119 100644 --- a/src/components/comment/CommentsPopup.tsx +++ b/src/components/comment/CommentsPopup.tsx @@ -33,17 +33,16 @@ export const CommentsPopup = () => { useBodyScrollDisable(true) const isMod = location.pathname.includes('/mod/') const isBlog = location.pathname.includes('/blog/') - const isNote = location.pathname.includes('/feed/') + const isNote = location.pathname.includes('/feed') const baseUrl = naddr ? isMod ? getModPageRoute(naddr) : isBlog ? getBlogPageRoute(naddr) - : isNote - ? appRoutes.feed : undefined + : isNote + ? `${appRoutes.feed}/` : undefined - const { event } = useLoaderData() as CommentsLoaderResult const { size,