diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 7b51e5c1..fda3c2c4 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -38,7 +38,11 @@ export default function AdminPanel() { const [roleFilter, setRoleFilter] = useState("All"); const [isAdmin, setIsAdmin] = useState(false); const [editingProfile, setEditingProfile] = useState<{ - [key: string]: { assigned_agent_address: string; account_index: string }; + [key: string]: { + assigned_agent_address: string; + account_index: string; + role: UserRole; + }; }>({}); const [sortOrder, setSortOrder] = useState(null); @@ -89,9 +93,10 @@ export default function AdminPanel() { acc[profile.id] = { assigned_agent_address: profile.assigned_agent_address || "", account_index: profile.account_index?.toString() || "", + role: profile.role, }; return acc; - }, {} as { [key: string]: { assigned_agent_address: string; account_index: string } }); + }, {} as { [key: string]: { assigned_agent_address: string; account_index: string; role: UserRole } }); setEditingProfile(initialEditingState); } } catch (error) { @@ -117,6 +122,7 @@ export default function AdminPanel() { editingProfile[userId].account_index === "" ? 0 : parseInt(editingProfile[userId].account_index, 10), + role: editingProfile[userId].role, }; const { error } = await supabase .from("profiles") @@ -133,7 +139,7 @@ export default function AdminPanel() { const handleInputChange = ( userId: string, - field: "assigned_agent_address" | "account_index", + field: "assigned_agent_address" | "account_index" | "role", value: string ) => { setEditingProfile((prev) => ({ @@ -269,7 +275,7 @@ export default function AdminPanel() { ({getSortText()}) - Stack Address + Stacks Addresses Role Agent Address Actions @@ -298,8 +304,14 @@ export default function AdminPanel() {