From be30cdbcb2002267f6dafa13f9154c1b274afc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 17 Dec 2022 13:38:41 +0100 Subject: [PATCH] Groups: use isDefaultHeader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../group/components/group-header.tsx | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/app/soapbox/features/group/components/group-header.tsx b/app/soapbox/features/group/components/group-header.tsx index a9b40c564..812f77e79 100644 --- a/app/soapbox/features/group/components/group-header.tsx +++ b/app/soapbox/features/group/components/group-header.tsx @@ -8,6 +8,7 @@ import StillImage from 'soapbox/components/still-image'; import { Avatar, Button, HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; import { normalizeAttachment } from 'soapbox/normalizers'; +import { isDefaultHeader } from 'soapbox/utils/accounts'; import type { Group } from 'soapbox/types/entities'; @@ -95,6 +96,29 @@ const GroupHeader: React.FC = ({ group }) => { } }; + const renderHeader = () => { + let header: React.ReactNode; + + if (group.header) { + header = ( + + ); + + if (!isDefaultHeader(group.header)) { + header = ( + + {header} + + ); + } + } + + return header; + }; + const makeActionButton = () => { if (!group.relationship || !group.relationship.member) { return ( @@ -134,14 +158,7 @@ const GroupHeader: React.FC = ({ group }) => {
- {group.header && ( - - - - )} + {renderHeader()}