import re
with open('ui/components/AdminRolesPage.tsx', 'r') as f:
content = f.read()
roles_table_desktop_mobile = """ {/* Desktop Table View (≥ 768px) */}
| Role Identifier |
Scope |
Description |
Created |
Actions |
{roles.length === 0
? (
|
No roles found.
|
)
: (
roles.map((r) => {
const isGlobal = !r.app_id;
const isCoreAdmin = isGlobal && r.name === "admin";
return (
|
{r.name}
|
{isGlobal
? (
Global (Shared)
)
: (
{r.app_name || "App-Specific"}
)}
|
{r.description || "-"}
|
{new Date(r.created_at).toLocaleDateString()}
|
{!isCoreAdmin
? (
)
: (
Immutable System Role
)}
|
);
})
)}
{/* Mobile View (< 768px) */}
{roles.length === 0
? (
)
: (
roles.map((r) => {
const isGlobal = !r.app_id;
const isCoreAdmin = isGlobal && r.name === "admin";
return (
{r.name}
{isGlobal
? (
Global (Shared)
)
: (
{r.app_name || "App-Specific"}
)}
{r.description || "No description provided."}
Created: {new Date(r.created_at).toLocaleDateString()}
{!isCoreAdmin
? (
)
: (
Immutable System Role
)}
);
})
)}
"""
roles_table_replacement = """ {
const isGlobal = !r.app_id;
const isCoreAdmin = isGlobal && r.name === "admin";
return (
|
{r.name}
|
{isGlobal
? (
Global (Shared)
)
: (
{r.app_name || "App-Specific"}
)}
|
{r.description || "-"}
|
{new Date(r.created_at).toLocaleDateString()}
|
{!isCoreAdmin
? (
)
: (
Immutable System Role
)}
|
);
})}
mobileCards={roles.map((r) => {
const isGlobal = !r.app_id;
const isCoreAdmin = isGlobal && r.name === "admin";
return (
{r.name}
{isGlobal
? (
Global (Shared)
)
: (
{r.app_name || "App-Specific"}
)}
{r.description || "No description provided."}
Created: {new Date(r.created_at).toLocaleDateString()}
{!isCoreAdmin
? (
)
: (
Immutable System Role
)}
);
})}
/>"""
content = content.replace(roles_table_desktop_mobile, roles_table_replacement)
with open('ui/components/AdminRolesPage.tsx', 'w') as f:
f.write(content)
print("Replaced Roles table!")