Restore Current Cycle Spend column on team members tab

Adds back the per-cycle spend column that was replaced by Total Spend in
331e3f22. Current Cycle Spend reads membership.spend (zeroed on
budget_reset_at) — this is the value enforced against the member's
budget, so admins need it to see whether a member is approaching their
cap for the active window. Total Spend remains for lifetime analytics.
This commit is contained in:
Ryan Crabbe 2026-04-22 17:33:41 -07:00
parent 5e5a94ac8d
commit a23edd73b1
No known key found for this signature in database

View File

@ -46,6 +46,12 @@ export default function TeamMemberTab({
return "0";
};
const getUserCurrentCycleSpend = (userId: string | null): number => {
if (!userId) return 0;
const membership = teamData.team_memberships.find((tm) => tm.user_id === userId);
return membership?.spend ?? 0;
};
const getUserTotalSpend = (userId: string | null): number => {
if (!userId) return 0;
const membership = teamData.team_memberships.find((tm) => tm.user_id === userId);
@ -127,11 +133,25 @@ export default function TeamMemberTab({
);
},
},
{
title: (
<Space direction="horizontal">
Current Cycle Spend (USD)
<Tooltip title="Spend for the current budget cycle. Resets to $0 when the member's budget window rolls over. This is the value checked against the member's budget.">
<InfoCircleOutlined />
</Tooltip>
</Space>
),
key: "spend",
render: (_: unknown, record: Member) => (
<Typography.Text>${formatNumberWithCommas(getUserCurrentCycleSpend(record.user_id), 4)}</Typography.Text>
),
},
{
title: (
<Space direction="horizontal">
Total Spend (USD)
<Tooltip title="Total spend by this member within this team. Tracking began 2026-04-21; spend from before that date is not included.">
<Tooltip title="Cumulative spend by this member within this team, across all budget cycles. Tracking began 2026-04-21; spend from before that date is not included.">
<InfoCircleOutlined />
</Tooltip>
</Space>