Skip to content

Commit cce132d

Browse files
wadekargclaude
andcommitted
Fix stochastic policy widget: use static Tailwind classes for action colors
Dynamic class interpolation (bg-${color}/30) prevented Tailwind JIT from including up/down/left action colors in the build. Replace with static class arrays so all four direction colors render correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ae4f86e commit cce132d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/pages/learn/PoliciesPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ function StochasticPolicyWidget() {
145145
const actions = ['Up', 'Down', 'Left', 'Right']
146146
const arrows = ['\u2191', '\u2193', '\u2190', '\u2192']
147147
const colors = ['accent-blue', 'accent-red', 'accent-yellow', 'accent-green']
148+
const barClasses = ['bg-accent-blue/30', 'bg-accent-red/30', 'bg-accent-yellow/30', 'bg-accent-green/30']
149+
const badgeBgClasses = ['bg-accent-blue/20', 'bg-accent-red/20', 'bg-accent-yellow/20', 'bg-accent-green/20']
150+
const badgeTextClasses = ['text-accent-blue', 'text-accent-red', 'text-accent-yellow', 'text-accent-green']
148151

149152
const [samples, setSamples] = useState<number[]>([])
150153

@@ -204,7 +207,7 @@ function StochasticPolicyWidget() {
204207
{/* Bar */}
205208
<div className="w-full h-20 bg-surface-light rounded-lg flex items-end justify-center mb-1 relative">
206209
<div
207-
className={`w-full rounded-lg bg-${colors[i]}/30 transition-all duration-200`}
210+
className={`w-full rounded-lg ${barClasses[i]} transition-all duration-200`}
208211
style={{ height: `${maxProb > 0 ? (p / maxProb) * 100 : 0}%`, minHeight: p > 0 ? 4 : 0 }}
209212
/>
210213
<span className="absolute top-1 text-xs font-bold text-text">{arrows[i]}</span>
@@ -251,7 +254,7 @@ function StochasticPolicyWidget() {
251254
<span className="text-xs text-text-muted">Sampled actions: </span>
252255
<div className="flex gap-1 flex-wrap mt-1">
253256
{samples.map((s, i) => (
254-
<span key={i} className={`text-sm px-1.5 py-0.5 rounded bg-${colors[s]}/20 text-${colors[s]}`}>
257+
<span key={i} className={`text-sm px-1.5 py-0.5 rounded ${badgeBgClasses[s]} ${badgeTextClasses[s]}`}>
255258
{arrows[s]}
256259
</span>
257260
))}

0 commit comments

Comments
 (0)