Added Role column to user directory

This commit is contained in:
2026-09-28 10:58:02 +02:00
parent 8eae097e8b
commit ef13117042
4 changed files with 153 additions and 8 deletions
@@ -1,6 +1,11 @@
import React from 'react';
import { ApprovalStatus, Priority, ActivityStatus } from '../../types';
import { getApprovalStatusBadge, getPriorityBadge, getActivityStatusBadge } from '../../lib/formatters';
import { ApprovalStatus, Priority, ActivityStatus, UserRole } from '../../types';
import {
getApprovalStatusBadge,
getPriorityBadge,
getActivityStatusBadge,
getUserRoleBadge,
} from '../../lib/formatters';
export const ApprovalStatusBadge: React.FC<{ status: ApprovalStatus | number | null | undefined }> = ({ status }) => {
const badge = getApprovalStatusBadge(status ?? ApprovalStatus.Pending);
@@ -29,3 +34,18 @@ export const ActivityStatusBadge: React.FC<{ status: ActivityStatus | number | s
</span>
);
};
export const UserRoleBadge: React.FC<{ role: string | number | UserRole | null | undefined; className?: string }> = ({
role,
className = '',
}) => {
const badge = getUserRoleBadge(role);
return (
<span
className={`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-[11px] font-medium border whitespace-nowrap ${badge.className} ${className}`}
>
{badge.dot && <span className={`w-1.5 h-1.5 rounded-full shrink-0 ${badge.dot}`} />}
<span>{badge.label}</span>
</span>
);
};