From 956efdd4c3b6c90b7d8c1d62c43adc0ca3861041 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Sat, 8 Jul 2023 14:37:08 +0200 Subject: [PATCH] verify comment author addresses --- src/components/VerifiedAuthor.jsx | 10 +++++++ src/components/views/All.jsx | 29 ++++++++++--------- src/components/views/AllCatalog.jsx | 9 +++--- src/components/views/Board.jsx | 29 ++++++++++--------- src/components/views/Catalog.jsx | 9 +++--- src/components/views/Subscriptions.jsx | 29 ++++++++++--------- src/components/views/SubscriptionsCatalog.jsx | 9 +++--- src/components/views/Thread.jsx | 25 ++++++++-------- 8 files changed, 83 insertions(+), 66 deletions(-) create mode 100644 src/components/VerifiedAuthor.jsx diff --git a/src/components/VerifiedAuthor.jsx b/src/components/VerifiedAuthor.jsx new file mode 100644 index 00000000..5a832381 --- /dev/null +++ b/src/components/VerifiedAuthor.jsx @@ -0,0 +1,10 @@ +import {useComment, useAuthorAddress} from '@plebbit/plebbit-react-hooks'; + +function VerifiedAuthor({ commentCid, children }) { + const comment = useComment({commentCid}); + const {authorAddress, shortAuthorAddress} = useAuthorAddress({comment}); + + return children({ authorAddress, shortAuthorAddress }); +} + +export default VerifiedAuthor; \ No newline at end of file diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx index a6b45e42..68e4e058 100755 --- a/src/components/views/All.jsx +++ b/src/components/views/All.jsx @@ -21,6 +21,7 @@ import Post from '../Post'; import PostLoader from '../PostLoader'; import PostOnHover from '../PostOnHover'; import StateLabel from '../StateLabel'; +import VerifiedAuthor from '../VerifiedAuthor'; import ReplyModal from '../modals/ReplyModal'; import SettingsModal from '../modals/SettingsModal'; import findShortParentCid from '../../utils/findShortParentCid'; @@ -771,9 +772,9 @@ const All = () => { (u/ handleAddressClick(thread.author.shortAddress)} + onClick={() => handleAddressClick({({ shortAuthorAddress }) => (shortAuthorAddress)})} > - {thread.author.shortAddress} + {{({ shortAuthorAddress }) => (shortAuthorAddress)}} )   {getDate(thread.timestamp)} @@ -848,8 +849,8 @@ const All = () => { >