diff --git a/app/soapbox/features/account/components/header.tsx b/app/soapbox/features/account/components/header.tsx index 47584dc68e..02d7c03205 100644 --- a/app/soapbox/features/account/components/header.tsx +++ b/app/soapbox/features/account/components/header.tsx @@ -21,6 +21,7 @@ import StillImage from 'soapbox/components/still-image'; import { Avatar, HStack, IconButton, Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList } from 'soapbox/components/ui'; import SvgIcon from 'soapbox/components/ui/icon/svg-icon'; import MovedNote from 'soapbox/features/account-timeline/components/moved-note'; +import { isDefaultHeader } from 'soapbox/features/onboarding/steps/cover-photo-selection-step'; import ActionButton from 'soapbox/features/ui/components/action-button'; import SubscriptionButton from 'soapbox/features/ui/components/subscription-button'; import { useAppDispatch, useFeatures, useOwnAccount } from 'soapbox/hooks'; @@ -502,6 +503,29 @@ const Header: React.FC = ({ account }) => { return info; }; + const renderHeader = () => { + let header: React.ReactNode; + + if (account.header) { + header = ( + + ); + + if (!isDefaultHeader(account.header)) { + header = ( + + {header} + + ); + } + } + + return header; + }; + const renderMessageButton = () => { if (features.chatsWithFollowers) { // Truth Social if (!ownAccount || !account || account.id === ownAccount?.id) { @@ -570,14 +594,7 @@ const Header: React.FC = ({ account }) => {
- {account.header && ( - - - - )} + {renderHeader()}
diff --git a/app/soapbox/features/event/components/event-header.tsx b/app/soapbox/features/event/components/event-header.tsx index dd7a66d887..adfb2dc325 100644 --- a/app/soapbox/features/event/components/event-header.tsx +++ b/app/soapbox/features/event/components/event-header.tsx @@ -95,6 +95,7 @@ const EventHeader: React.FC = ({ status }) => { const username = account.username; const handleHeaderClick: React.MouseEventHandler = (e) => { + e.preventDefault(); e.stopPropagation(); dispatch(openModal('MEDIA', { media: ImmutableList([event.banner]) })); diff --git a/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx b/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx index e1a9c5f304..f5ab0d0aba 100644 --- a/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx +++ b/app/soapbox/features/onboarding/steps/cover-photo-selection-step.tsx @@ -24,8 +24,8 @@ const DEFAULT_HEADERS = [ ]; /** Check if the avatar is a default avatar */ -const isDefaultHeader = (url: string) => { - return DEFAULT_HEADERS.every(header => url.endsWith(header)); +export const isDefaultHeader = (url: string) => { + return DEFAULT_HEADERS.some(header => url.endsWith(header)); }; const CoverPhotoSelectionStep = ({ onNext }: { onNext: () => void }) => {