11import { useUISettings } from "@/app/(dashboard)/hooks/uiSettings/useUISettings" ;
22import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized" ;
33import { Member } from "@/components/networking" ;
4+ import { formatBudgetReset } from "@/utils/budgetUtils" ;
45import { formatNumberWithCommas } from "@/utils/dataUtils" ;
56import { isProxyAdminRole , isUserTeamAdminForSingleTeam } from "@/utils/roles" ;
67import { InfoCircleOutlined } from "@ant-design/icons" ;
@@ -45,11 +46,16 @@ export default function TeamMemberTab({
4546 return "0" ;
4647 } ;
4748
48- // Helper function to get spend for a user
49- const getUserSpend = ( userId : string | null ) : number | null => {
49+ const getUserCurrentCycleSpend = ( userId : string | null ) : number => {
5050 if ( ! userId ) return 0 ;
5151 const membership = teamData . team_memberships . find ( ( tm ) => tm . user_id === userId ) ;
52- return membership ?. spend || 0 ;
52+ return membership ?. spend ?? 0 ;
53+ } ;
54+
55+ const getUserTotalSpend = ( userId : string | null ) : number => {
56+ if ( ! userId ) return 0 ;
57+ const membership = teamData . team_memberships . find ( ( tm ) => tm . user_id === userId ) ;
58+ return membership ?. total_spend ?? 0 ;
5359 } ;
5460
5561 const getUserBudget = ( userId : string | null ) : string | null => {
@@ -89,6 +95,12 @@ export default function TeamMemberTab({
8995 return models && models . length > 0 ? models : null ;
9096 } ;
9197
98+ const getUserBudgetReset = ( userId : string | null ) : string | null => {
99+ if ( ! userId ) return null ;
100+ const membership = teamData . team_memberships . find ( ( tm ) => tm . user_id === userId ) ;
101+ return formatBudgetReset ( membership ?. litellm_budget_table ?. budget_reset_at ) ;
102+ } ;
103+
92104 const extraColumns : ColumnsType < Member > = [
93105 {
94106 title : (
@@ -124,15 +136,29 @@ export default function TeamMemberTab({
124136 {
125137 title : (
126138 < Space direction = "horizontal" >
127- Team Member Spend (USD)
128- < Tooltip title = "This is the amount spent by a user in the team ." >
139+ Current Cycle Spend (USD)
140+ < 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 ." >
129141 < InfoCircleOutlined />
130142 </ Tooltip >
131143 </ Space >
132144 ) ,
133145 key : "spend" ,
134146 render : ( _ : unknown , record : Member ) => (
135- < Typography . Text > ${ formatNumberWithCommas ( getUserSpend ( record . user_id ) , 4 ) } </ Typography . Text >
147+ < Typography . Text > ${ formatNumberWithCommas ( getUserCurrentCycleSpend ( record . user_id ) , 4 ) } </ Typography . Text >
148+ ) ,
149+ } ,
150+ {
151+ title : (
152+ < Space direction = "horizontal" >
153+ Total Spend (USD)
154+ < 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." >
155+ < InfoCircleOutlined />
156+ </ Tooltip >
157+ </ Space >
158+ ) ,
159+ key : "total_spend" ,
160+ render : ( _ : unknown , record : Member ) => (
161+ < Typography . Text > ${ formatNumberWithCommas ( getUserTotalSpend ( record . user_id ) , 4 ) } </ Typography . Text >
136162 ) ,
137163 } ,
138164 {
@@ -147,6 +173,18 @@ export default function TeamMemberTab({
147173 ) ;
148174 } ,
149175 } ,
176+ {
177+ title : "Budget Reset" ,
178+ key : "budget_reset" ,
179+ render : ( _ : unknown , record : Member ) => {
180+ const reset = getUserBudgetReset ( record . user_id ) ;
181+ return reset ? (
182+ < Typography . Text > { reset } </ Typography . Text >
183+ ) : (
184+ < Typography . Text type = "secondary" > —</ Typography . Text >
185+ ) ;
186+ } ,
187+ } ,
150188 {
151189 title : (
152190 < Space direction = "horizontal" >
0 commit comments