2024-04-09 15:03:26 +02:00
|
|
|
import Post from '../post';
|
2024-04-28 22:05:06 +02:00
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import _ from 'lodash';
|
2024-04-09 15:03:26 +02:00
|
|
|
|
|
|
|
|
interface RulesPostProps {
|
|
|
|
|
subplebbitAddress: string | undefined;
|
|
|
|
|
createdAt: number;
|
|
|
|
|
rules: string[];
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-12 14:28:06 +02:00
|
|
|
const SubplebbitRules = ({ subplebbitAddress, createdAt, rules }: RulesPostProps) => {
|
2024-04-28 22:05:06 +02:00
|
|
|
const { t } = useTranslation();
|
2024-04-09 15:03:26 +02:00
|
|
|
const content = rules.map((rule, index) => `${index + 1}. ${rule}`).join('\n');
|
|
|
|
|
const post = {
|
|
|
|
|
isRules: true,
|
|
|
|
|
subplebbitAddress,
|
|
|
|
|
timestamp: createdAt,
|
|
|
|
|
author: { displayName: '## Board Mods' },
|
|
|
|
|
content,
|
2024-04-28 22:05:06 +02:00
|
|
|
title: _.capitalize(t('rules')),
|
2024-04-09 15:03:26 +02:00
|
|
|
pinned: true,
|
|
|
|
|
locked: true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return <Post post={post} />;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default SubplebbitRules;
|