Skip to content

Commit

Permalink
Pakete breadcrumb, % significant digits, impact translation
Browse files Browse the repository at this point in the history
  • Loading branch information
terotik committed Nov 28, 2024
1 parent fdc7d13 commit ec21977
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions components/paths/CategoryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ const PathsBasicNodeContent = (props: PathsBasicNodeContentProps) => {
}${format.number(emissions.total.latest.change * 100, {
style: 'unit',
unit: 'percent',
maximumSignificantDigits: 2,
})}`
: undefined
}
Expand All @@ -314,6 +315,7 @@ const PathsBasicNodeContent = (props: PathsBasicNodeContentProps) => {
}${format.number(emissions.total.reference.change * 100, {
style: 'unit',
unit: 'percent',
maximumSignificantDigits: 2,
})}`
: undefined
}
Expand Down
14 changes: 12 additions & 2 deletions components/paths/contentblocks/CategoryPageHeaderBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const PathsActionNodeContent = (props: PathsActionNodeContentProps) => {
<div>
<HighlightValue
displayValue={impact.toPrecision(3)}
header={`Impact (${yearRange[1]})`}
header={`${t('impact')} ${yearRange[1]}`}
unit={pathsAction.getUnit() || ''}
size="lg"
muted={refetching || !pathsAction.isEnabled()}
Expand Down Expand Up @@ -276,13 +276,23 @@ function CategoryPageHeaderBlock(props: Props) {
? getBreadcrumbsFromCategoryHierarchy([page.category.parent], false)
: [];

console.log('breadcrumbs', breadcrumbs);
console.log('page', page);
// TODO: A better way to find root category list page
const rootCategoryListPage =
page?.category && page.category.type.id === '76'
? { id: 0, name: 'Bereiche', url: '/klimaschutzplan/bereiche' }
: null;
const currentCategoryListPage =
page?.category && page.category.level?.id === '25'
? {
id: 1,
name: page.category.level.namePlural,
url: '/klimaschutzplan/massnahmenpakete',
}
: null;
if (rootCategoryListPage) breadcrumbs.unshift(rootCategoryListPage);

if (currentCategoryListPage) breadcrumbs.push(currentCategoryListPage);
return (
<Background $hasHeaderImage={!!headerImage}>
<Container>
Expand Down
1 change: 1 addition & 0 deletions queries/get-content-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const GET_CONTENT_PAGE = gql`
urlPath
}
level {
id
name
namePlural
}
Expand Down

0 comments on commit ec21977

Please sign in to comment.