The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix unreadable low-rating data complexity badge (#82665)
Maksym Yakubych89da5b2bc601
diff --git a/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/DataComplexityCards.tsx b/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/DataComplexityCards.tsxindex 1c4338d8b4b..24751ba6e21 100644--- a/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/DataComplexityCards.tsx+++ b/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/DataComplexityCards.tsx@@ -6,6 +6,8 @@ import { getErrorMessage } from "metabase/api/utils";import {Accordion,Alert,+ Badge,+ type BadgeColor,Box,Card,Flex,@@ -43,19 +45,12 @@ import S from "./DataComplexityCards.module.css";type RatingColorKey = DataComplexityRating | "default";-const RATING_BADGE_BACKGROUND_COLORS = {- low: "feedback-positive-selected",- medium: "background_surface-warning-strong",- high: "background_surface-error",- default: "background_page-tertiary",-} satisfies Record<RatingColorKey, MetabaseColorKey>;--const RATING_BADGE_TEXT_COLORS = {- low: "success-secondary",- medium: "text-primary",- high: "error",- default: "text-secondary",-} satisfies Record<RatingColorKey, MetabaseColorKey>;+const RATING_BADGE_COLORS = {+ low: "positive",+ medium: "warning",+ high: "negative",+ default: "neutral",+} satisfies Record<RatingColorKey, BadgeColor>;const RATING_TEXT_COLORS = {low: "success",@@ -389,28 +384,17 @@ function ScoreDisplayInline({</Text>)).with({ score: P.nonNullable }, ({ score, rating }) => {- const ratingColorKey = rating ?? "default";+ const formattedScore = formatNumber(score, { maximumFractionDigits: 0 });return (- <Flex+ <Badge+ size="sm"+ color={RATING_BADGE_COLORS[rating ?? "default"]}ml="auto"- px={8}- py={4}- bdrs="xs"- bg={RATING_BADGE_BACKGROUND_COLORS[ratingColorKey]}{...rest}- gap="sm">- {withTitle && (- <Text- lh="1rem"- c={RATING_BADGE_TEXT_COLORS[ratingColorKey]}- >{t`Complexity score`}</Text>- )}- <Text fw={700} lh="1rem" c={RATING_BADGE_TEXT_COLORS[ratingColorKey]}>- {formatNumber(score, { maximumFractionDigits: 0 })}- </Text>- </Flex>+ {withTitle ? t`Complexity score ${formattedScore}` : formattedScore}+ </Badge>);}).exhaustive();diff --git a/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/__snapshots__/DataComplexityCards.unit.spec.tsx.snap b/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/__snapshots__/DataComplexityCards.unit.spec.tsx.snapindex 41f97bbadf0..a97fbf8efe1 100644--- a/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/__snapshots__/DataComplexityCards.unit.spec.tsx.snap+++ b/enterprise/frontend/src/metabase-enterprise/monitor/ai-auditing/metabot-analytics/components/ConversationStatsPage/__snapshots__/DataComplexityCards.unit.spec.tsx.snap@@ -183,19 +183,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `>Size of this layer</div>- <div>- <div- color="text-primary"- data-size="md"- >- Complexity score- </div>- <div- color="text-primary"- data-size="md"- >- 18- </div>+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>+ Complexity score 18+ </span></div></div><div@@ -234,13 +228,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `role="img"width="14"/>- <div>- <div- color="text-primary"- data-size="md"- >+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>10- </div>+ </span></div></div></span>@@ -298,13 +292,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `role="img"width="14"/>- <div>- <div- color="text-primary"- data-size="md"- >+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>8- </div>+ </span></div></div></span>@@ -340,19 +334,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `>Areas of ambiguity</div>- <div>- <div- color="text-primary"- data-size="md"- >- Complexity score- </div>- <div- color="text-primary"- data-size="md"- >- 0- </div>+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>+ Complexity score 0+ </span></div></div><div@@ -391,13 +379,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `role="img"width="14"/>- <div>- <div- color="text-primary"- data-size="md"- >+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>0- </div>+ </span></div></div></span>@@ -455,13 +443,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `role="img"width="14"/>- <div>- <div- color="text-primary"- data-size="md"- >+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>0- </div>+ </span></div></div></span>@@ -519,13 +507,13 @@ exports[`DataComplexityCards renders the data complexity cards 2`] = `role="img"width="14"/>- <div>- <div- color="text-primary"- data-size="md"- >+ <div+ data-size="sm"+ data-variant="filled"+ >+ <span>0- </div>+ </span></div></div></span>