From be52633ee4ce4a14b48f82156cf64c0a3eb9835b Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 20 Mar 2024 18:21:03 +0100 Subject: [PATCH] Change back button to always appear in advanced web UI (#29669) --- .../mastodon/components/column_header.jsx | 23 ++++++++----------- .../features/follow_requests/index.jsx | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/app/javascript/mastodon/components/column_header.jsx b/app/javascript/mastodon/components/column_header.jsx index 7fd646690..a7d07ffdb 100644 --- a/app/javascript/mastodon/components/column_header.jsx +++ b/app/javascript/mastodon/components/column_header.jsx @@ -13,7 +13,7 @@ import ChevronRightIcon from '@/material-icons/400-24px/chevron_right.svg?react' import CloseIcon from '@/material-icons/400-24px/close.svg?react'; import SettingsIcon from '@/material-icons/400-24px/settings.svg?react'; import { Icon } from 'mastodon/components/icon'; -import { ButtonInTabsBar, useColumnsContext } from 'mastodon/features/ui/util/columns_context'; +import { ButtonInTabsBar } from 'mastodon/features/ui/util/columns_context'; import { WithRouterPropTypes } from 'mastodon/utils/react_router'; import { useAppHistory } from './router'; @@ -26,10 +26,9 @@ const messages = defineMessages({ back: { id: 'column_back_button.label', defaultMessage: 'Back' }, }); -const BackButton = ({ pinned, show, onlyIcon }) => { +const BackButton = ({ onlyIcon }) => { const history = useAppHistory(); const intl = useIntl(); - const { multiColumn } = useColumnsContext(); const handleBackClick = useCallback(() => { if (history.location?.state?.fromMastodon) { @@ -39,10 +38,6 @@ const BackButton = ({ pinned, show, onlyIcon }) => { } }, [history]); - const showButton = history && !pinned && ((multiColumn && history.location?.state?.fromMastodon) || show); - - if (!showButton) return null; - return ( ; } - backButton = ; + if (history && !pinned && ((multiColumn && history.location?.state?.fromMastodon) || showBackButton)) { + backButton = ; + } const collapsedContent = [ extraContent, @@ -199,16 +194,16 @@ class ColumnHeader extends PureComponent {

{hasTitle && ( <> - {showBackButton && backButton} + {backButton} )} - {!hasTitle && showBackButton && backButton} + {!hasTitle && backButton}
{extraButton} diff --git a/app/javascript/mastodon/features/follow_requests/index.jsx b/app/javascript/mastodon/features/follow_requests/index.jsx index 7d651f2ca..a8f40a31d 100644 --- a/app/javascript/mastodon/features/follow_requests/index.jsx +++ b/app/javascript/mastodon/features/follow_requests/index.jsx @@ -68,7 +68,7 @@ class FollowRequests extends ImmutablePureComponent { ); return ( - +