123
This commit is contained in:
@@ -82,7 +82,7 @@ export const createContentPageConfig = (
|
||||
statusFilter: string;
|
||||
setStatusFilter: (value: string) => void;
|
||||
setCurrentPage: (page: number) => void;
|
||||
onViewContent?: (row: Content) => void;
|
||||
onRowClick?: (row: Content) => void;
|
||||
}
|
||||
): ContentPageConfig => {
|
||||
const showSectorColumn = !handlers.activeSector;
|
||||
@@ -99,14 +99,11 @@ export const createContentPageConfig = (
|
||||
...titleColumn,
|
||||
sortable: true,
|
||||
sortField: 'title',
|
||||
toggleable: true,
|
||||
toggleContentKey: 'content_html',
|
||||
toggleContentLabel: 'Generated Content',
|
||||
render: (value: string, row: Content) => (
|
||||
<div>
|
||||
{handlers.onViewContent ? (
|
||||
{handlers.onRowClick ? (
|
||||
<button
|
||||
onClick={() => handlers.onViewContent!(row)}
|
||||
onClick={() => handlers.onRowClick!(row)}
|
||||
className="font-medium text-blue-500 hover:text-blue-600 hover:underline text-left transition-colors"
|
||||
>
|
||||
{row.title || `Content #${row.id}`}
|
||||
@@ -122,69 +119,84 @@ export const createContentPageConfig = (
|
||||
...(showSectorColumn ? [{
|
||||
...sectorColumn,
|
||||
render: (value: string, row: Content) => (
|
||||
<Badge color="info" size="sm" variant="light">
|
||||
{row.sector_name || '-'}
|
||||
<Badge color="info" size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{row.sector_name || '-'}</span>
|
||||
</Badge>
|
||||
),
|
||||
}] : []),
|
||||
{
|
||||
key: 'content_type',
|
||||
label: 'Content Type',
|
||||
label: 'Type',
|
||||
sortable: true,
|
||||
sortField: 'content_type',
|
||||
width: '120px',
|
||||
render: (value: string) => (
|
||||
<Badge color="primary" size="sm" variant="light">
|
||||
{TYPE_LABELS[value] || value || '-'}
|
||||
</Badge>
|
||||
),
|
||||
width: '110px',
|
||||
render: (value: string) => {
|
||||
const label = TYPE_LABELS[value] || value || '-';
|
||||
// Proper case: capitalize first letter only
|
||||
const properCase = label.charAt(0).toUpperCase() + label.slice(1);
|
||||
return (
|
||||
<Badge color="blue" size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{properCase}</span>
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'content_structure',
|
||||
label: 'Structure',
|
||||
sortable: true,
|
||||
sortField: 'content_structure',
|
||||
width: '150px',
|
||||
render: (value: string) => (
|
||||
<Badge color="info" size="sm" variant="light">
|
||||
{STRUCTURE_LABELS[value] || value || '-'}
|
||||
</Badge>
|
||||
),
|
||||
width: '130px',
|
||||
render: (value: string) => {
|
||||
const label = STRUCTURE_LABELS[value] || value || '-';
|
||||
// Proper case: capitalize first letter of each word
|
||||
const properCase = label.split(/[_\s]+/).map(word =>
|
||||
word.charAt(0).toUpperCase() + word.slice(1)
|
||||
).join(' ');
|
||||
return (
|
||||
<Badge color="purple" size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{properCase}</span>
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'cluster_name',
|
||||
label: 'Cluster',
|
||||
sortable: false,
|
||||
width: '150px',
|
||||
width: '130px',
|
||||
render: (_value: any, row: Content) => {
|
||||
const clusterName = row.cluster_name;
|
||||
if (!clusterName) {
|
||||
return <span className="text-gray-400 dark:text-gray-500">-</span>;
|
||||
return <span className="text-gray-400 dark:text-gray-500 text-[11px]">-</span>;
|
||||
}
|
||||
return (
|
||||
<Badge color="primary" size="sm" variant="light">
|
||||
{clusterName}
|
||||
<Badge color="indigo" size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{clusterName}</span>
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'taxonomy_terms',
|
||||
label: 'Taxonomy',
|
||||
label: 'Tags',
|
||||
sortable: false,
|
||||
width: '180px',
|
||||
width: '150px',
|
||||
render: (_value: any, row: Content) => {
|
||||
const taxonomyTerms = row.taxonomy_terms;
|
||||
if (!taxonomyTerms || taxonomyTerms.length === 0) {
|
||||
return <span className="text-gray-400 dark:text-gray-500">-</span>;
|
||||
return <span className="text-gray-400 dark:text-gray-500 text-[11px]">-</span>;
|
||||
}
|
||||
return (
|
||||
<div className="flex flex-wrap gap-1">
|
||||
{taxonomyTerms.map((term) => (
|
||||
<Badge key={term.id} color="purple" size="sm" variant="light">
|
||||
{term.name}
|
||||
{taxonomyTerms.slice(0, 2).map((term) => (
|
||||
<Badge key={term.id} color="pink" size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{term.name}</span>
|
||||
</Badge>
|
||||
))}
|
||||
{taxonomyTerms.length > 2 && (
|
||||
<span className="text-[11px] text-gray-500">+{taxonomyTerms.length - 2}</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
@@ -194,15 +206,16 @@ export const createContentPageConfig = (
|
||||
sortable: true,
|
||||
sortField: 'status',
|
||||
render: (value: string) => {
|
||||
const statusColors: Record<string, 'warning' | 'success'> = {
|
||||
draft: 'warning',
|
||||
const statusColors: Record<string, 'success' | 'amber'> = {
|
||||
draft: 'amber',
|
||||
published: 'success',
|
||||
};
|
||||
const color = statusColors[value] || 'warning';
|
||||
const label = value === 'published' ? 'Published' : 'Draft';
|
||||
const color = statusColors[value] || 'amber';
|
||||
// Proper case
|
||||
const label = value ? value.charAt(0).toUpperCase() + value.slice(1) : 'Draft';
|
||||
return (
|
||||
<Badge color={color} size="sm" variant="light">
|
||||
{label}
|
||||
<Badge color={color} size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{label}</span>
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
@@ -213,20 +226,20 @@ export const createContentPageConfig = (
|
||||
label: 'Source',
|
||||
sortable: true,
|
||||
sortField: 'source',
|
||||
width: '120px',
|
||||
width: '90px',
|
||||
render: (value: any, row: Content) => {
|
||||
const source = value || row.source || 'igny8';
|
||||
const sourceColors: Record<string, 'primary' | 'info'> = {
|
||||
igny8: 'primary',
|
||||
wordpress: 'info',
|
||||
const sourceColors: Record<string, 'teal' | 'cyan'> = {
|
||||
igny8: 'teal',
|
||||
wordpress: 'cyan',
|
||||
};
|
||||
const sourceLabels: Record<string, string> = {
|
||||
igny8: 'IGNY8',
|
||||
wordpress: 'WordPress',
|
||||
igny8: 'Igny8',
|
||||
wordpress: 'Wp',
|
||||
};
|
||||
return (
|
||||
<Badge color={sourceColors[source] || 'primary'} size="sm" variant="light">
|
||||
{sourceLabels[source] || source}
|
||||
<Badge color={sourceColors[source] || 'teal'} size="xs" variant="soft">
|
||||
<span className="text-[11px] font-normal">{sourceLabels[source] || source}</span>
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user