refactor: rename ConfirmSyncDialog to KOSyncResolver (#1937)

This commit is contained in:
Huang Xin
2025-08-31 11:46:43 +08:00
committed by GitHub
parent f0c249bce2
commit 06db7f36f8
3 changed files with 22 additions and 20 deletions
@@ -0,0 +1,52 @@
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-xs font-normal normal-case text-gray-500'>
{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;