Skip to content

Commit

Permalink
[fix]: benchmark table rendered incorrectly (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
sijav authored Sep 5, 2024
1 parent cfb1339 commit fa2609e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/locales/de-DE/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ msgstr "Der Zugriff auf Ihr Konto ist unterbrochen"
msgid "Account"
msgstr "Konto"

#: src/pages/panel/shared/utils/HeatmapCard.tsx:39
#: src/pages/panel/shared/utils/HeatmapCard.tsx:38
msgid "Account: {0}"
msgstr "Konto: {0}"

Expand Down Expand Up @@ -508,7 +508,7 @@ msgstr ""
msgid "Benchmark"
msgstr "Benchmark"

#: src/pages/panel/shared/utils/HeatmapCard.tsx:42
#: src/pages/panel/shared/utils/HeatmapCard.tsx:41
msgid "Benchmark: {0}"
msgstr "Benchmark: {0}"

Expand Down
4 changes: 2 additions & 2 deletions src/locales/en-US/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ msgstr "Access to your account is broken"
msgid "Account"
msgstr "Account"

#: src/pages/panel/shared/utils/HeatmapCard.tsx:39
#: src/pages/panel/shared/utils/HeatmapCard.tsx:38
msgid "Account: {0}"
msgstr "Account: {0}"

Expand Down Expand Up @@ -508,7 +508,7 @@ msgstr "below"
msgid "Benchmark"
msgstr "Benchmark"

#: src/pages/panel/shared/utils/HeatmapCard.tsx:42
#: src/pages/panel/shared/utils/HeatmapCard.tsx:41
msgid "Benchmark: {0}"
msgstr "Benchmark: {0}"

Expand Down
21 changes: 10 additions & 11 deletions src/pages/panel/shared/utils/HeatmapCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ export const HeatmapCard = ({ data }: HeatmapCardProps) => {
data: data.benchmarks.map((benchmark) => ({
title: benchmark.title,
titleHref: `/benchmark/${benchmark.id}`,
cells: data.accounts
.filter((account) => (benchmark.account_summary[account.id]?.score ?? -1) >= 0)
.map((account) => ({
name: account.name ?? account.id,
value: benchmark.account_summary[account.id]?.score ?? -1,
title: benchmark.account_summary[account.id]?.score ?? -1,
tooltip: (
cells: data.accounts.map((account) => ({
name: account.name ?? account.id,
value: benchmark.account_summary[account.id]?.score ?? -1,
title: benchmark.account_summary[account.id]?.score ?? -1,
tooltip:
(benchmark.account_summary[account.id]?.score ?? -1) >= 0 ? (
<Stack spacing={1} p={1}>
<Typography>
<Trans>Account: {account.name ? `${account.name} (${account.id})` : account.id}</Trans>
Expand All @@ -44,14 +43,14 @@ export const HeatmapCard = ({ data }: HeatmapCardProps) => {
<Divider />
<PieResourceCheckScore
data={createPieDataFromNonCompliance(account, locale, navigate, true, true)}
score={benchmark.account_summary[account.id]?.score ?? -1}
score={benchmark.account_summary[account.id]?.score}
showPieChart
noAnimation
/>
</Stack>
),
href: `/benchmark/${benchmark.id}/${account.id}`,
})),
) : undefined,
href: `/benchmark/${benchmark.id}/${account.id}`,
})),
})),
}
}, [data, locale, navigate])
Expand Down
4 changes: 2 additions & 2 deletions src/shared/charts/Heatmap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ const HeatmapCell = ({ title, value, tooltip, href }: HeatmapData) => {
let comp = (
<Stack
color="#fff"
bgcolor={value >= 0 ? getColors(Math.floor(value / (100 / NUMBER_OF_COLORS))) : undefined}
bgcolor={value >= 0 ? getColors(Math.floor(value / (100 / NUMBER_OF_COLORS))) : '#e6e6e6'}
width={CELL_WIDTH}
height={CELL_WIDTH}
alignItems="center"
justifyContent="center"
component={href ? ButtonBase : 'div'}
sx={{ textDecoration: 'none' }}
>
{value >= 0 ? title : '-'}
{value >= 0 ? title : ''}
</Stack>
)
if (href) {
Expand Down

0 comments on commit fa2609e

Please sign in to comment.