feat: Implement WordPress publishing and unpublishing actions
- Added conditional visibility for table actions based on content state (published/draft). - Introduced `publishContent` and `unpublishContent` API functions for handling WordPress integration. - Updated `Content` component to manage publish/unpublish actions with appropriate error handling and success notifications. - Refactored `PostEditor` to remove deprecated SEO fields and consolidate taxonomy management. - Enhanced `TablePageTemplate` to filter row actions based on visibility conditions. - Updated backend API to support publishing and unpublishing content with proper status updates and external references.
This commit is contained in:
@@ -12,6 +12,7 @@ export interface RowActionConfig {
|
||||
label: string;
|
||||
icon: React.ReactNode;
|
||||
variant?: 'primary' | 'danger' | 'secondary' | 'success'; // For styling
|
||||
shouldShow?: (row: any) => boolean; // Optional conditional visibility
|
||||
}
|
||||
|
||||
export interface BulkActionConfig {
|
||||
@@ -257,6 +258,27 @@ const tableActionsConfigs: Record<string, TableActionsConfig> = {
|
||||
icon: EditIcon,
|
||||
variant: 'primary',
|
||||
},
|
||||
{
|
||||
key: 'publish',
|
||||
label: 'Publish to WordPress',
|
||||
icon: <CheckCircleIcon className="w-5 h-5 text-success-500" />,
|
||||
variant: 'success',
|
||||
shouldShow: (row: any) => !row.external_id, // Only show if not published
|
||||
},
|
||||
{
|
||||
key: 'view_on_wordpress',
|
||||
label: 'View on WordPress',
|
||||
icon: <CheckCircleIcon className="w-5 h-5 text-blue-500" />,
|
||||
variant: 'secondary',
|
||||
shouldShow: (row: any) => !!row.external_id, // Only show if published
|
||||
},
|
||||
{
|
||||
key: 'unpublish',
|
||||
label: 'Unpublish',
|
||||
icon: <TrashBinIcon className="w-5 h-5" />,
|
||||
variant: 'secondary',
|
||||
shouldShow: (row: any) => !!row.external_id, // Only show if published
|
||||
},
|
||||
{
|
||||
key: 'generate_image_prompts',
|
||||
label: 'Generate Image Prompts',
|
||||
|
||||
Reference in New Issue
Block a user