mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 18:28:15 +00:00
feat: 3-role auth, role-based routing, role-specific sidebar navigation
Add cc-agent role alongside executive and admin. Login page now has 3 tabs (Marketing Executive, Call Center, Admin). RoleRouter renders the appropriate home page per role. Sidebar shows completely different nav items per role with role subtitle. Placeholder pages added for Team Dashboard, Call Desk, Call History, and Follow-ups. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { createContext, useContext, useState } from 'react';
|
||||
|
||||
export type Role = 'executive' | 'admin';
|
||||
export type Role = 'executive' | 'admin' | 'cc-agent';
|
||||
|
||||
type User = {
|
||||
name: string;
|
||||
@@ -14,6 +14,7 @@ type AuthContextType = {
|
||||
user: User;
|
||||
setRole: (role: Role) => void;
|
||||
isAdmin: boolean;
|
||||
isCCAgent: boolean;
|
||||
isAuthenticated: boolean;
|
||||
login: () => void;
|
||||
logout: () => void;
|
||||
@@ -32,6 +33,12 @@ const USERS: Record<Role, User> = {
|
||||
role: 'executive',
|
||||
email: 'sanjay@ramaiah.com',
|
||||
},
|
||||
'cc-agent': {
|
||||
name: 'Rekha S.',
|
||||
initials: 'RS',
|
||||
role: 'cc-agent' as const,
|
||||
email: 'rekha@ramaiah.com',
|
||||
},
|
||||
};
|
||||
|
||||
const AuthContext = createContext<AuthContextType | undefined>(undefined);
|
||||
@@ -56,12 +63,13 @@ export const AuthProvider = ({ children }: AuthProviderProps) => {
|
||||
|
||||
const user = USERS[role];
|
||||
const isAdmin = role === 'admin';
|
||||
const isCCAgent = role === 'cc-agent';
|
||||
|
||||
const login = () => setIsAuthenticated(true);
|
||||
const logout = () => setIsAuthenticated(false);
|
||||
|
||||
return (
|
||||
<AuthContext.Provider value={{ user, setRole, isAdmin, isAuthenticated, login, logout }}>
|
||||
<AuthContext.Provider value={{ user, setRole, isAdmin, isCCAgent, isAuthenticated, login, logout }}>
|
||||
{children}
|
||||
</AuthContext.Provider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user