From 2b7261135f5ba7f19e2a6fcaf0ce0d6b06a6b64c Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 8 Nov 2024 15:49:16 +0530 Subject: [PATCH 1/3] Site Hub: Enhance mobile component with dashboard link and block theme detection --- .../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 3f34b8bd1cccb..54dfbdb1f6516 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 ?? false, + 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( From 6d1650ab8be907f66a1166a68ba56674aa293eeb Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Fri, 8 Nov 2024 15:58:34 +0530 Subject: [PATCH 2/3] Site Hub: Simplify dashboard link rendering logic for non-block themes --- packages/edit-site/src/components/site-hub/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js index 54dfbdb1f6516..d2b15fe109fce 100644 --- a/packages/edit-site/src/components/site-hub/index.js +++ b/packages/edit-site/src/components/site-hub/index.js @@ -163,7 +163,7 @@ export const SiteHubMobile = memo( transform: 'scale(0.5)', borderRadius: 4, } } - { ...( dashboardLink && ! isBlockTheme + { ...( ! isBlockTheme ? { href: dashboardLink, label: __( 'Go to the Dashboard' ), From b40718c7c2bbcbb0b6c0f41b042adf41f6c92429 Mon Sep 17 00:00:00 2001 From: yogeshbhutkar Date: Mon, 11 Nov 2024 09:51:31 +0530 Subject: [PATCH 3/3] Site Hub: Remove fallback for block theme detection in mobile component --- packages/edit-site/src/components/site-hub/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js index d2b15fe109fce..9e57034bfe73a 100644 --- a/packages/edit-site/src/components/site-hub/index.js +++ b/packages/edit-site/src/components/site-hub/index.js @@ -132,7 +132,7 @@ export const SiteHubMobile = memo( dashboardLink: getSettings().__experimentalDashboardLink || 'index.php', - isBlockTheme: getCurrentTheme()?.is_block_theme ?? false, + isBlockTheme: getCurrentTheme()?.is_block_theme, homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home, siteTitle: ! _site?.title && !! _site?.url