Refactor content status terminology and enhance cluster serializers with idea and content counts

This commit is contained in:
Desktop
2025-11-11 18:51:32 +05:00
parent b321c99089
commit a7880c3818
10 changed files with 118 additions and 39 deletions

View File

@@ -93,8 +93,6 @@ export const bulkActionModalConfigs: Record<string, BulkActionModalConfig> = {
itemNamePlural: 'tasks',
statusOptions: [
{ value: 'queued', label: 'Queued' },
{ value: 'draft', label: 'Draft' },
{ value: 'in_progress', label: 'In Progress' },
{ value: 'completed', label: 'Completed' },
],
},
@@ -114,7 +112,7 @@ export const bulkActionModalConfigs: Record<string, BulkActionModalConfig> = {
statusOptions: [
{ value: 'draft', label: 'Draft' },
{ value: 'review', label: 'Review' },
{ value: 'published', label: 'Published' },
{ value: 'publish', label: 'Publish' },
],
},
},
@@ -131,8 +129,9 @@ export const bulkActionModalConfigs: Record<string, BulkActionModalConfig> = {
confirmText: 'Update Status',
itemNamePlural: 'published content items',
statusOptions: [
{ value: 'published', label: 'Published' },
{ value: 'archived', label: 'Archived' },
{ value: 'publish', label: 'Publish' },
{ value: 'review', label: 'Review' },
{ value: 'draft', label: 'Draft' },
],
},
},

View File

@@ -120,6 +120,13 @@ export const createClustersPageConfig = (
width: '120px',
render: (value: number) => value.toLocaleString(),
},
{
key: 'ideas_count',
label: 'Ideas',
sortable: false,
width: '120px',
render: (value: number) => value.toLocaleString(),
},
{
key: 'volume',
label: 'Volume',
@@ -170,8 +177,8 @@ export const createClustersPageConfig = (
},
},
{
key: 'mapped_pages',
label: 'Mapped Pages',
key: 'content_count',
label: 'Content',
sortable: false,
width: '120px',
render: (value: number) => value.toLocaleString(),

View File

@@ -148,20 +148,18 @@ export const createTasksPageConfig = (
sortable: true,
sortField: 'status',
render: (value: string) => {
const statusColors: Record<string, 'success' | 'warning' | 'error' | 'info'> = {
'queued': 'warning',
'in_progress': 'info',
'draft': 'warning',
'review': 'info',
'published': 'success',
'completed': 'success',
const statusColors: Record<string, 'success' | 'warning'> = {
queued: 'warning',
completed: 'success',
};
const label = value ? value.replace('_', ' ') : '';
const formatted = label ? label.charAt(0).toUpperCase() + label.slice(1) : '';
return (
<Badge
color={statusColors[value] || 'warning'}
size="sm"
>
{value?.replace('_', ' ') || value}
{formatted}
</Badge>
);
},
@@ -193,10 +191,6 @@ export const createTasksPageConfig = (
options: [
{ value: '', label: 'All Status' },
{ value: 'queued', label: 'Queued' },
{ value: 'in_progress', label: 'In Progress' },
{ value: 'draft', label: 'Draft' },
{ value: 'review', label: 'Review' },
{ value: 'published', label: 'Published' },
{ value: 'completed', label: 'Completed' },
],
},
@@ -318,10 +312,6 @@ export const createTasksPageConfig = (
handlers.setFormData({ ...handlers.formData, status: value }),
options: [
{ value: 'queued', label: 'Queued' },
{ value: 'in_progress', label: 'In Progress' },
{ value: 'draft', label: 'Draft' },
{ value: 'review', label: 'Review' },
{ value: 'published', label: 'Published' },
{ value: 'completed', label: 'Completed' },
],
},
@@ -340,16 +330,10 @@ export const createTasksPageConfig = (
calculate: (data) => data.tasks.filter((t: Task) => t.status === 'queued').length,
},
{
label: 'In Progress',
value: 0,
accentColor: 'blue' as const,
calculate: (data) => data.tasks.filter((t: Task) => t.status === 'in_progress').length,
},
{
label: 'Published',
label: 'Completed',
value: 0,
accentColor: 'green' as const,
calculate: (data) => data.tasks.filter((t: Task) => t.status === 'published').length,
calculate: (data) => data.tasks.filter((t: Task) => t.status === 'completed').length,
},
],
};

View File

@@ -8,7 +8,7 @@ import HTMLContentRenderer from '../../components/common/HTMLContentRenderer';
const statusColors: Record<string, 'warning' | 'info' | 'success' | 'primary'> = {
draft: 'warning',
review: 'info',
published: 'success',
publish: 'success',
};
export default function Content() {
@@ -176,7 +176,7 @@ export default function Content() {
size="sm"
variant="light"
>
{item.status?.replace('_', ' ') || 'draft'}
{(item.status || 'draft').replace('_', ' ').replace(/^\w/, (c) => c.toUpperCase())}
</Badge>
</td>
<td className="px-5 py-4 align-top text-gray-600 dark:text-gray-400">

View File

@@ -477,6 +477,8 @@ export interface Cluster {
volume: number;
difficulty: number; // Average difficulty of keywords in cluster
mapped_pages: number;
ideas_count: number;
content_count: number;
status: string;
sector_name?: string | null; // Optional: populated by serializer
created_at: string;