Improve quiz note and navigation layout
All checks were successful
Mobile Android Release / android-release (push) Successful in 1m33s

This commit is contained in:
Daniel 2026-05-14 17:30:08 +02:00
parent 55713902ed
commit 95de56d81b
2 changed files with 16 additions and 2 deletions

View file

@ -30,6 +30,7 @@ export default function MyNote({ variant = 'tab' }) {
const loadedRef = useRef(false) const loadedRef = useRef(false)
const dragRef = useRef(null) const dragRef = useRef(null)
const draggedRef = useRef(false) const draggedRef = useRef(false)
const textareaRef = useRef(null)
const loadNote = async () => { const loadNote = async () => {
if (loadedRef.current) return if (loadedRef.current) return
@ -107,6 +108,18 @@ export default function MyNote({ variant = 'tab' }) {
return () => clearTimeout(saveRef.current) return () => clearTimeout(saveRef.current)
}, [content]) }, [content])
useEffect(() => {
if (!open || loading) return
requestAnimationFrame(() => {
const textarea = textareaRef.current
if (!textarea) return
const end = textarea.value.length
textarea.focus()
textarea.setSelectionRange(end, end)
textarea.scrollTop = textarea.scrollHeight
})
}, [open, loading])
const openNote = () => { const openNote = () => {
setOpen(true) setOpen(true)
loadNote() loadNote()
@ -184,6 +197,7 @@ export default function MyNote({ variant = 'tab' }) {
</div> </div>
{error && <div className="mynote-error">{error}</div>} {error && <div className="mynote-error">{error}</div>}
<textarea <textarea
ref={textareaRef}
value={content} value={content}
onChange={e => setContent(e.target.value)} onChange={e => setContent(e.target.value)}
placeholder={loading ? 'Loading MyNote...' : 'Capture one running note across all quizzes...'} placeholder={loading ? 'Loading MyNote...' : 'Capture one running note across all quizzes...'}

View file

@ -974,12 +974,12 @@ const timerStarted = timeLeft !== null
<div className="fill" style={{ width: `${((currentIdx + 1) / totalCount) * 100}%` }} /> <div className="fill" style={{ width: `${((currentIdx + 1) / totalCount) * 100}%` }} />
</div> </div>
{quizNavigation('top')}
{/* Two-column layout: content + desktop sidebar */} {/* Two-column layout: content + desktop sidebar */}
<div className="quiz-layout"> <div className="quiz-layout">
{/* Main content */} {/* Main content */}
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
{quizNavigation('top')}
{current && ( {current && (
<div className="question-card" style={{ <div className="question-card" style={{
boxShadow: activeReadForCurrent ? '0 0 0 3px rgba(59, 130, 246, 0.22)' : undefined, boxShadow: activeReadForCurrent ? '0 0 0 3px rgba(59, 130, 246, 0.22)' : undefined,