From 5f792f40f059dc6dbfa1c572c4a3c6d56f9a2429 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sat, 8 Jun 2024 17:19:52 +0200 Subject: [PATCH] feat: add '(You)' in quote links --- src/components/markdown/markdown.tsx | 2 +- .../post/reply-quote-preview/reply-quote-preview.tsx | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/markdown/markdown.tsx b/src/components/markdown/markdown.tsx index b63b3885..84a3ecf5 100644 --- a/src/components/markdown/markdown.tsx +++ b/src/components/markdown/markdown.tsx @@ -153,7 +153,7 @@ const Markdown = ({ content, spoiler }: MarkdownProps) => { remarkPlugins={remarkPlugins} rehypePlugins={[[rehypeSanitize, customSchema]]} components={{ - p: ({ children }) =>

{spoiler ? {children} : children}

, + p: ({ children }) =>

{spoiler ? {children} : children}

, img: ({ src }) => {src}, video: ({ src }) => {src}, iframe: ({ src }) => {src}, diff --git a/src/components/post/reply-quote-preview/reply-quote-preview.tsx b/src/components/post/reply-quote-preview/reply-quote-preview.tsx index 0e39e5b2..3873fca4 100644 --- a/src/components/post/reply-quote-preview/reply-quote-preview.tsx +++ b/src/components/post/reply-quote-preview/reply-quote-preview.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react'; import { createPortal } from 'react-dom'; import { Link } from 'react-router-dom'; -import { Comment } from '@plebbit/plebbit-react-hooks'; +import { Comment, useAccount } from '@plebbit/plebbit-react-hooks'; import { useFloating, offset, shift, size, autoUpdate, Placement } from '@floating-ui/react'; import useIsMobile from '../../../hooks/use-is-mobile'; import styles from '../post.module.css'; @@ -119,6 +119,8 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i ); + const account = useAccount(); + const replyQuotelink = ( <> handleMouseLeave(quotelinkReply?.cid)} > {`c/${quotelinkReply?.shortCid}`} + {quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
{hoveredCid === quotelinkReply?.cid && @@ -204,6 +207,8 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is ); + const account = useAccount(); + const replyQuotelink = ( <> handleMouseOver(quotelinkReply?.cid)} onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)} > - c/{quotelinkReply?.shortCid}{' '} + c/{quotelinkReply?.shortCid} + {quotelinkReply?.author?.address === account?.author?.address && ' (You)'} + {' '} #