File size: 1,570 Bytes
4e1096a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import React from 'react';
import Dialog from '@/components/Dialog';
import { useTranslation } from '@/hooks/useTranslation';
import { SyncDetails } from '../hooks/useKOSync';
interface KOSyncConflictResolverProps {
details: SyncDetails | null;
onResolveWithLocal: () => void;
onResolveWithRemote: () => void;
onClose: () => void;
}
const KOSyncConflictResolver: React.FC<KOSyncConflictResolverProps> = ({
details,
onResolveWithLocal,
onResolveWithRemote,
onClose,
}) => {
const _ = useTranslation();
if (!details) return null;
return (
<Dialog isOpen={true} onClose={onClose} title={_('Sync Conflict')}>
<p className='py-4 text-center'>
{_('Sync reading progress from "{{deviceName}}"?', {
deviceName: details.remote.device || _('another device'),
})}
</p>
<div className='mt-4 space-y-4'>
<button
className='btn h-auto w-full flex-col items-start py-2'
onClick={onResolveWithLocal}
>
<span>{_('Local Progress')}</span>
<span className='text-base-content/50 text-xs font-normal normal-case'>
{details.local.preview}
</span>
</button>
<button
className='btn btn-primary h-auto w-full flex-col items-start py-2'
onClick={onResolveWithRemote}
>
<span>{_('Remote Progress')}</span>
<span className='text-xs font-normal normal-case'>{details.remote.preview}</span>
</button>
</div>
</Dialog>
);
};
export default KOSyncConflictResolver;
|