diff --git a/src/components/post/post-tools/post-tools.tsx b/src/components/post/post-tools/post-tools.tsx
index 24e35bfd..d40e3833 100644
--- a/src/components/post/post-tools/post-tools.tsx
+++ b/src/components/post/post-tools/post-tools.tsx
@@ -11,27 +11,35 @@ interface PostToolsProps {
showReplyForm?: () => void;
}
-const PostTools = ({ cid, isReply, replyCount, spoiler, subplebbitAddress, showReplyForm }: PostToolsProps) => {
+const SpoilerLabel = () => {
const { t } = useTranslation();
- const validReplyCount = isNaN(replyCount) ? 0 : replyCount;
- const commentCount = validReplyCount === 0 ? t('post_no_comments') : `${validReplyCount} ${validReplyCount === 1 ? t('post_comment') : t('post_comments')}`;
- const hasLabel = spoiler || cid === undefined;
- const spoilerLabel = (
+ return (
- {spoiler && t('spoiler').toUpperCase()}
+ {t('spoiler').toUpperCase()}
);
+};
- const pendingLabel = (
+const PendingLabel = () => {
+ const { t } = useTranslation();
+
+ return (
{t('pending').toUpperCase()}
);
+};
+
+const PostTools = ({ cid, isReply, replyCount, spoiler, subplebbitAddress, showReplyForm }: PostToolsProps) => {
+ const { t } = useTranslation();
+ const validReplyCount = isNaN(replyCount) ? 0 : replyCount;
+ const commentCount = validReplyCount === 0 ? t('post_no_comments') : `${validReplyCount} ${validReplyCount === 1 ? t('post_comment') : t('post_comments')}`;
+ const hasLabel = spoiler || cid === undefined;
const postLabels = (
<>
@@ -78,8 +86,8 @@ const PostTools = ({ cid, isReply, replyCount, spoiler, subplebbitAddress, showR
return (
- {spoiler && spoilerLabel}
- {cid === undefined && pendingLabel}
+ {spoiler && }
+ {cid === undefined && }
{isReply ? replyLabels : postLabels}
);