diff --git a/src/components/AutomationPanel.tsx b/src/components/AutomationPanel.tsx index d7104bc..9d67080 100644 --- a/src/components/AutomationPanel.tsx +++ b/src/components/AutomationPanel.tsx @@ -1,6 +1,7 @@ import { useEffect, useMemo, useRef, useState } from 'react' import type { AutoReservationState, + AutoSalvoAttempt, AutoSalvoState, CaptchaResult, ClockCalibrationSettings, @@ -14,6 +15,19 @@ import { CLOCK_CALIBRATION_DEFAULTS } from '../type/reservation' const MAX_SALVO_ATTEMPTS = 8 +const SALVO_STATUS_LABEL: Record = { + pending: '대기', firing: '전송 중', succeeded: '성공', failed: '실패', skipped: '건너뜀', +} + +function DetailRow({ label, value }: { label: string; value: string }) { + return ( + <> +
{label}
+
{value}
+ + ) +} + // 토큰 수별 기본 오프셋: 1개는 +0, 그 이상은 -50 헤지 하나 뒤로 0부터 +50씩 증가. // 1→[0] · 2→[-50,0] · 3→[-50,0,50] · 4→[-50,0,50,100] · … export function defaultSalvoOffsets(count: number) { @@ -143,6 +157,7 @@ export default function AutomationPanel({ const [salvoState, setSalvoState] = useState({ status: 'idle', stopOnSuccess: true, attempts: [] }) const [salvoBusy, setSalvoBusy] = useState<'token' | 'arm' | null>(null) const [salvoError, setSalvoError] = useState('') + const [expandedAttempts, setExpandedAttempts] = useState([]) const previousFingerprint = useRef('') const previousAutoStatus = useRef(autoState.status) const previousSalvoStatus = useRef(salvoState.status) @@ -235,6 +250,7 @@ export default function AutomationPanel({ if (previousSalvoStatus.current !== salvoState.status) { if (salvoState.status === 'succeeded' && salvoState.result) { onResult(salvoState.result) + if (salvoState.succeededIndex !== undefined) setExpandedAttempts((current) => current.includes(salvoState.succeededIndex!) ? current : [...current, salvoState.succeededIndex!]) setTokens([]) } previousSalvoStatus.current = salvoState.status @@ -344,6 +360,7 @@ export default function AutomationPanel({ if (attemptCount === 0) return setSalvoError('캡차 토큰을 먼저 하나 이상 생성해주세요.') if (!Number.isFinite(targetServerTimeMs)) return setSalvoError('실행 시각을 올바르게 입력해주세요.') if (!salvoReady) return setSalvoError('일부 토큰이 목표 시각에 90초를 초과합니다. 간격을 줄이거나 토큰을 다시 생성해주세요.') + setExpandedAttempts([]) setSalvoBusy('arm') try { if (!clock?.monitoring) setClock(await window.reservationApi.startClockMonitor()) @@ -504,16 +521,42 @@ export default function AutomationPanel({ {salvoState.attempts.length > 0 && (
- {salvoState.attempts.map((attempt) => ( -
- {attempt.offsetMs >= 0 ? '+' : ''}{attempt.offsetMs}ms{attempt.plannedSendAtMs ? ` · ${formatClock(attempt.plannedSendAtMs).split(' ').at(-1)}` : ''} - - {attempt.arrivalErrorMs !== undefined && 도착 {attempt.arrivalErrorMs >= 0 ? '+' : ''}{attempt.arrivalErrorMs.toFixed(0)}ms} - {attempt.httpStatus !== undefined && {attempt.httpStatus}} - {attempt.status} - -
- ))} + {salvoState.attempts.map((attempt) => { + const open = expandedAttempts.includes(attempt.index) + const completed = attempt.status === 'succeeded' || attempt.status === 'failed' || attempt.status === 'skipped' + const chipClass = attempt.status === 'succeeded' ? 'bg-success/10 text-success' : attempt.status === 'failed' ? 'bg-danger/10 text-danger' : attempt.status === 'firing' ? 'bg-gold text-gold-ink' : attempt.status === 'skipped' ? 'bg-chrome text-ink-muted' : 'bg-accent/10 text-accent' + return ( +
+ + {open && ( + completed ? ( +
+ {attempt.message && } + {attempt.reservationNum && } + + + + = 0 ? '+' : ''}${attempt.arrivalErrorMs.toFixed(1)}ms`} /> + + +
+ ) : ( +

{attempt.status === 'firing' ? '요청을 전송하고 응답을 기다리는 중입니다.' : `이 시도는 아직 대기 중입니다. 예정 발송 ${attempt.plannedSendAtMs ? formatClock(attempt.plannedSendAtMs).split(' ').at(-1) : '계산 중'}에 실행됩니다.`}

+ ) + )} +
+ ) + })}
)} diff --git a/test/screenshots/e2e.png b/test/screenshots/e2e.png index eef32b8..7c352ca 100644 Binary files a/test/screenshots/e2e.png and b/test/screenshots/e2e.png differ