more fixes ui

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-27 07:09:33 +00:00
parent d5bda678fd
commit 4482d2f4c4
13 changed files with 117 additions and 29 deletions

View File

@@ -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: [
{