Add new fields to TasksSerializer and enhance auto_generate_content_task with detailed step tracking

- Updated TasksSerializer to include 'primary_keyword', 'secondary_keywords', 'tags', and 'categories'.
- Enhanced auto_generate_content_task to track progress with detailed steps, including initialization, preparation, AI call, parsing, and saving.
- Updated progress modal to reflect new phases and improved animation for smoother user experience.
- Adjusted routing and configuration for content and drafts pages in the frontend.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-10 13:17:48 +00:00
parent b1d86cd4b8
commit 8bb4c5d016
14 changed files with 247 additions and 47 deletions

View File

@@ -99,7 +99,7 @@ export const bulkActionModalConfigs: Record<string, BulkActionModalConfig> = {
],
},
},
'/writer/drafts': {
'/writer/content': {
export: {
title: 'Export Selected Drafts',
message: (count: number) => `You are about to export ${count} selected draft${count !== 1 ? 's' : ''}. The export will be downloaded as a CSV file.`,

View File

@@ -40,7 +40,7 @@ export const deleteModalConfigs: Record<string, DeleteModalConfig> = {
itemNameSingular: 'task',
itemNamePlural: 'tasks',
},
'/writer/drafts': {
'/writer/content': {
title: 'Delete Drafts',
singleItemMessage: 'You are about to delete this draft. This action cannot be undone.',
multipleItemsMessage: (count: number) => `You are deleting ${count} drafts. This action cannot be undone.`,

View File

@@ -37,7 +37,7 @@ export const pageNotifications: Record<string, PageNotificationConfig> = {
message: 'Track and manage your content writing tasks and deadlines.',
showLink: false,
},
'/writer/drafts': {
'/writer/content': {
variant: 'info',
title: 'Drafts',
message: 'Review and edit your content drafts before publishing.',

View File

@@ -249,7 +249,7 @@ const tableActionsConfigs: Record<string, TableActionsConfig> = {
// Removed generate_content from bulk actions - only available as row action
],
},
'/writer/drafts': {
'/writer/content': {
rowActions: [
{
key: 'edit',

View File

@@ -97,11 +97,18 @@ export const createTasksPageConfig = (
columns: [
{
...titleColumn,
key: 'title',
label: 'Title',
sortable: true,
sortField: 'title',
toggleable: true, // Enable toggle for this column
toggleContentKey: 'content', // Use content field for toggle (fallback to description if content not available)
toggleContentLabel: 'Generated Content', // Label for expanded content
render: (_value: string, row: Task) => (
<span className="text-gray-800 dark:text-white font-medium">
{row.meta_title || row.title || '-'}
</span>
),
},
// Sector column - only show when viewing all sectors
...(showSectorColumn ? [{
@@ -166,6 +173,85 @@ export const createTasksPageConfig = (
);
},
},
{
key: 'keywords',
label: 'Keywords',
sortable: false,
width: '250px',
render: (_value: any, row: Task) => {
const keywords: React.ReactNode[] = [];
// Primary keyword as info badge
if (row.primary_keyword) {
keywords.push(
<Badge key="primary" color="info" size="sm" variant="light" className="mr-1 mb-1">
{row.primary_keyword}
</Badge>
);
}
// Secondary keywords as light badges
if (row.secondary_keywords && Array.isArray(row.secondary_keywords) && row.secondary_keywords.length > 0) {
row.secondary_keywords.forEach((keyword, index) => {
if (keyword) {
keywords.push(
<Badge key={`secondary-${index}`} color="light" size="sm" variant="light" className="mr-1 mb-1">
{keyword}
</Badge>
);
}
});
}
return keywords.length > 0 ? (
<div className="flex flex-wrap gap-1">
{keywords}
</div>
) : (
<span className="text-gray-400">-</span>
);
},
},
{
key: 'tags',
label: 'Tags',
sortable: false,
width: '200px',
render: (_value: any, row: Task) => {
if (row.tags && Array.isArray(row.tags) && row.tags.length > 0) {
return (
<div className="flex flex-wrap gap-1">
{row.tags.map((tag, index) => (
<Badge key={index} color="light" size="sm" variant="light">
{tag}
</Badge>
))}
</div>
);
}
return <span className="text-gray-400">-</span>;
},
},
{
key: 'categories',
label: 'Categories',
sortable: false,
width: '200px',
render: (_value: any, row: Task) => {
if (row.categories && Array.isArray(row.categories) && row.categories.length > 0) {
return (
<div className="flex flex-wrap gap-1">
{row.categories.map((category, index) => (
<Badge key={index} color="light" size="sm" variant="light">
{category}
</Badge>
))}
</div>
);
}
return <span className="text-gray-400">-</span>;
},
},
{
...wordCountColumn,
sortable: true,

View File

@@ -36,7 +36,7 @@ export const routes: RouteConfig[] = [
children: [
{ path: '/writer', label: 'Dashboard', breadcrumb: 'Writer Dashboard' },
{ path: '/writer/tasks', label: 'Tasks', breadcrumb: 'Tasks' },
{ path: '/writer/drafts', label: 'Drafts', breadcrumb: 'Drafts' },
{ path: '/writer/content', label: 'Content', breadcrumb: 'Content' },
{ path: '/writer/published', label: 'Published', breadcrumb: 'Published' },
],
},