Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-17 00:34:22 +00:00
co-authored by renee-png
parent 6297c81d22
commit 94a71b580c
+4 -2
View File
@@ -66,6 +66,7 @@ interface UserRow {
email: string;
full_name: string;
created_at: string;
hourly_rate: number | null;
role: AppRole | null;
}
@@ -84,16 +85,17 @@ function UsersPage() {
const load = async () => {
setLoading(true);
const [{ data: profiles }, { data: rolesData }] = await Promise.all([
supabase.from("profiles").select("id, email, full_name, created_at"),
supabase.from("profiles").select("id, email, full_name, created_at, hourly_rate"),
supabase.from("user_roles").select("user_id, role"),
]);
const roleMap = new Map<string, AppRole>();
(rolesData ?? []).forEach((r) => roleMap.set(r.user_id, r.role as AppRole));
const rows: UserRow[] = (profiles ?? []).map((p) => ({
const rows: UserRow[] = (profiles ?? []).map((p: any) => ({
id: p.id,
email: p.email,
full_name: p.full_name,
created_at: p.created_at,
hourly_rate: p.hourly_rate,
role: roleMap.get(p.id) ?? null,
}));
rows.sort((a, b) => a.email.localeCompare(b.email));