More FE changes

This commit is contained in:
Andras Schmelczer 2026-05-09 09:43:41 +01:00
parent f114ada255
commit a48eb945e0
48 changed files with 4127 additions and 1751 deletions

View file

@ -7,7 +7,7 @@ export default function EnumBarChart({
}: {
counts: Record<string, number>;
globalCounts?: Record<string, number>;
featureName?: string;
featureName: string;
}) {
const entries = Object.entries(counts).sort(([, countA], [, countB]) => countB - countA);
const localTotal = entries.reduce((sum, [, c]) => sum + c, 0);
@ -40,10 +40,8 @@ export default function EnumBarChart({
: (count / maxCount) * 100;
const globalWidth = hasGlobal && maxPct > 0 ? (globalPct / maxPct) * 100 : 0;
const overrideColor = featureName ? getEnumValueColor(featureName, label) : null;
const barStyle = overrideColor
? `rgb(${overrideColor[0]},${overrideColor[1]},${overrideColor[2]})`
: undefined;
const color = getEnumValueColor(featureName, label);
const barStyle = `rgb(${color[0]},${color[1]},${color[2]})`;
return (
<div key={label} className="flex items-center gap-2 text-xs">
@ -58,14 +56,10 @@ export default function EnumBarChart({
/>
)}
<div
className={
barStyle
? 'h-full rounded relative'
: 'h-full bg-teal-500 dark:bg-teal-400 rounded relative'
}
className="h-full rounded relative"
style={{
width: `${localWidth}%`,
...(barStyle ? { backgroundColor: barStyle } : {}),
backgroundColor: barStyle,
}}
/>
</div>