mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 15:11:12 -05:00
feat: Implement submission workflow tracking
This commit is contained in:
@@ -41,7 +41,8 @@ import {
|
||||
ReviewModerationDetails,
|
||||
PhotoApprovalDetails,
|
||||
AccountLifecycleDetails,
|
||||
ReviewLifecycleDetails
|
||||
ReviewLifecycleDetails,
|
||||
SubmissionWorkflowDetails
|
||||
} from '@/lib/systemActivityService';
|
||||
|
||||
export interface SystemActivityLogRef {
|
||||
@@ -138,6 +139,30 @@ const activityTypeConfig = {
|
||||
bgColor: 'bg-red-600/10',
|
||||
label: 'Review Deleted',
|
||||
},
|
||||
submission_created: {
|
||||
icon: Plus,
|
||||
color: 'text-blue-500',
|
||||
bgColor: 'bg-blue-500/10',
|
||||
label: 'Submission Created',
|
||||
},
|
||||
submission_claimed: {
|
||||
icon: UserCog,
|
||||
color: 'text-indigo-500',
|
||||
bgColor: 'bg-indigo-500/10',
|
||||
label: 'Submission Claimed',
|
||||
},
|
||||
submission_escalated: {
|
||||
icon: AlertTriangle,
|
||||
color: 'text-orange-600',
|
||||
bgColor: 'bg-orange-600/10',
|
||||
label: 'Submission Escalated',
|
||||
},
|
||||
submission_reassigned: {
|
||||
icon: History,
|
||||
color: 'text-purple-600',
|
||||
bgColor: 'bg-purple-600/10',
|
||||
label: 'Submission Reassigned',
|
||||
},
|
||||
};
|
||||
|
||||
export const SystemActivityLog = forwardRef<SystemActivityLogRef, SystemActivityLogProps>(
|
||||
@@ -565,6 +590,92 @@ export const SystemActivityLog = forwardRef<SystemActivityLogRef, SystemActivity
|
||||
);
|
||||
}
|
||||
|
||||
case 'submission_created': {
|
||||
const details = activity.details as SubmissionWorkflowDetails;
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm flex-wrap">
|
||||
<Badge className="bg-blue-500/10 text-blue-500">New Submission</Badge>
|
||||
<span className="text-muted-foreground capitalize">{details.submission_type.replace(/_/g, ' ')}</span>
|
||||
{details.username && (
|
||||
<span className="font-medium">by @{details.username}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
case 'submission_claimed': {
|
||||
const details = activity.details as SubmissionWorkflowDetails;
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm flex-wrap">
|
||||
<Badge className="bg-indigo-500/10 text-indigo-500">Claimed</Badge>
|
||||
<span className="text-muted-foreground capitalize">{details.submission_type.replace(/_/g, ' ')}</span>
|
||||
{details.username && (
|
||||
<span className="text-muted-foreground">by @{details.username}</span>
|
||||
)}
|
||||
</div>
|
||||
{isExpanded && details.assigned_username && (
|
||||
<div className="flex items-center gap-2 p-2 bg-muted rounded text-sm">
|
||||
<UserCog className="h-4 w-4 text-muted-foreground" />
|
||||
<span className="text-muted-foreground">
|
||||
Assigned to <strong>@{details.assigned_username}</strong>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
case 'submission_escalated': {
|
||||
const details = activity.details as SubmissionWorkflowDetails;
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm flex-wrap">
|
||||
<Badge className="bg-orange-600/10 text-orange-600">Escalated</Badge>
|
||||
<span className="text-muted-foreground capitalize">{details.submission_type.replace(/_/g, ' ')}</span>
|
||||
</div>
|
||||
{isExpanded && details.escalation_reason && (
|
||||
<div className="flex items-start gap-2 p-2 bg-orange-500/5 rounded text-sm">
|
||||
<AlertTriangle className="h-4 w-4 mt-0.5 flex-shrink-0 text-orange-600" />
|
||||
<span className="text-muted-foreground">
|
||||
<strong>Reason:</strong> {details.escalation_reason}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
case 'submission_reassigned': {
|
||||
const details = activity.details as SubmissionWorkflowDetails;
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm flex-wrap">
|
||||
<Badge className="bg-purple-600/10 text-purple-600">Reassigned</Badge>
|
||||
<span className="text-muted-foreground capitalize">{details.submission_type.replace(/_/g, ' ')}</span>
|
||||
</div>
|
||||
{isExpanded && (details.from_moderator_username || details.to_moderator_username) && (
|
||||
<div className="flex items-center gap-2 p-2 bg-muted rounded text-sm">
|
||||
<History className="h-4 w-4 text-muted-foreground" />
|
||||
<span className="text-muted-foreground">
|
||||
{details.from_moderator_username && details.to_moderator_username ? (
|
||||
<>
|
||||
From <strong>@{details.from_moderator_username}</strong> to <strong>@{details.to_moderator_username}</strong>
|
||||
</>
|
||||
) : details.to_moderator_username ? (
|
||||
<>
|
||||
To <strong>@{details.to_moderator_username}</strong>
|
||||
</>
|
||||
) : null}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user