Skip to content

Conversation

@codeunia-dev
Copy link
Owner

This PR introduces the initial version of the Company Dashboard, including a new user profile screen and improved access control. These updates help create a more structured, role-aware dashboard experience for company users.


✨ What’s New

1. Company Dashboard – User Profile Page

  • Added a dedicated Profile page inside the company dashboard.
  • Displays read-only user details fetched from the backend.
  • Ensures clean UI separation between global user settings and company-specific context.

2. Role-Based Access Control (RBAC)

  • Introduced a new role-based route protection hook (useProtectedRole).
  • Integrated the hook across company dashboard routes.
  • Prevents unauthorized users from accessing restricted pages.

🔧 Code Changes

  • 290 additions, 31 deletions across 5 files.
  • Includes new components, hooks, and routing updates required for the dashboard flow.

🧪 Testing

  • Verified access restrictions for:

    • Admin user
    • Company user
    • Normal user
  • Tested profile page rendering with valid session data.

  • Checked redirects for unauthorized roles.


📌 Notes

  • Future enhancements will include:

    • Editable profile fields
    • Company-level analytics
    • Dashboard navigation improvements

Authored by: @akshay0611

…tion display

- Create new company profile page at app/dashboard/company/[slug]/profile/page.tsx
- Display user personal information (name, email, phone) in read-only format
- Show company context and user role within the company
- Integrate CompanyContext to display current company and user role information
- Add profile loading state with spinner and error handling
- Include pending invitation redirect hook for access control
- Update CompanySidebar to include profile navigation link
- Display informational alert explaining read-only profile status
- Use consistent dark theme styling with zinc and purple accent colors
…ate into layouts

- Create useRoleProtection hook to enforce role-based access control for student and company member routes
- Integrate role protection into company dashboard layout to restrict access to company members only
- Integrate role protection into protected layout to restrict access to students only
- Add loading state handling during role verification to prevent premature redirects
- Redirect unauthorized users to appropriate dashboard based on their role (students to /protected, company members to /dashboard/company)
- Query company_members table to determine user role and authorization status
- Prevents role confusion and ensures users can only access routes appropriate for their account type
@vercel
Copy link

vercel bot commented Nov 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Ready Ready Preview Comment Nov 17, 2025 4:18am

@codeunia-dev codeunia-dev merged commit fd21917 into main Nov 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants