@@ -18,7 +18,9 @@ function matchesUser(user, search) {
1818}
1919
2020function formatPlanLabel ( plan ) {
21- const normalized = String ( plan || "free" ) . trim ( ) . toLowerCase ( ) ;
21+ const normalized = String ( plan || "free" )
22+ . trim ( )
23+ . toLowerCase ( ) ;
2224 if ( normalized === "selfhosted" ) return "Self-hosted" ;
2325 if ( ! normalized ) return "Free" ;
2426 return normalized . charAt ( 0 ) . toUpperCase ( ) + normalized . slice ( 1 ) ;
@@ -55,9 +57,7 @@ function describeDefaultAgentCap(user) {
5557 return "Leave blank to restore the admin default of unlimited." ;
5658 }
5759 if ( Number . isInteger ( user ?. base_agent_limit ) ) {
58- return `Leave blank to use the default cap of ${ formatCount (
59- user . base_agent_limit
60- ) } .`;
60+ return `Leave blank to use the default cap of ${ formatCount ( user . base_agent_limit ) } .` ;
6161 }
6262 return "Leave blank to use the default cap." ;
6363}
@@ -67,7 +67,7 @@ function buildLimitDrafts(users = []) {
6767 users . map ( ( user ) => [
6868 user . id ,
6969 user . agent_limit_override == null ? "" : String ( user . agent_limit_override ) ,
70- ] )
70+ ] ) ,
7171 ) ;
7272}
7373
@@ -121,9 +121,7 @@ export default function UsersPage() {
121121 }
122122
123123 setUsers ( ( current ) =>
124- current . map ( ( user ) =>
125- user . id === userId ? { ...user , role : payload . role } : user
126- )
124+ current . map ( ( user ) => ( user . id === userId ? { ...user , role : payload . role } : user ) ) ,
127125 ) ;
128126 toast . success ( "Role updated" ) ;
129127 } catch ( error ) {
@@ -138,9 +136,7 @@ export default function UsersPage() {
138136 async function deleteUser ( user ) {
139137 const label = user . email || user . id ;
140138 if (
141- ! window . confirm (
142- `Delete ${ label } ? This will remove the account and clean up owned agents.`
143- )
139+ ! window . confirm ( `Delete ${ label } ? This will remove the account and clean up owned agents.` )
144140 ) {
145141 return ;
146142 }
@@ -183,19 +179,12 @@ export default function UsersPage() {
183179 throw new Error ( payload . error || "Failed to update agent cap" ) ;
184180 }
185181
186- setUsers ( ( current ) =>
187- current . map ( ( entry ) => ( entry . id === user . id ? payload : entry ) )
188- ) ;
182+ setUsers ( ( current ) => current . map ( ( entry ) => ( entry . id === user . id ? payload : entry ) ) ) ;
189183 setLimitDrafts ( ( current ) => ( {
190184 ...current ,
191- [ user . id ] :
192- payload . agent_limit_override == null
193- ? ""
194- : String ( payload . agent_limit_override ) ,
185+ [ user . id ] : payload . agent_limit_override == null ? "" : String ( payload . agent_limit_override ) ,
195186 } ) ) ;
196- toast . success (
197- nextOverride == null ? "Agent cap override cleared" : "Agent cap updated"
198- ) ;
187+ toast . success ( nextOverride == null ? "Agent cap override cleared" : "Agent cap updated" ) ;
199188 } catch ( error ) {
200189 console . error ( "Failed to update agent cap:" , error ) ;
201190 toast . error ( error . message || "Failed to update agent cap" ) ;
@@ -231,10 +220,7 @@ export default function UsersPage() {
231220 return matchesUser ( user , deferredSearch ) ;
232221 } ) ;
233222
234- const totalAgentCount = users . reduce (
235- ( sum , user ) => sum + ( Number ( user . agentCount ) || 0 ) ,
236- 0
237- ) ;
223+ const totalAgentCount = users . reduce ( ( sum , user ) => sum + ( Number ( user . agentCount ) || 0 ) , 0 ) ;
238224
239225 return (
240226 < AdminLayout >
@@ -248,8 +234,8 @@ export default function UsersPage() {
248234 Accounts and roles
249235 </ h1 >
250236 < p className = "mt-2 max-w-2xl text-sm font-medium leading-relaxed text-slate-500" >
251- Search the user base, adjust admin privileges, and cleanly remove
252- accounts that own agent infrastructure.
237+ Search the user base, adjust admin privileges, and cleanly remove accounts that own
238+ agent infrastructure.
253239 </ p >
254240 </ div >
255241
@@ -360,32 +346,22 @@ export default function UsersPage() {
360346 const isLastAdmin = user . role === "admin" && adminCount <= 1 ;
361347 const limitDraft = String ( limitDrafts [ user . id ] || "" ) ;
362348 const currentLimitDraft =
363- user . agent_limit_override == null
364- ? ""
365- : String ( user . agent_limit_override ) ;
349+ user . agent_limit_override == null ? "" : String ( user . agent_limit_override ) ;
366350 const limitDraftDirty = limitDraft !== currentLimitDraft ;
367- const parsedLimitDraft =
368- limitDraft . trim ( ) === ""
369- ? null
370- : Number ( limitDraft ) ;
351+ const parsedLimitDraft = limitDraft . trim ( ) === "" ? null : Number ( limitDraft ) ;
371352 const canSaveLimit =
372353 limitDraftDirty &&
373354 limitDraft . trim ( ) !== "" &&
374355 Number . isSafeInteger ( parsedLimitDraft ) &&
375356 parsedLimitDraft >= 0 ;
376357 return (
377- < tr
378- key = { user . id }
379- className = "border-b border-slate-100 last:border-b-0"
380- >
358+ < tr key = { user . id } className = "border-b border-slate-100 last:border-b-0" >
381359 < td className = "px-2 py-4" >
382360 < div >
383361 < p className = "text-sm font-semibold text-slate-950" >
384362 { user . name || user . email }
385363 </ p >
386- < p className = "mt-1 text-xs text-slate-500" >
387- { user . email }
388- </ p >
364+ < p className = "mt-1 text-xs text-slate-500" > { user . email } </ p >
389365 < p className = "mt-1 text-[11px] font-semibold text-slate-400" >
390366 { user . id . slice ( 0 , 8 ) }
391367 </ p >
@@ -397,9 +373,7 @@ export default function UsersPage() {
397373 < select
398374 value = { user . role }
399375 disabled = { roleLoadingId === user . id || isLastAdmin }
400- onChange = { ( event ) =>
401- changeRole ( user . id , event . target . value )
402- }
376+ onChange = { ( event ) => changeRole ( user . id , event . target . value ) }
403377 className = "rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-semibold text-slate-700 outline-none transition-colors focus:border-red-200 focus:bg-white disabled:cursor-not-allowed disabled:opacity-60"
404378 >
405379 < option value = "user" > user</ option >
@@ -445,9 +419,7 @@ export default function UsersPage() {
445419 } ) )
446420 }
447421 placeholder = {
448- user . role === "admin"
449- ? "Unlimited default"
450- : "Use default"
422+ user . role === "admin" ? "Unlimited default" : "Use default"
451423 }
452424 className = "w-28 rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-semibold text-slate-700 outline-none transition-colors focus:border-red-200 focus:bg-white"
453425 />
0 commit comments