mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
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;
|
|
createdAt: number;
|
|
description: string;
|
|
shortAddress: string;
|
|
subplebbitAddress: string | undefined;
|
|
title: string;
|
|
}
|
|
|
|
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: isInAllView ? multisubMetadata?.createdAt : createdAt,
|
|
author: { displayName: `'## ${t('board_mods')}` },
|
|
content: isInAllView ? multisubMetadata?.description : description,
|
|
link: avatarUrl,
|
|
title: t('welcome_to_board', {
|
|
board: isInAllView ? multisubMetadata?.title : title || `p/${shortAddress}`,
|
|
interpolation: { escapeValue: false },
|
|
}),
|
|
pinned: true,
|
|
locked: true,
|
|
};
|
|
|
|
return <Post post={post} />;
|
|
};
|
|
|
|
export default SubplebbitDescription;
|