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 (

Rules in effect

Daily budget
{fmtDuration(rules.budget_seconds)}
{rules.carry_seconds > 0 && ( <>
Carried over
+{fmtDuration(rules.carry_seconds)} unspent from earlier free days
)}
Enforcement
{onOff(rules.enforcement)}
Counts launchers
{rules.counts_launchers ? 'yes' : 'no'}
Warnings at
{rules.warn_at.map((s) => fmtDuration(s)).join(', ')} remaining
{rules.demo && ( <>
Mode
demo (short budget, separate state)
)} {rules.masked_launchers.length > 0 && ( <>
Masked now
{rules.masked_launchers.join(', ')}
)}
) }