feat: Show moderator edits on creation submissions

This commit is contained in:
gpt-engineer-app[bot]
2025-10-13 19:01:35 +00:00
parent 52b091fbb1
commit 1a60e4b97c

View File

@@ -210,9 +210,51 @@ export function SubmissionChangesDisplay({
</div>
{changes.action === 'create' && (
<div className="text-sm text-muted-foreground">
Creating new {item.item_type}
</div>
<>
{/* Show if moderator edited the creation */}
{item.original_data && Object.keys(item.original_data).length > 0 ? (
<>
<div className="rounded-md bg-blue-50 dark:bg-blue-950 border border-blue-200 dark:border-blue-800 p-3 mb-2">
<div className="flex items-center gap-2 text-sm font-medium text-blue-700 dark:text-blue-300 mb-2">
<Edit className="h-4 w-4" />
Moderator Edits Applied
</div>
<div className="text-xs text-blue-600 dark:text-blue-400">
This creation was modified by a moderator before review. Changed fields are highlighted below.
</div>
</div>
{changes.fieldChanges.length > 0 && (
<div className="flex flex-col gap-2">
<h4 className="text-sm font-medium">Creation Data (with moderator edits highlighted)</h4>
<div className="grid gap-2">
{changes.fieldChanges.map((change, idx) => {
// Highlight fields that were modified (not just added)
const wasEditedByModerator = change.changeType === 'modified' &&
item.original_data &&
item.original_data[change.field] !== undefined;
return (
<div key={idx} className={wasEditedByModerator ? 'border-l-4 border-blue-500 pl-3 bg-blue-50/50 dark:bg-blue-950/30 rounded' : ''}>
<FieldDiff change={change} />
{wasEditedByModerator && (
<div className="text-xs text-blue-600 dark:text-blue-400 mt-1 font-medium">
Modified by moderator
</div>
)}
</div>
);
})}
</div>
</div>
)}
</>
) : (
<div className="text-sm text-muted-foreground">
Creating new {item.item_type}
</div>
)}
</>
)}
{changes.action === 'delete' && (
@@ -221,7 +263,7 @@ export function SubmissionChangesDisplay({
</div>
)}
{(changes.action === 'create' || changes.action === 'edit') && changes.totalChanges > 0 && (
{changes.action === 'edit' && changes.totalChanges > 0 && (
<>
{changes.fieldChanges.length > 0 && (
<div className="flex flex-col gap-2">