feat: add roles management dashboard (frontend-only) - #38
Conversation
| }, | ||
| }) | ||
|
|
||
| const onSubmit = async (values: any) => { |
There was a problem hiding this comment.
using any type bypasses TypeScript type checking
| const onSubmit = async (values: any) => { | |
| const onSubmit = async (values: z.infer<typeof schema>) => { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/app/(main)/dashboard/roles/_components/EditRoleDialog.tsx
Line: 52
Comment:
using `any` type bypasses TypeScript type checking
```suggestion
const onSubmit = async (values: z.infer<typeof schema>) => {
```
How can I resolve this? If you propose a fix, please make it concise.| onClick={() => { | ||
| if ( | ||
| cell.column.id === "name" || | ||
| cell.column.id === "description" | ||
| ) { | ||
| onSelect(row.original) | ||
| } | ||
| }} |
There was a problem hiding this comment.
add cursor-pointer class to the <td> element when the column is clickable (name or description) to indicate interactivity
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/app/(main)/dashboard/roles/_components/RolesTable.tsx
Line: 87-94
Comment:
add `cursor-pointer` class to the `<td>` element when the column is clickable (name or description) to indicate interactivity
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
🚀 Role Management – Initial ImplementationThis PR introduces the first implementation of the Role Management module. Included
ScopeThis implementation is frontend-only and follows the project’s existing architecture and UI patterns. Ready for review. |
|
Looks good overall. Try improving the design though, it feels too plain right now. Add some creativity and stronger visual hierarchy. If possible, try using this interface design skill with whatever AI tool you’re using: https://www.ui-skills.com/skills/interface-design/. |
|
Hi! I improved the visual hierarchy by adding header structure and role stats to make the page less plain and more aligned with dashboard patterns. Let me know if you'd like any further adjustments 🙂 |
|
The skill change. This is the new https://www.ui-skills.com/skills/dammyjay93/interface-design |
Overview
This PR introduces a frontend-only Roles Management module under:
src/app/(main)/dashboard/roles/The implementation follows the existing colocation architecture and remains fully isolated from any RBAC or backend logic.
Features
crypto.randomUUID()Architecture Notes
@/lib/rbacBuild
Screenshot
Greptile Summary
This PR adds a fully frontend-only Roles Management module under
src/app/(main)/dashboard/roles/, activating the previously "coming soon" sidebar link. It introduces a TanStack Table-powered listing with pagination, dialog-based create/edit flows, system role protection, and a read-only permissions side panel — all wired through React state with no backend coupling.The implementation is well-structured and follows the project's colocation conventions. Previous review concerns (reserved-name validation,
crypto.randomUUID(), duplicate prevention,cursor-pointeron clickable cells) have all been addressed. Two minor improvements remain:columns.tsxrenders raw permission keys (e.g.users.read) as badge labels instead of the human-readable labels defined inpermissions.ts, creating a visible inconsistency with theRolePermissionsside panel which correctly maps them.useReactTableinRolesTable.tsxare recreated on every render without memoisation; wrapping inuseMemo(anduseCallbackfor the parent handlers) would align with TanStack Table's recommended pattern and avoid unnecessary re-processing.Confidence Score: 4/5
Important Files Changed
canManageis hard-coded totrue(intentional placeholder), and three leftover French emoji comments remain (already flagged in a prior review thread).crypto.randomUUID(), reserved-name validation, and duplicate-name prevention via Zod refine with memoised schema. Clean implementation.renderPermissionsrenders raw permission keys (e.g.users.read) instead of their human-readable labels frompermissions.ts, creating a UX inconsistency with theRolePermissionsside panel.isSystem: true./dashboard/rolesand removing thecomingSoonflag.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD Page["RolesPage\n(page.tsx)"] State["React State\nroles / selectedRole\neditingRole / isAddOpen"] Table["RolesTable\n(TanStack Table + pagination)"] Cols["getColumns\n(columns.tsx)"] Actions["RoleActions\n(Edit / Delete dropdown)"] AddDlg["AddRoleDialog\nZod validation\ncrypto.randomUUID()"] EditDlg["EditRoleDialog\nZod validation\nexclude-self duplicate check"] Perms["RolePermissions\nread-only side panel"] Data["_data/roles.ts\ndemoRoles seed"] Permsdata["_data/permissions.ts\npermission definitions"] Page --> State State --> Table State --> AddDlg State --> EditDlg State --> Perms Table --> Cols Cols --> Actions Actions -- "onEdit / onDelete" --> Page AddDlg -- "onConfirm(newRole)" --> State EditDlg -- "onConfirm(updatedRole)" --> State Table -- "onSelect(role)" --> State Data -- "initial seed" --> State Permsdata -- "label lookup" --> PermsPrompt To Fix All With AI
Reviews (7): Last reviewed commit: "refactor(roles): improve visual hierarch..." | Re-trigger Greptile