steam-backlog-enforcer/web/src/components/BudgetRulesCard.tsx
Krzysztof kuhy Rudnicki 9586128163 Carry unspent Fri-Sun gaming time to the rest of the Fri-Mon block
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-02 21:07:49 +02:00

47 lines
1.3 KiB
TypeScript

import { fmtDuration } from '../format'
import type { BudgetRules } from '../types'
interface Props {
rules: BudgetRules
}
function onOff(value: boolean): string {
return value ? 'on' : 'off'
}
export function BudgetRulesCard({ rules }: Props) {
return (
<section className="budget-rules">
<h2>Rules in effect</h2>
<dl className="budget-rules-list">
<dt>Daily budget</dt>
<dd>{fmtDuration(rules.budget_seconds)}</dd>
{rules.carry_seconds > 0 && (
<>
<dt>Carried over</dt>
<dd>+{fmtDuration(rules.carry_seconds)} unspent from earlier free days</dd>
</>
)}
<dt>Enforcement</dt>
<dd>{onOff(rules.enforcement)}</dd>
<dt>Counts launchers</dt>
<dd>{rules.counts_launchers ? 'yes' : 'no'}</dd>
<dt>Warnings at</dt>
<dd>{rules.warn_at.map((s) => fmtDuration(s)).join(', ')} remaining</dd>
{rules.demo && (
<>
<dt>Mode</dt>
<dd>demo (short budget, separate state)</dd>
</>
)}
{rules.masked_launchers.length > 0 && (
<>
<dt>Masked now</dt>
<dd>{rules.masked_launchers.join(', ')}</dd>
</>
)}
</dl>
</section>
)
}