From 63059c72f43f93e5e6f22eeb598d98ae161028ed Mon Sep 17 00:00:00 2001 From: Pallavi Mishra Date: Wed, 28 Aug 2024 17:11:18 +0530 Subject: [PATCH 1/2] Breadcrumbs issue fixed --- studio/src/components/PageHeader/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/studio/src/components/PageHeader/index.js b/studio/src/components/PageHeader/index.js index f69e32c47..83e6055e3 100644 --- a/studio/src/components/PageHeader/index.js +++ b/studio/src/components/PageHeader/index.js @@ -23,8 +23,8 @@ function Pageheader() { : pathSnippets[0]; const isBreadCrumbsHidden = - (pathSnippets.includes('edit') || pathSnippets.includes('create')) && - (entity === 'posts' || entity === 'pages' || entity === 'fact-checks'); // redundant entity check for fact-checks? + (pathSnippets.includes('edit') || pathSnippets.includes('create')) && + ['posts', 'pages', 'fact-checks'].includes(entity); const breadcrumbItems = useMemo(() => { const urlBreadcrumbItems = pathSnippets.map((empty, index) => { const url = `/${pathSnippets.slice(0, index + 1).join('/')}`; @@ -78,8 +78,8 @@ function Pageheader() { } }); return _.filter(urlBreadcrumbItems); + }, [pathSnippets, location.pathname]); - const handleOnBack = () => { if (isBreadCrumbsHidden) { if ( @@ -106,11 +106,13 @@ function Pageheader() { } }; const itemRender = (route, params, routes, paths) => { + + const breadcrumbItem = breadcrumbItems.find(item => item.path === route.path); const last = routes.indexOf(route) === routes.length - 1; - if (last && routes.length > 1) { + if (last) { return ( !isBreadCrumbsHidden && ( -

{route.breadcrumbName}

+

{breadcrumbItem?.breadcrumbName}

) ); } @@ -118,18 +120,19 @@ function Pageheader() { !isBreadCrumbsHidden && (

- {route.breadcrumbName} + {breadcrumbItem?.breadcrumbName}

) ); }; - +c if ( (state[entity] && !state[entity].loading) || ['members', 'advanced', 'website', 'admin'].includes(entity) || location.pathname.split('/').pop() === 'create' ) + return ( : null} From f834c4e0364163fab197910070ed453063a93087 Mon Sep 17 00:00:00 2001 From: Pallavi Mishra Date: Wed, 28 Aug 2024 17:15:27 +0530 Subject: [PATCH 2/2] minor update --- studio/src/components/PageHeader/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/src/components/PageHeader/index.js b/studio/src/components/PageHeader/index.js index 83e6055e3..764bd7dca 100644 --- a/studio/src/components/PageHeader/index.js +++ b/studio/src/components/PageHeader/index.js @@ -126,7 +126,7 @@ function Pageheader() { ) ); }; -c + if ( (state[entity] && !state[entity].loading) || ['members', 'advanced', 'website', 'admin'].includes(entity) ||