2025-06-20 17:51:24 +01:00
|
|
|
import React from 'react';
|
2025-08-25 12:53:33 +01:00
|
|
|
import { Group, TextInput, Button, Text } from '@mantine/core';
|
2025-06-20 17:51:24 +01:00
|
|
|
|
|
|
|
interface BulkSelectionPanelProps {
|
|
|
|
csvInput: string;
|
|
|
|
setCsvInput: (value: string) => void;
|
2025-08-26 17:26:30 +01:00
|
|
|
selectedPageIds: string[];
|
|
|
|
displayDocument?: { pages: { id: string; pageNumber: number }[] };
|
2025-06-20 17:51:24 +01:00
|
|
|
onUpdatePagesFromCSV: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const BulkSelectionPanel = ({
|
|
|
|
csvInput,
|
|
|
|
setCsvInput,
|
2025-08-26 17:26:30 +01:00
|
|
|
selectedPageIds,
|
|
|
|
displayDocument,
|
2025-06-20 17:51:24 +01:00
|
|
|
onUpdatePagesFromCSV,
|
|
|
|
}: BulkSelectionPanelProps) => {
|
|
|
|
return (
|
2025-08-25 12:53:33 +01:00
|
|
|
<>
|
2025-06-20 17:51:24 +01:00
|
|
|
<Group>
|
|
|
|
<TextInput
|
|
|
|
value={csvInput}
|
|
|
|
onChange={(e) => setCsvInput(e.target.value)}
|
|
|
|
placeholder="1,3,5-10"
|
|
|
|
label="Page Selection"
|
|
|
|
onBlur={onUpdatePagesFromCSV}
|
|
|
|
onKeyDown={(e) => e.key === 'Enter' && onUpdatePagesFromCSV()}
|
|
|
|
style={{ flex: 1 }}
|
|
|
|
/>
|
|
|
|
<Button onClick={onUpdatePagesFromCSV} mt="xl">
|
|
|
|
Apply
|
|
|
|
</Button>
|
|
|
|
</Group>
|
2025-08-26 17:26:30 +01:00
|
|
|
{selectedPageIds.length > 0 && (
|
2025-06-20 17:51:24 +01:00
|
|
|
<Text size="sm" c="dimmed" mt="sm">
|
2025-08-26 17:26:30 +01:00
|
|
|
Selected: {selectedPageIds.length} pages ({displayDocument ? selectedPageIds.map(id => {
|
|
|
|
const page = displayDocument.pages.find(p => p.id === id);
|
|
|
|
return page?.pageNumber || 0;
|
|
|
|
}).filter(n => n > 0).join(', ') : ''})
|
2025-06-20 17:51:24 +01:00
|
|
|
</Text>
|
|
|
|
)}
|
2025-08-25 12:53:33 +01:00
|
|
|
</>
|
2025-06-20 17:51:24 +01:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BulkSelectionPanel;
|