@@ -53,12 +53,13 @@ interface OrganizationMetrics {
5353 source_connection_count : number ;
5454 entity_count : number ;
5555 query_count : number ;
56+ last_active_at ?: string ;
5657 is_member : boolean ;
5758 member_role ?: string ;
5859 enabled_features ?: string [ ] ;
5960}
6061
61- type SortField = 'name' | 'created_at' | 'billing_plan' | 'user_count' | 'source_connection_count' | 'entity_count' | 'query_count' | 'is_member' ;
62+ type SortField = 'name' | 'created_at' | 'billing_plan' | 'user_count' | 'source_connection_count' | 'entity_count' | 'query_count' | 'last_active_at' | ' is_member';
6263type SortOrder = 'asc' | 'desc' ;
6364type MembershipFilter = 'all' | 'member' | 'non-member' ;
6465
@@ -169,7 +170,7 @@ export function AdminDashboard() {
169170 filtered = filtered . filter ( org => ! org . is_member ) ;
170171 }
171172
172- // Apply client-side sorting if sorting by membership
173+ // Apply client-side sorting if sorting by membership (not handled by backend)
173174 if ( sortField === 'is_member' ) {
174175 filtered = [ ...filtered ] . sort ( ( a , b ) => {
175176 const aValue = a . is_member ? 1 : 0 ;
@@ -471,10 +472,10 @@ export function AdminDashboard() {
471472 < CardHeader className = "pb-3" >
472473 < div className = "flex items-center justify-between" >
473474 < div >
474- < CardTitle > All Organizations</ CardTitle >
475- < CardDescription >
476- View and manage all organizations on the platform
477- </ CardDescription >
475+ < CardTitle > All Organizations</ CardTitle >
476+ < CardDescription >
477+ View and manage all organizations on the platform
478+ </ CardDescription >
478479 </ div >
479480 < div className = "flex items-center gap-2" >
480481 < Select value = { membershipFilter } onValueChange = { ( value : MembershipFilter ) => setMembershipFilter ( value ) } >
@@ -505,13 +506,13 @@ export function AdminDashboard() {
505506 ) : filteredOrganizations . length === 0 ? (
506507 < div className = "text-center py-12 text-muted-foreground" >
507508 { searchTerm ? 'No organizations match your search' :
508- membershipFilter !== 'all' ? `No ${ membershipFilter === 'member' ? 'member' : 'non-member' } organizations found` :
509- 'No organizations found' }
509+ membershipFilter !== 'all' ? `No ${ membershipFilter === 'member' ? 'member' : 'non-member' } organizations found` :
510+ 'No organizations found' }
510511 </ div >
511512 ) : (
512513 < div className = "border-t" >
513- < Table >
514- < TableHeader >
514+ < Table >
515+ < TableHeader >
515516 < TableRow className = "hover:bg-transparent" >
516517 < TableHead className = "w-[220px]" >
517518 < Button
@@ -590,6 +591,17 @@ export function AdminDashboard() {
590591 < ArrowUpDown className = "ml-2 h-3 w-3" />
591592 </ Button >
592593 </ TableHead >
594+ < TableHead className = "w-[130px]" >
595+ < Button
596+ variant = "ghost"
597+ size = "sm"
598+ className = "h-8 -ml-3"
599+ onClick = { ( ) => handleSort ( 'last_active_at' ) }
600+ >
601+ Last Active
602+ < ArrowUpDown className = "ml-2 h-3 w-3" />
603+ </ Button >
604+ </ TableHead >
593605 < TableHead className = "w-[130px]" >
594606 < Button
595607 variant = "ghost"
@@ -602,7 +614,7 @@ export function AdminDashboard() {
602614 </ Button >
603615 </ TableHead >
604616 < TableHead className = "text-right w-[200px]" > Actions</ TableHead >
605- </ TableRow >
617+ </ TableRow >
606618 </ TableHeader >
607619 < TableBody >
608620 { filteredOrganizations . map ( ( org ) => (
@@ -645,10 +657,13 @@ export function AdminDashboard() {
645657 </ TableCell >
646658 < TableCell className = "text-right py-2 font-mono text-sm" >
647659 { formatNumber ( org . query_count ) }
648- </ TableCell >
660+ </ TableCell >
649661 < TableCell className = "py-2 text-xs text-muted-foreground" >
650- { formatDate ( org . created_at ) }
651- </ TableCell >
662+ { org . last_active_at ? formatDate ( org . last_active_at ) : '—' }
663+ </ TableCell >
664+ < TableCell className = "py-2 text-xs text-muted-foreground" >
665+ { formatDate ( org . created_at ) }
666+ </ TableCell >
652667 < TableCell className = "text-right py-2" >
653668 < div className = "flex justify-end gap-1.5" >
654669 { org . is_member ? (
@@ -699,10 +714,10 @@ export function AdminDashboard() {
699714 </ Button >
700715 </ div >
701716 </ TableCell >
702- </ TableRow >
703- ) ) }
704- </ TableBody >
705- </ Table >
717+ </ TableRow >
718+ ) ) }
719+ </ TableBody >
720+ </ Table >
706721 </ div >
707722 ) }
708723 </ CardContent >
0 commit comments