feat(p/all): use multisub title, description and createdAt in mock description and board header

This commit is contained in:
plebeius.eth
2024-05-17 14:55:41 +02:00
parent 86223bb249
commit 11d1424c0a
4 changed files with 70 additions and 14 deletions
@@ -1,5 +1,8 @@
import Post from '../post';
import { useTranslation } from 'react-i18next';
import { isAllView } from '../../lib/utils/view-utils';
import { useMultisubMetadata } from '../../hooks/use-default-subplebbits';
import { useLocation } from 'react-router-dom';
interface DescriptionPostProps {
avatarUrl?: string;
@@ -12,14 +15,21 @@ interface DescriptionPostProps {
const SubplebbitDescription = ({ avatarUrl, createdAt, description, shortAddress, subplebbitAddress, title }: DescriptionPostProps) => {
const { t } = useTranslation();
const location = useLocation();
const isInAllView = isAllView(location.pathname);
const multisubMetadata = useMultisubMetadata();
const post = {
isDescription: true,
subplebbitAddress,
timestamp: createdAt,
timestamp: isInAllView ? multisubMetadata?.createdAt : createdAt,
author: { displayName: '## Board Mods' },
content: description,
content: isInAllView ? multisubMetadata?.description : description,
link: avatarUrl,
title: t('welcome_to_board', { board: title || `p/${shortAddress}`, interpolation: { escapeValue: false } }),
title: t('welcome_to_board', {
board: isInAllView ? multisubMetadata?.title : title || `p/${shortAddress}`,
interpolation: { escapeValue: false },
}),
pinned: true,
locked: true,
};