Merge pull request #931 from getmaxun/scrape-ui

fix: show formats selected for scrape
This commit is contained in:
Karishma Shukla
2026-01-04 18:10:08 +05:30
committed by GitHub

View File

@@ -611,14 +611,46 @@ const RobotCreate: React.FC = () => {
value={outputFormats} value={outputFormats}
label="Output Formats *" label="Output Formats *"
onChange={(e) => { 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); setOutputFormats(value);
}} }}
renderValue={(selected) => { renderValue={(selected) => {
if (selected.length === 0) { if (selected.length === 0) {
return <em style={{ color: '#999' }}>Select formats</em>; return <em style={{ color: '#999' }}>Select formats</em>;
} }
return `${selected.length} format${selected.length > 1 ? 's' : ''} selected`;
const OUTPUT_FORMAT_LABELS: Record<string, string> = {
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 (
<Box
sx={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{display}
</Box>
);
}} }}
MenuProps={{ MenuProps={{
PaperProps: { PaperProps: {
@@ -748,4 +780,4 @@ const modalStyle = {
height: 'fit-content', height: 'fit-content',
display: 'block', display: 'block',
padding: '20px', padding: '20px',
}; };