diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 626fb19..c0683ae 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -22,7 +22,7 @@ const IDLE: NegoState = { } export default function App() { - const [demoCase, setDemoCase] = useState(DEMO_CASES[0]) + const [demoCase, setDemoCase] = useState(null) const [nego, setNego] = useState(IDLE) const [messages, setMessages] = useState([]) const [meta, setMeta] = useState(null) @@ -43,6 +43,7 @@ export default function App() { const send = useCallback( async (userInput: string | null, state: NegoState, userLabel?: string) => { + if (!demoCase) return setBusy(true) setError(null) if (userLabel) setMessages((m) => [...m, { role: 'user', text: userLabel }]) @@ -106,6 +107,18 @@ export default function App() { // eslint-disable-next-line react-hooks/exhaustive-deps }, [runId]) + // 시나리오 선택 화면으로 복귀 (채팅 영역이 선택 UI가 된다) + const changeScenario = useCallback(async () => { + await invalidateSession(session.current).catch(() => {}) + setDemoCase(null) + setMessages([]) + setMeta(null) + setFinalPrice(null) + setPriceTrail([]) + setStarted(false) + setNego(IDLE) + }, []) + const answer = (label: string) => send(label, nego, label) const offer = (v: number) => { @@ -139,7 +152,7 @@ export default function App() {
- + start(demoCase)} + onRestart={() => demoCase && start(demoCase)} + onSelect={start} /> void + onChange: () => void }) { + if (!selected) { + return ( + + ) + } + + const q = SCENARIO_QUADRANTS.find((x) => x.scenario === selected.scenario) + return (