feat(sync-help): SyncSection 도움말 버튼 + SyncHelpModal mount + ConflictModal onOpenHelp wiring
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import { inboxApi } from '../../api.js';
|
||||
import type { SyncStatusSnapshot } from '@shared/types';
|
||||
import { ConflictModal } from '../ConflictModal.js';
|
||||
import { SyncHelpModal, type SyncHelpAnchor } from '../SyncHelpModal.js';
|
||||
|
||||
export function SyncSection(): React.ReactElement {
|
||||
const [url, setUrl] = useState('');
|
||||
@@ -12,6 +13,7 @@ export function SyncSection(): React.ReactElement {
|
||||
const [busy, setBusy] = useState<'save' | 'test' | 'sync' | null>(null);
|
||||
const [feedback, setFeedback] = useState<string | null>(null);
|
||||
const [showConflict, setShowConflict] = useState(false);
|
||||
const [showHelp, setShowHelp] = useState<{ open: boolean; anchor?: SyncHelpAnchor }>({ open: false });
|
||||
|
||||
useEffect(() => {
|
||||
void (async () => {
|
||||
@@ -78,6 +80,9 @@ export function SyncSection(): React.ReactElement {
|
||||
<button onClick={() => { void onTestConnection(); }} disabled={busy !== null || url.trim() === ''} style={btnStyle()}>
|
||||
{busy === 'test' ? '확인 중…' : '연결 테스트'}
|
||||
</button>
|
||||
<button onClick={() => setShowHelp({ open: true })} disabled={busy !== null} style={btnStyle()}>
|
||||
도움말
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{feedback !== null && (
|
||||
@@ -129,10 +134,18 @@ export function SyncSection(): React.ReactElement {
|
||||
onResolved={async () => {
|
||||
setStatus(await inboxApi.getSyncStatus());
|
||||
}}
|
||||
onOpenHelp={(anchor) => setShowHelp({ open: true, anchor })}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{showHelp.open && (
|
||||
<SyncHelpModal
|
||||
onClose={() => setShowHelp({ open: false })}
|
||||
initialAnchor={showHelp.anchor}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,4 +72,12 @@ describe('SyncSection', () => {
|
||||
expect(mockSetAuto).toHaveBeenCalledWith(false);
|
||||
});
|
||||
});
|
||||
|
||||
it('도움말 버튼 클릭 → SyncHelpModal open', async () => {
|
||||
render(<SyncSection />);
|
||||
await waitFor(() => screen.getByRole('button', { name: /저장/ }));
|
||||
fireEvent.click(screen.getByRole('button', { name: /^도움말$/ }));
|
||||
await waitFor(() => screen.getByRole('heading', { name: /동기화 도움말/ }));
|
||||
expect(screen.getByRole('heading', { name: /동기화 도움말/ })).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user