From 6d43095eccc97552dbd023f2289d9751589d14c9 Mon Sep 17 00:00:00 2001 From: Karishma Shukla Date: Sun, 21 Dec 2025 17:29:12 +0530 Subject: [PATCH] fix: show formats selected for scrape Refactor output format selection logic and improve display. --- src/components/robot/pages/RobotCreate.tsx | 38 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/components/robot/pages/RobotCreate.tsx b/src/components/robot/pages/RobotCreate.tsx index a64564e6..b45db930 100644 --- a/src/components/robot/pages/RobotCreate.tsx +++ b/src/components/robot/pages/RobotCreate.tsx @@ -611,14 +611,46 @@ const RobotCreate: React.FC = () => { value={outputFormats} label="Output Formats *" onChange={(e) => { - const value = typeof e.target.value === 'string' ? e.target.value.split(',') : e.target.value; + const value = + typeof e.target.value === 'string' + ? e.target.value.split(',') + : e.target.value; setOutputFormats(value); }} renderValue={(selected) => { if (selected.length === 0) { return Select formats; } - return `${selected.length} format${selected.length > 1 ? 's' : ''} selected`; + + const OUTPUT_FORMAT_LABELS: Record = { + markdown: 'Markdown', + html: 'HTML', + 'screenshot-visible': 'Screenshot (Visible)', + 'screenshot-fullpage': 'Screenshot (Full Page)', + }; + + const labels = selected.map( + (value) => OUTPUT_FORMAT_LABELS[value] ?? value + ); + + const MAX_ITEMS = 2; // Show only first 2, then ellipsis + + const display = + labels.length > MAX_ITEMS + ? `${labels.slice(0, MAX_ITEMS).join(', ')}…` + : labels.join(', '); + + return ( + + {display} + + ); }} MenuProps={{ PaperProps: { @@ -748,4 +780,4 @@ const modalStyle = { height: 'fit-content', display: 'block', padding: '20px', -}; \ No newline at end of file +};