@@ -14,6 +14,7 @@ interface QuizBoardProps {
1414 questions : Question [ ] [ ] ;
1515 onUpdateTheme : ( index : number , name : string ) => void ;
1616 onQuestionClick : ( themeIndex : number , questionIndex : number ) => void ;
17+ readonly ?: boolean ;
1718}
1819
1920export function QuizBoard ( {
@@ -22,6 +23,7 @@ export function QuizBoard({
2223 questions,
2324 onUpdateTheme,
2425 onQuestionClick,
26+ readonly = false ,
2527} : QuizBoardProps ) {
2628 const [ editingTheme , setEditingTheme ] = useState < number | null > ( null ) ;
2729 const theme2LineBreaks = board === 2 ;
@@ -43,7 +45,7 @@ export function QuizBoard({
4345 damping : 22 ,
4446 stiffness : 180 ,
4547 } }
46- className = " w-[21%] relative flex items-center rounded-xl overflow-hidden cursor-text group"
48+ className = { ` w-[21%] relative flex items-center rounded-xl overflow-hidden group ${ readonly ? " cursor-default" : "cursor-text" } ` }
4749 style = { {
4850 background : "linear-gradient(105deg, hsla(270,40%,12%,0.95) 0%, hsla(270,30%,9%,0.7) 100%)" ,
4951 borderLeft : "3px solid hsla(280,65%,58%,0.85)" ,
@@ -52,7 +54,7 @@ export function QuizBoard({
5254 borderLeftColor : "hsla(280,65%,58%,0.85)" ,
5355 boxShadow : "inset 0 0 30px hsla(280,60%,15%,0.4)" ,
5456 } }
55- onClick = { ( ) => setEditingTheme ( tIdx ) }
57+ onClick = { ( ) => ! readonly && setEditingTheme ( tIdx ) }
5658 >
5759 { /* Hover shimmer */ }
5860 < motion . div
@@ -140,23 +142,25 @@ export function QuizBoard({
140142 stiffness : 200 ,
141143 } ,
142144 } }
143- whileHover = { ! q . used ? {
145+ whileHover = { ! q . used && ! readonly ? {
144146 scale : 1.06 ,
145147 y : - 3 ,
146148 transition : { type : "tween" , duration : 0.08 , ease : "easeOut" } ,
147149 } : { } }
148- whileTap = { ! q . used ? {
150+ whileTap = { ! q . used && ! readonly ? {
149151 scale : 0.94 ,
150152 transition : { type : "tween" , duration : 0.06 } ,
151153 } : { } }
152154 transition = { { type : "tween" , duration : 0.1 , ease : "easeOut" } }
153- onClick = { ( ) => onQuestionClick ( tIdx , qIdx ) }
155+ onClick = { ( ) => ! readonly && onQuestionClick ( tIdx , qIdx ) }
154156 className = { `
155157 relative w-full h-full rounded-xl border flex items-center justify-center
156158 font-display font-bold transition-colors duration-150
157159 ${ q . used
158160 ? "bg-background/20 border-border/50 text-muted-foreground/30 cursor-not-allowed"
159- : "bg-secondary/40 border-accent/30 text-primary hover:bg-secondary hover:border-accent hover:shadow-[0_0_22px_hsla(280,65%,50%,0.45)] cursor-pointer"
161+ : readonly
162+ ? "bg-secondary/40 border-accent/30 text-primary cursor-default"
163+ : "bg-secondary/40 border-accent/30 text-primary hover:bg-secondary hover:border-accent hover:shadow-[0_0_22px_hsla(280,65%,50%,0.45)] cursor-pointer"
160164 }
161165 ` }
162166 >
0 commit comments