import { useState } from 'react'
import { motion } from 'framer-motion'
import { useGame } from '../store/gameStore'
import { TOPIC_MASTER } from '../data/accounts'
import type { ProblemDocument } from '../types'
interface Props {
// 第2問/第3問から直接 props で渡す場合(省略時は gameStore から取得)
eventText?: string
hint?: string | null
documents?: ProblemDocument[]
sectionLabel?: string
topicLabel?: string
problemId?: string
}
export function EventCard(props: Props) {
// props がなければ gameStore から読む(第1問)
const storeProblem = useGame((s) => s.problem)
const storeTopic = useGame((s) => s.topic)
const [showHint, setShowHint] = useState(false)
const eventText = props.eventText ?? storeProblem?.event_text
const hint = props.hint !== undefined ? props.hint : storeProblem?.hint
const documents = props.documents ?? storeProblem?.documents
const sectionLabel = props.sectionLabel ?? '第1問 仕訳'
const topicLabel = props.topicLabel ?? (TOPIC_MASTER[storeTopic]?.label ?? storeTopic)
const problemId = props.problemId ?? storeProblem?.id ?? 'card'
if (!eventText) return null
return (
{eventText} 💡 {hint}
| {h} | ))}
|---|
| {cell} | ))}