'use client'; import {Heading} from '@astryxdesign/core/Text'; import {Badge} from '@astryxdesign/core/Badge'; import type {TablePartSpec} from '@/features/loyaly-ai/types/chat'; export function TableBlock({tables}: {tables: TablePartSpec[]}) { if (!tables || tables.length === 0) return null; return (
{tables.map((t, idx) => (
{t.title ? (
{t.title}
) : null}
{t.columns.map((col) => ( ))} {t.rows.map((row, rIdx) => ( {t.columns.map((col) => { const val = row[col.key]; const valStr = String(val ?? ''); const isStatus = col.key === 'status' || col.key === 'state'; return ( ); })} ))}
{col.header}
{isStatus ? ( ) : ( valStr )}
))}
); }