From a6721e6536769ccaf96b16f514b63975f0bf7c5b Mon Sep 17 00:00:00 2001 From: gahusb Date: Sun, 24 May 2026 14:53:31 +0900 Subject: [PATCH] =?UTF-8?q?fix(tarot):=20=ED=95=B4=EC=84=9D=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=20=EC=8B=9C=20=EC=9E=90=EB=8F=99=20AI=20=ED=83=AD=20?= =?UTF-8?q?=EC=A0=84=ED=99=98=20+=20=EC=83=88=20=EB=A6=AC=EB=94=A9=20?= =?UTF-8?q?=EC=8B=9C=20=ED=95=B4=EC=84=9D=20state=20=EC=9E=94=EC=A1=B4=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue 1 — 우측 패널 탭이 hardcoded is-active로 클릭/state 없음: - InterpretationPanel에 activeTab state 추가 - useEffect로 interpretation 도착 시 자동 'ai' 탭 전환, 없으면 'card' - 두 탭 콘텐츠 분리: card=카드 의미·상징·조언, ai=위치 해석·종합·상호작용·근거 Issue 2 — useTarotReading hook의 interpretation이 새 리딩 시작에 잔존: - hook에 reset() 함수 추가 (status/interpretation/readingId/error 초기화) - Reading.jsx의 startShuffle/openCardSpread/restart/resetCards/changeSpread 5개 액션에서 모두 reset() 호출 — 새 리딩 시작 시 이전 해석 완전 제거 Co-Authored-By: Claude Opus 4.7 (1M context) --- src/pages/tarot/Reading.jsx | 7 +- .../tarot/components/InterpretationPanel.jsx | 148 ++++++++++-------- src/pages/tarot/hooks/useTarotReading.js | 9 +- 3 files changed, 99 insertions(+), 65 deletions(-) diff --git a/src/pages/tarot/Reading.jsx b/src/pages/tarot/Reading.jsx index f95a575..0d18737 100644 --- a/src/pages/tarot/Reading.jsx +++ b/src/pages/tarot/Reading.jsx @@ -53,19 +53,21 @@ export default function Reading() { const spread = SPREADS[spreadId]; const { slice, reshuffle } = useTarotShuffle(TAROT_DECK, 20); - const { status, interpretation, runInterpretAndSave, error } = useTarotReading(); + const { status, interpretation, runInterpretAndSave, error, reset } = useTarotReading(); const startShuffle = () => { reshuffle(); setPicks([]); setFocusIdx(null); setStep(1); + reset(); }; const openCardSpread = () => { setPicks([]); setFocusIdx(null); setStep(2); + reset(); }; const handlePick = (card = null) => { @@ -92,6 +94,7 @@ export default function Reading() { const restart = () => { setStep(1); setPicks([]); setFocusIdx(null); + reset(); }; const resetCards = () => { @@ -99,6 +102,7 @@ export default function Reading() { setPicks([]); setFocusIdx(null); setStep(1); + reset(); }; const changeSpread = (nextSpreadId) => { @@ -107,6 +111,7 @@ export default function Reading() { setFocusIdx(null); setStep(1); reshuffle(); + reset(); }; const disabledIds = picks.map((p) => p.card.slug); diff --git a/src/pages/tarot/components/InterpretationPanel.jsx b/src/pages/tarot/components/InterpretationPanel.jsx index 59f8db7..54bbb6a 100644 --- a/src/pages/tarot/components/InterpretationPanel.jsx +++ b/src/pages/tarot/components/InterpretationPanel.jsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; function ConfidenceBadge({ level }) { if (!level) return null; @@ -14,15 +14,36 @@ export default function InterpretationPanel({ selectedPosition, selectedReversed = false, }) { + const [activeTab, setActiveTab] = useState('card'); const [showEvidence, setShowEvidence] = useState(true); + useEffect(() => { + setActiveTab(interpretation ? 'ai' : 'card'); + }, [interpretation]); + + const hasAI = !!interpretation; + + const renderTabs = () => ( +
+ + +
+ ); + if (!interpretation && !selectedCard) { return (