canvas-columns.ts2.0 KBView on GitHub /**
* Shared column-width utility for the conversation canvas.
*
* Used by both ConversationItem (row cells) and ColumnConfigurationItem (column headers)
* to keep expanded-mode widths in sync.
*/
/** Fixed column widths for expanded (horizontal-scroll) mode — mirrors CRM table sizing */
export function getExpandedColumnWidth(type: string, columnId: string): string {
switch (type) {
case 'text':
return 'w-[350px]';
case 'current-action':
return 'w-[350px]';
case 'activity-overview':
return 'w-[450px]';
case 'status-badge':
return 'w-[110px]';
case 'select':
return columnId === 'priority' ? 'w-[80px]' : 'w-[100px]';
case 'date':
return 'w-[120px]';
case 'number':
case 'currency':
return 'w-[80px]';
case 'score':
return 'w-[50px]';
case 'crm-synced':
return 'w-[100px]';
default:
return 'w-[150px]';
}
}
/** Numeric pixel widths for expanded mode (matches getExpandedColumnWidth) */
export function getExpandedColumnWidthPx(type: string, columnId: string): number {
switch (type) {
case 'text':
case 'current-action':
return 350;
case 'activity-overview':
return 450;
case 'status-badge':
return 110;
case 'select':
return columnId === 'priority' ? 80 : 100;
case 'date':
return 120;
case 'number':
case 'currency':
return 80;
case 'score':
return 50;
case 'crm-synced':
return 100;
default:
return 150;
}
}
/** Numeric pixel widths for collapsed (flex) mode default column widths */
export function getDefaultColumnWidthPx(type: string, columnId: string): number {
switch (type) {
case 'status-badge':
return 112; // w-28
case 'select':
return columnId === 'priority' ? 80 : 96; // w-20 or w-24
case 'date':
return 96; // w-24
case 'number':
return 96; // w-24
case 'currency':
return 80; // w-20
default:
return 96; // w-24
}
}