mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(catalog post preview): show displayName of last reply with thread.lastChildCid
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
import { useComment } from '@plebbit/plebbit-react-hooks';
|
||||||
|
|
||||||
|
const DisplayName = ({ commentCid }) => {
|
||||||
|
const comment = useComment({ commentCid });
|
||||||
|
|
||||||
|
return <span>{comment?.author?.displayName ?? 'Anonymous'}</span>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DisplayName;
|
||||||
@@ -12,6 +12,7 @@ import { Threads, PostPreview, PostMenuCatalog } from '../styled/views/Catalog.s
|
|||||||
import { TopBar, Footer } from '../styled/views/Thread.styled';
|
import { TopBar, Footer } from '../styled/views/Thread.styled';
|
||||||
import { AlertModal } from '../styled/modals/AlertModal.styled';
|
import { AlertModal } from '../styled/modals/AlertModal.styled';
|
||||||
import CatalogLoader from '../CatalogLoader';
|
import CatalogLoader from '../CatalogLoader';
|
||||||
|
import DisplayName from '../DisplayName';
|
||||||
import EditModal from '../modals/EditModal';
|
import EditModal from '../modals/EditModal';
|
||||||
import ImageBanner from '../ImageBanner';
|
import ImageBanner from '../ImageBanner';
|
||||||
import VerifiedAuthor from '../VerifiedAuthor';
|
import VerifiedAuthor from '../VerifiedAuthor';
|
||||||
@@ -383,7 +384,10 @@ const CatalogPost = ({ post }) => {
|
|||||||
{thread.replyCount > 0 ? (
|
{thread.replyCount > 0 ? (
|
||||||
<div className='post-last'>
|
<div className='post-last'>
|
||||||
Last reply by
|
Last reply by
|
||||||
<span className='post-author'> Anonymous </span>
|
<span className='post-author'>
|
||||||
|
{' '}
|
||||||
|
<DisplayName commentCid={thread.lastChildCid} />{' '}
|
||||||
|
</span>
|
||||||
<span className='post-ago'>{getFormattedTime(thread.lastReplyTimestamp)}</span>
|
<span className='post-ago'>{getFormattedTime(thread.lastReplyTimestamp)}</span>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import SettingsModal from '../modals/SettingsModal';
|
|||||||
import BoardSettings from '../BoardSettings';
|
import BoardSettings from '../BoardSettings';
|
||||||
import BoardStats from '../BoardStats';
|
import BoardStats from '../BoardStats';
|
||||||
import CatalogLoader from '../CatalogLoader';
|
import CatalogLoader from '../CatalogLoader';
|
||||||
|
import DisplayName from '../DisplayName';
|
||||||
import ImageBanner from '../ImageBanner';
|
import ImageBanner from '../ImageBanner';
|
||||||
import OfflineIndicator from '../OfflineIndicator';
|
import OfflineIndicator from '../OfflineIndicator';
|
||||||
import VerifiedAuthor from '../VerifiedAuthor';
|
import VerifiedAuthor from '../VerifiedAuthor';
|
||||||
@@ -769,7 +770,10 @@ const CatalogPost = ({ post }) => {
|
|||||||
{thread.replyCount > 0 ? (
|
{thread.replyCount > 0 ? (
|
||||||
<div className='post-last'>
|
<div className='post-last'>
|
||||||
Last reply by
|
Last reply by
|
||||||
<span className='post-author'> Anonymous </span>
|
<span className='post-author'>
|
||||||
|
{' '}
|
||||||
|
<DisplayName commentCid={thread.lastChildCid} />{' '}
|
||||||
|
</span>
|
||||||
<span className='post-ago'>{getFormattedTime(thread.lastReplyTimestamp)}</span>
|
<span className='post-ago'>{getFormattedTime(thread.lastReplyTimestamp)}</span>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { Threads, PostPreview, PostMenuCatalog } from '../styled/views/Catalog.s
|
|||||||
import { TopBar, Footer } from '../styled/views/Thread.styled';
|
import { TopBar, Footer } from '../styled/views/Thread.styled';
|
||||||
import { AlertModal } from '../styled/modals/AlertModal.styled';
|
import { AlertModal } from '../styled/modals/AlertModal.styled';
|
||||||
import CatalogLoader from '../CatalogLoader';
|
import CatalogLoader from '../CatalogLoader';
|
||||||
|
import DisplayName from '../DisplayName';
|
||||||
import EditModal from '../modals/EditModal';
|
import EditModal from '../modals/EditModal';
|
||||||
import ImageBanner from '../ImageBanner';
|
import ImageBanner from '../ImageBanner';
|
||||||
import VerifiedAuthor from '../VerifiedAuthor';
|
import VerifiedAuthor from '../VerifiedAuthor';
|
||||||
@@ -383,7 +384,10 @@ const CatalogPost = ({ post }) => {
|
|||||||
{thread.replyCount > 0 ? (
|
{thread.replyCount > 0 ? (
|
||||||
<div className='post-last'>
|
<div className='post-last'>
|
||||||
Last reply by
|
Last reply by
|
||||||
<span className='post-author'> Anonymous </span>
|
<span className='post-author'>
|
||||||
|
{' '}
|
||||||
|
<DisplayName commentCid={thread.lastChildCid} />{' '}
|
||||||
|
</span>
|
||||||
<span className='post-ago'>{getFormattedTime(thread.lastReplyTimestamp)}</span>
|
<span className='post-ago'>{getFormattedTime(thread.lastReplyTimestamp)}</span>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
Reference in New Issue
Block a user