-
Notifications
You must be signed in to change notification settings - Fork 1
[Task] Cost Indicator + Mobile Cost Bar #13
Copy link
Copy link
Open
Labels
P2Core features, ship after P1Core features, ship after P1ai-shippableDelegatable to AI agents — clarity:4+ and risk:2 or lowerDelegatable to AI agents — clarity:4+ and risk:2 or lowerblast:1Single file — one view or one service, no ripple effectsSingle file — one view or one service, no ripple effectsclarity:5Crystal clear, full definition of done — just executeCrystal clear, full definition of done — just executeparallel:3Lane 3 work streamLane 3 work streamrisk:1Isolated change, well-tested area, hard to breakIsolated change, well-tested area, hard to breakseq:02Sequence step 2Sequence step 2size:SStraightforward, few filesStraightforward, few filestype:featureNew functionality or capabilityNew functionality or capability
Description
Activity
Metadata
Metadata
Assignees
Labels
P2Core features, ship after P1Core features, ship after P1ai-shippableDelegatable to AI agents — clarity:4+ and risk:2 or lowerDelegatable to AI agents — clarity:4+ and risk:2 or lowerblast:1Single file — one view or one service, no ripple effectsSingle file — one view or one service, no ripple effectsclarity:5Crystal clear, full definition of done — just executeCrystal clear, full definition of done — just executeparallel:3Lane 3 work streamLane 3 work streamrisk:1Isolated change, well-tested area, hard to breakIsolated change, well-tested area, hard to breakseq:02Sequence step 2Sequence step 2size:SStraightforward, few filesStraightforward, few filestype:featureNew functionality or capabilityNew functionality or capability
Context
Part of #8 (Web Components Migration).
Cost visualisation — shows estimated relative cost as a fill bar with dollar signs, plus a per-slider breakdown. Mobile gets a sticky bottom bar with the same info.
Scope
Create:
src/components/tb-cost-indicator.js—<tb-cost-indicator>cost bar + breakdownsrc/components/tb-mobile-cost-bar.js—<tb-mobile-cost-bar>sticky bottom barRead (reference only):
index.htmllines 1822-1849 (ui.costIndicator())index.htmllines 1937-1977 (renderCostIndicator())index.htmlCSS for.cost-indicator,.cost-bar-bg,.cost-bar-fill,.cost-breakdown,.cost-row,.mobile-cost-barCurrent State
ui.costIndicator()builds a card with header (title + dollar label), fill bar, and per-slider breakdown rows.renderCostIndicator()callscomputeCost(state)for the 0-1 ratio, maps to color + dollar text, updates fill width + breakdown percentages. Mobile bar mirrors the main cost bar.Target State
<tb-cost-indicator>: Shadow DOM. Acceptscost(0-1 ratio) andbreakdown(array of{id, pct, intensity}) as properties. Renders cost bar, dollar label, color-coded fill, and breakdown rows. Pure display — no store subscription (parent pushes data).<tb-mobile-cost-bar>: Shadow DOM. Acceptscost(0-1 ratio) property. Fixed bottom positioning. Shows fill bar + dollar signs. Hidden on desktop via CSS media query.Implementation Hints
data.jsfor row labels<tb-slider-panel>or as a siblingDependencies
computeCost(),computeCostBreakdown())COST_LABELS) + style sheetsDefinition of Done
<tb-cost-indicator>renders fill bar with correct width/color for given cost ratio<tb-mobile-cost-bar>renders fixed bottom bar on mobile viewportsVerification
cost = 0.7on<tb-cost-indicator>— verify orange fill at 70%, "$$$$" labelcost = 0.1— verify green fill, "$" label<tb-mobile-cost-bar>appears