Skip to content

Commit

Permalink
Fix ContentScopeIndicator for scope with optional dimensions (#2667)
Browse files Browse the repository at this point in the history
Co-authored-by: Johannes Obermair <[email protected]>
  • Loading branch information
Ben-Ho and johnnyomair authored Oct 30, 2024
1 parent 37d71a8 commit 1cf01f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-moose-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-admin": patch
---

Fix `ContentScopeIndicator` for scope with optional dimensions
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const ContentScopeIndicator = ({ global = false, scope: passedScope, chil

const findLabelForScopePart = (scopePart: keyof ContentScopeInterface) => {
const label = values.find((value) => {
return value[scopePart].value === scope[scopePart];
return value[scopePart] && value[scopePart].value === scope[scopePart];
})?.[scopePart].label;

return label ?? capitalizeString(scope[scopePart]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppHeader, AppHeaderFillSpace, AppHeaderMenuButton, CometLogo, MainContent } from "@comet/admin";
import { ContentScopeControls, ContentScopeProvider, ContentScopeValues, useContentScope } from "@comet/cms-admin";
import { ContentScopeControls, ContentScopeIndicator, ContentScopeProvider, ContentScopeValues, useContentScope } from "@comet/cms-admin";
import { Typography } from "@mui/material";
import { storiesOf } from "@storybook/react";
import React from "react";
Expand Down Expand Up @@ -49,6 +49,7 @@ storiesOf("@comet/cms-admin/Content Scope Provider", module)
<ContentScopeControls />
</AppHeader>
<MainContent>
<ContentScopeIndicator />
<Typography gutterBottom>
This is a development story to test optional scope dimensions in the content scope provider. Try changing the
scope in the content scope select.
Expand Down

0 comments on commit 1cf01f7

Please sign in to comment.