feat: add CEO role to all dropdowns and access lists
This commit is contained in:
@@ -8,7 +8,7 @@ export function DashboardPage({ tasks, currentUser, users }: { tasks: Task[]; cu
|
|||||||
const overdue = tasks.filter(t => new Date(t.dueDate + 'T00:00:00') < new Date() && t.status !== 'done').length;
|
const overdue = tasks.filter(t => new Date(t.dueDate + 'T00:00:00') < new Date() && t.status !== 'done').length;
|
||||||
const critical = tasks.filter(t => t.priority === 'critical' && t.status !== 'done').length;
|
const critical = tasks.filter(t => t.priority === 'critical' && t.status !== 'done').length;
|
||||||
|
|
||||||
const isLeader = ['cto', 'manager', 'tech_lead', 'scrum_master', 'product_owner'].includes(currentUser.role);
|
const isLeader = ['ceo', 'cto', 'manager', 'tech_lead', 'scrum_master', 'product_owner'].includes(currentUser.role);
|
||||||
const myTasks = tasks.filter(t => t.assignee === currentUser.id);
|
const myTasks = tasks.filter(t => t.assignee === currentUser.id);
|
||||||
const myDone = myTasks.filter(t => t.status === 'done').length;
|
const myDone = myTasks.filter(t => t.status === 'done').length;
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export function LoginPage({ onLogin }: { onLogin: (u: User) => void }) {
|
|||||||
<option value="qa">QA Engineer</option>
|
<option value="qa">QA Engineer</option>
|
||||||
<option value="manager">Manager</option>
|
<option value="manager">Manager</option>
|
||||||
<option value="cto">CTO</option>
|
<option value="cto">CTO</option>
|
||||||
|
<option value="ceo">CEO</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<label className="login-label" htmlFor="register-dept">Department</label>
|
<label className="login-label" htmlFor="register-dept">Department</label>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export function MembersPage({ tasks, users }: { tasks: Task[]; users: User[] })
|
|||||||
const ut = tasks.filter(t => t.assignee === u.id);
|
const ut = tasks.filter(t => t.assignee === u.id);
|
||||||
const done = ut.filter(t => t.status === 'done').length;
|
const done = ut.filter(t => t.status === 'done').length;
|
||||||
const active = ut.filter(t => t.status !== 'done').length;
|
const active = ut.filter(t => t.status !== 'done').length;
|
||||||
const roleColors: Record<string, string> = { cto: '#818cf8', manager: '#fb923c', tech_lead: '#06b6d4', scrum_master: '#a855f7', product_owner: '#ec4899', designer: '#f43f5e', qa: '#14b8a6', employee: '#22c55e' };
|
const roleColors: Record<string, string> = { ceo: '#eab308', cto: '#818cf8', manager: '#fb923c', tech_lead: '#06b6d4', scrum_master: '#a855f7', product_owner: '#ec4899', designer: '#f43f5e', qa: '#14b8a6', employee: '#22c55e' };
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={u.id}>
|
<React.Fragment key={u.id}>
|
||||||
<tr onClick={() => setExpanded(expanded === u.id ? null : u.id)}>
|
<tr onClick={() => setExpanded(expanded === u.id ? null : u.id)}>
|
||||||
@@ -99,7 +99,7 @@ export function MembersPage({ tasks, users }: { tasks: Task[]; users: User[] })
|
|||||||
<div className="modal-field"><label>Email</label><input className="modal-input" placeholder="member@company.io" /></div>
|
<div className="modal-field"><label>Email</label><input className="modal-input" placeholder="member@company.io" /></div>
|
||||||
<div className="modal-field">
|
<div className="modal-field">
|
||||||
<label>Role</label>
|
<label>Role</label>
|
||||||
<select className="modal-input"><option value="employee">Employee</option><option value="tech_lead">Tech Lead</option><option value="scrum_master">Scrum Master</option><option value="product_owner">Product Owner</option><option value="designer">Designer</option><option value="qa">QA Engineer</option><option value="manager">Manager</option></select>
|
<select className="modal-input"><option value="employee">Employee</option><option value="tech_lead">Tech Lead</option><option value="scrum_master">Scrum Master</option><option value="product_owner">Product Owner</option><option value="designer">Designer</option><option value="qa">QA Engineer</option><option value="manager">Manager</option><option value="cto">CTO</option><option value="ceo">CEO</option></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-footer"><button className="btn-ghost" onClick={() => setShowInvite(false)}>Cancel</button><button className="btn-primary" onClick={() => setShowInvite(false)}>Send Invite</button></div>
|
<div className="modal-footer"><button className="btn-ghost" onClick={() => setShowInvite(false)}>Cancel</button><button className="btn-primary" onClick={() => setShowInvite(false)}>Send Invite</button></div>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export function ProgressBar({ subtasks }: { subtasks: Subtask[] }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function RoleBadge({ role }: { role: string }) {
|
export function RoleBadge({ role }: { role: string }) {
|
||||||
const colors: Record<string, string> = { cto: '#818cf8', manager: '#fb923c', tech_lead: '#06b6d4', scrum_master: '#a855f7', product_owner: '#ec4899', designer: '#f43f5e', qa: '#14b8a6', employee: '#22c55e' };
|
const colors: Record<string, string> = { ceo: '#eab308', cto: '#818cf8', manager: '#fb923c', tech_lead: '#06b6d4', scrum_master: '#a855f7', product_owner: '#ec4899', designer: '#f43f5e', qa: '#14b8a6', employee: '#22c55e' };
|
||||||
const c = colors[role] || '#64748b';
|
const c = colors[role] || '#64748b';
|
||||||
return <span className="role-badge" style={{ background: `${c}22`, color: c }}>{role.toUpperCase()}</span>;
|
return <span className="role-badge" style={{ background: `${c}22`, color: c }}>{role.toUpperCase()}</span>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import type { User } from './data';
|
|||||||
import { Avatar } from './Shared';
|
import { Avatar } from './Shared';
|
||||||
import { RoleBadge } from './Shared';
|
import { RoleBadge } from './Shared';
|
||||||
|
|
||||||
const ALL_ROLES = ['cto', 'manager', 'tech_lead', 'scrum_master', 'product_owner', 'employee', 'designer', 'qa'];
|
const ALL_ROLES = ['ceo', 'cto', 'manager', 'tech_lead', 'scrum_master', 'product_owner', 'employee', 'designer', 'qa'];
|
||||||
const LEADER_ROLES = ['cto', 'manager', 'tech_lead', 'scrum_master', 'product_owner'];
|
const LEADER_ROLES = ['ceo', 'cto', 'manager', 'tech_lead', 'scrum_master', 'product_owner'];
|
||||||
|
|
||||||
const NAV_ITEMS = [
|
const NAV_ITEMS = [
|
||||||
{ id: 'dashboard', icon: '⊞', label: 'Dashboard', roles: ALL_ROLES },
|
{ id: 'dashboard', icon: '⊞', label: 'Dashboard', roles: ALL_ROLES },
|
||||||
@@ -12,7 +12,7 @@ const NAV_ITEMS = [
|
|||||||
{ id: 'mytasks', icon: '✓', label: 'My Tasks', roles: ['employee', 'designer', 'qa'] },
|
{ id: 'mytasks', icon: '✓', label: 'My Tasks', roles: ['employee', 'designer', 'qa'] },
|
||||||
{ id: 'teamtasks', icon: '👥', label: 'Team Tasks', roles: LEADER_ROLES },
|
{ id: 'teamtasks', icon: '👥', label: 'Team Tasks', roles: LEADER_ROLES },
|
||||||
{ id: 'reports', icon: '📊', label: 'Reports', roles: LEADER_ROLES },
|
{ id: 'reports', icon: '📊', label: 'Reports', roles: LEADER_ROLES },
|
||||||
{ id: 'members', icon: '👤', label: 'Members', roles: ['cto'] },
|
{ id: 'members', icon: '👤', label: 'Members', roles: ['ceo', 'cto'] },
|
||||||
];
|
];
|
||||||
|
|
||||||
interface SidebarProps {
|
interface SidebarProps {
|
||||||
|
|||||||
Reference in New Issue
Block a user