diff --git a/app/main.py b/app/main.py index b9f0956..cea4491 100644 --- a/app/main.py +++ b/app/main.py @@ -271,6 +271,8 @@ PAGE_HTML = """ .pill.inactive { background: #f6e9e5; color: var(--danger); } .pill.manual { background: #f1e8da; color: #a97a4a; } .pill.org { background: #e7edf5; color: #4a6a8a; } + .pill.grace { background: #fdf3e3; color: #a97a2a; } + .state-reason { color: var(--muted); font-size: 11px; margin-top: 2px; } /* Trends tab (charts). Colours come from the same vars as the rest of the panel; the SVG is inline so there is no chart library and no CDN. */ .trend-controls { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 0; } @@ -749,7 +751,19 @@ function renderMembers() { }); $('rows').innerHTML = rows.map(m => { const reset = m.reset_at ? m.reset_at.slice(0,10) : '—'; - const pill = m.active ? 'active' : 'inactive'; + // Membership state is computed by the PORTAL (the source of truth) and + // carried on the overview row — the panel only renders it. Non-active + // states (in grace / awaiting contribution) still keep the member's access; + // the reason is shown beneath the pill. + const state = m.state || (m.active ? 'active' : 'inactive'); + const stateLabel = { active: 'active', in_grace: 'in grace', + awaiting_contribution: 'awaiting', inactive: 'inactive' }[state] || state; + const stateClass = state === 'active' ? 'active' : (state === 'inactive' ? 'inactive' : 'grace'); + const stateReason = m.state_reason || ''; + const statusCell = '' + + esc(stateLabel) + '' + + (stateReason && state !== 'active' + ? '