New Columns and columns visibility

This commit is contained in:
Desktop
2025-11-12 23:29:31 +05:00
parent 35b6cc6502
commit 5da2092873
12 changed files with 460 additions and 22 deletions

View File

@@ -36,6 +36,7 @@ export interface ColumnConfig {
align?: 'left' | 'center' | 'right';
width?: string;
render?: (value: any, row: any) => React.ReactNode;
defaultVisible?: boolean; // Whether column is visible by default (default: true)
}
// BulkActionConfig and RowActionConfig are now in table-actions.config.tsx
@@ -163,7 +164,8 @@ export const createKeywordsPageConfig = (
},
{
...clusterColumn,
sortable: false,
sortable: true,
sortField: 'cluster_id',
render: (_value: string, row: Keyword) => row.cluster_name || '-',
},
{
@@ -264,6 +266,52 @@ export const createKeywordsPageConfig = (
sortField: 'created_at',
render: (value: string) => formatRelativeDate(value),
},
// Optional columns - hidden by default
{
key: 'updated_at',
label: 'Updated',
sortable: true,
sortField: 'updated_at',
defaultVisible: false,
render: (value: string) => formatRelativeDate(value),
},
{
key: 'volume_override',
label: 'Volume Override',
sortable: true,
sortField: 'volume_override',
defaultVisible: false,
render: (value: number | null) => value ? value.toLocaleString() : '-',
},
{
key: 'difficulty_override',
label: 'Difficulty Override',
sortable: true,
sortField: 'difficulty_override',
defaultVisible: false,
align: 'center' as const,
render: (value: number | null) => {
if (value === null || value === undefined) return '-';
const difficultyNum = getDifficultyNumber(value);
return typeof difficultyNum === 'number' ? (
<Badge
color={
difficultyNum === 1 || difficultyNum === 2
? 'success'
: difficultyNum === 3
? 'warning'
: 'error'
}
variant={difficultyNum === 5 ? 'solid' : 'light'}
size="sm"
>
{difficultyNum}
</Badge>
) : (
difficultyNum
);
},
},
],
filters: [
{