From aba08da3b67ca5b7b0edd5096af93569b30dc0a6 Mon Sep 17 00:00:00 2001 From: Yogesh Bhutkar Date: Wed, 13 Nov 2024 18:00:05 +0530 Subject: [PATCH] Site Hub: Fixed navigation redirect on mobile devices for classic themes (#66867) * Site Hub: Enhance mobile component with dashboard link and block theme detection * Site Hub: Simplify dashboard link rendering logic for non-block themes * Site Hub: Remove fallback for block theme detection in mobile component Co-authored-by: yogeshbhutkar Co-authored-by: t-hamano Co-authored-by: ironprogrammer --- .../src/components/site-hub/index.js | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js index 3f34b8bd1cccb6..9e57034bfe73aa 100644 --- a/packages/edit-site/src/components/site-hub/index.js +++ b/packages/edit-site/src/components/site-hub/index.js @@ -121,17 +121,27 @@ export const SiteHubMobile = memo( const history = useHistory(); const { navigate } = useContext( SidebarNavigationContext ); - const { homeUrl, siteTitle } = useSelect( ( select ) => { - const { getEntityRecord } = select( coreStore ); - const _site = getEntityRecord( 'root', 'site' ); - return { - homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home, - siteTitle: - ! _site?.title && !! _site?.url - ? filterURLForDisplay( _site?.url ) - : _site?.title, - }; - }, [] ); + const { dashboardLink, isBlockTheme, homeUrl, siteTitle } = useSelect( + ( select ) => { + const { getSettings } = unlock( select( editSiteStore ) ); + + const { getEntityRecord, getCurrentTheme } = + select( coreStore ); + const _site = getEntityRecord( 'root', 'site' ); + return { + dashboardLink: + getSettings().__experimentalDashboardLink || + 'index.php', + isBlockTheme: getCurrentTheme()?.is_block_theme, + homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home, + siteTitle: + ! _site?.title && !! _site?.url + ? filterURLForDisplay( _site?.url ) + : _site?.title, + }; + }, + [] + ); const { open: openCommandCenter } = useDispatch( commandsStore ); return ( @@ -148,16 +158,23 @@ export const SiteHubMobile = memo(