35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
import * as React from 'react';
|
|
import { texts } from '../../texts';
|
|
import { Button, Modal } from '../ui';
|
|
|
|
export type DuplicateChoice = 'delete' | 'skip';
|
|
|
|
export interface IManageByUserDuplicateModalProps {
|
|
title: string;
|
|
message: string;
|
|
onChoice: (choice: DuplicateChoice, forAll: boolean) => void;
|
|
}
|
|
|
|
/**
|
|
* «Да / Да для всех / Нет / Нет для всех» — классический диалог разрешения
|
|
* конфликтов при пакетной операции (как в проводнике при копировании файлов).
|
|
* Закрытие крестиком/подложкой равносильно «Нет» (без «для всех» — иначе
|
|
* случайный клик мимо тихо остановил бы весь оставшийся список).
|
|
*/
|
|
export const ManageByUserDuplicateModal: React.FC<IManageByUserDuplicateModalProps> = ({ title, message, onChoice }) => (
|
|
<Modal
|
|
title={title}
|
|
onClose={() => onChoice('skip', false)}
|
|
footer={
|
|
<>
|
|
<Button variant="secondary" onClick={() => onChoice('skip', false)}>{texts.manageByUser.duplicateSkip}</Button>
|
|
<Button variant="secondary" onClick={() => onChoice('skip', true)}>{texts.manageByUser.duplicateSkipAll}</Button>
|
|
<Button variant="danger" icon="trash" onClick={() => onChoice('delete', false)}>{texts.manageByUser.duplicateDelete}</Button>
|
|
<Button variant="danger" icon="trash" onClick={() => onChoice('delete', true)}>{texts.manageByUser.duplicateDeleteAll}</Button>
|
|
</>
|
|
}
|
|
>
|
|
<p>{message}</p>
|
|
</Modal>
|
|
);
|