more fixes ui
This commit is contained in:
@@ -19,6 +19,7 @@ import { Cluster } from '../../services/api';
|
||||
import Input from '../../components/form/input/InputField';
|
||||
import Label from '../../components/form/Label';
|
||||
import Button from '../../components/ui/button/Button';
|
||||
import { BoltIcon } from '../../icons';
|
||||
|
||||
export interface ColumnConfig {
|
||||
key: string;
|
||||
@@ -93,6 +94,7 @@ export const createClustersPageConfig = (
|
||||
volumeDropdownRef: React.RefObject<HTMLDivElement | null>;
|
||||
setCurrentPage: (page: number) => void;
|
||||
loadClusters: () => Promise<void>;
|
||||
onGenerateIdeas?: (clusterId: number) => void; // Handler for generate ideas button
|
||||
}
|
||||
): ClustersPageConfig => {
|
||||
const showSectorColumn = !handlers.activeSector; // Show when viewing all sectors
|
||||
@@ -129,6 +131,7 @@ export const createClustersPageConfig = (
|
||||
sortable: true,
|
||||
sortField: 'keywords_count',
|
||||
width: '120px',
|
||||
align: 'center' as const,
|
||||
render: (value: number) => value.toLocaleString(),
|
||||
},
|
||||
{
|
||||
@@ -137,6 +140,7 @@ export const createClustersPageConfig = (
|
||||
sortable: false, // Backend doesn't support sorting by ideas_count
|
||||
sortField: 'ideas_count',
|
||||
width: '120px',
|
||||
align: 'center' as const,
|
||||
render: (value: number) => (
|
||||
<Badge
|
||||
color={value > 0 ? 'success' : 'light'}
|
||||
@@ -155,6 +159,7 @@ export const createClustersPageConfig = (
|
||||
sortable: true,
|
||||
sortField: 'volume',
|
||||
width: '120px',
|
||||
align: 'center' as const,
|
||||
render: (value: number) => value.toLocaleString(),
|
||||
},
|
||||
{
|
||||
@@ -193,6 +198,7 @@ export const createClustersPageConfig = (
|
||||
sortable: false, // Backend doesn't support sorting by content_count
|
||||
sortField: 'content_count',
|
||||
width: '120px',
|
||||
align: 'center' as const,
|
||||
render: (value: number) => value.toLocaleString(),
|
||||
},
|
||||
{
|
||||
@@ -244,6 +250,32 @@ export const createClustersPageConfig = (
|
||||
defaultVisible: false,
|
||||
render: (value: string) => formatRelativeDate(value),
|
||||
},
|
||||
// Generate Ideas action column - only shows button for status = 'new'
|
||||
{
|
||||
key: 'generate_action',
|
||||
label: 'Actions',
|
||||
sortable: false,
|
||||
width: '120px',
|
||||
render: (_value: any, row: Cluster) => {
|
||||
// Only show generate button for clusters with status 'new'
|
||||
if (row.status === 'new' && handlers.onGenerateIdeas) {
|
||||
return (
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handlers.onGenerateIdeas!(row.id);
|
||||
}}
|
||||
className="inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-white bg-brand-500 hover:bg-brand-600 rounded transition-colors"
|
||||
title="Generate Ideas"
|
||||
>
|
||||
<BoltIcon className="w-4 h-4" />
|
||||
Generate
|
||||
</button>
|
||||
);
|
||||
}
|
||||
return <span className="text-gray-400 dark:text-gray-500 text-sm">-</span>;
|
||||
},
|
||||
},
|
||||
],
|
||||
filters: [
|
||||
{
|
||||
|
||||
@@ -296,7 +296,7 @@ export const createContentPageConfig = (
|
||||
sortable: true,
|
||||
sortField: 'word_count',
|
||||
width: '100px',
|
||||
align: 'right',
|
||||
align: 'center' as const,
|
||||
render: (value: number) => (
|
||||
<span className="font-mono text-sm text-gray-700 dark:text-gray-300">
|
||||
{value?.toLocaleString() || 0}
|
||||
|
||||
@@ -203,6 +203,7 @@ export const createIdeasPageConfig = (
|
||||
sortable: true,
|
||||
sortField: 'estimated_word_count',
|
||||
width: '100px',
|
||||
align: 'center' as const,
|
||||
render: (value: number) => value.toLocaleString(),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -160,6 +160,7 @@ export const createKeywordsPageConfig = (
|
||||
...volumeColumn,
|
||||
sortable: true,
|
||||
sortField: 'seed_keyword__volume', // Backend expects seed_keyword__volume
|
||||
align: 'center' as const,
|
||||
render: (value: number) => value.toLocaleString(),
|
||||
},
|
||||
{
|
||||
@@ -200,6 +201,7 @@ export const createKeywordsPageConfig = (
|
||||
...countryColumn,
|
||||
sortable: false, // Backend doesn't support sorting by country
|
||||
sortField: 'seed_keyword__country',
|
||||
align: 'center' as const,
|
||||
render: (value: string) => {
|
||||
const countryNames: Record<string, string> = {
|
||||
'US': 'United States',
|
||||
|
||||
@@ -155,12 +155,7 @@ const tableActionsConfigs: Record<string, TableActionsConfig> = {
|
||||
icon: EditIcon,
|
||||
variant: 'primary',
|
||||
},
|
||||
{
|
||||
key: 'generate_ideas',
|
||||
label: 'Generate Ideas',
|
||||
icon: <BoltIcon className="w-5 h-5" />,
|
||||
variant: 'primary',
|
||||
},
|
||||
// Generate Ideas moved to dedicated column - only shows for status='new'
|
||||
],
|
||||
bulkActions: [
|
||||
{
|
||||
@@ -175,12 +170,7 @@ const tableActionsConfigs: Record<string, TableActionsConfig> = {
|
||||
icon: <DownloadIcon className="w-4 h-4 text-blue-light-500" />,
|
||||
variant: 'secondary',
|
||||
},
|
||||
{
|
||||
key: 'auto_generate_ideas',
|
||||
label: 'Generate Ideas',
|
||||
icon: <BoltIcon className="w-4 h-4 text-warning-500" />,
|
||||
variant: 'secondary',
|
||||
},
|
||||
// Removed auto_generate_ideas - now row-level only
|
||||
],
|
||||
},
|
||||
'/planner/ideas': {
|
||||
|
||||
@@ -215,6 +215,7 @@ export const createTasksPageConfig = (
|
||||
...wordCountColumn,
|
||||
sortable: true,
|
||||
sortField: 'word_count',
|
||||
align: 'center' as const,
|
||||
render: (value: number | null | undefined) => (value != null ? value.toLocaleString() : '-'),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user