// Insights: your studies seen together — this week's own work, themes (tags), words you keep studying, // what slipped in recalls, and follow-ups still open. import { useMemo } from 'react'; import { useApp } from '../context/AppContext.js'; import PageShell from '../components/study/PageShell.jsx'; import { loadProjectById } from '../utils/projectStorage.js'; import { followUpList, slippedList, themeIndex, weeklySummary, wordIndex } from '../utils/insights.js'; const card = 'rounded-2xl border border-[var(--r-line)] bg-[var(--r-bar)] p-5'; const open = 'text-xs text-[var(--r-accent)] hover:underline'; function Stat({ label, value }) { return (

{value}

{label}

); } export default function InsightsPage() { const { projectIndex, openStudyChunk, goHome } = useApp(); const data = useMemo(() => { const projects = projectIndex.map((e) => loadProjectById(e.id)).filter(Boolean); return { week: weeklySummary(projects), themes: themeIndex(projects), words: wordIndex(projects), slipped: slippedList(projects), followUps: followUpList(projects) }; }, [projectIndex]); const { week, themes, words, slipped, followUps } = data; const link = (item) => ; return (

This week

Counted over the chunks you edited in the last 7 days. Pasted text isn’t counted as yours.

{(week.teachBacks > 0 || week.fiveMinutes > 0) &&

{[week.fiveMinutes > 0 && `${week.fiveMinutes} five-minute session${week.fiveMinutes === 1 ? '' : 's'}`, week.teachBacks > 0 && `${week.teachBacks} teach-it-back summar${week.teachBacks === 1 ? 'y' : 'ies'}`].filter(Boolean).join(' · ')} this week.

}

Follow-ups

{followUps.length === 0 ?

None yet. Add them under “More” in the Study stage.

: (
    {followUps.map((f) => (
  • {f.text} {link(f)}
  • ))}
)}

What slipped in recalls

{slipped.length === 0 ?

Nothing yet. After a weekly recall, note what you missed.

: (
    {slipped.map((r) => (
  • {new Date(r.at).toLocaleDateString()} · {link(r)}

      {r.items.map((i) =>
    • {i}
    • )}
  • ))}
)}

Themes

{themes.length === 0 ?

Tag a chunk (under “More”) and it appears here with every other chunk on the same theme.

: (
{themes.map((t) => (
{t.tag} · {t.count} chunk{t.count === 1 ? '' : 's'}
    {t.items.map((i) => (
  • {link(i)}{i.snippet &&

    {i.snippet}

    }
  • ))}
))}
)}

Words you keep studying

{words.length === 0 ?

Words you study in two or more places show up here.

: (
    {words.map((w) => (
  • {w.lexeme} {[w.transliteration, w.strong, w.gloss].filter(Boolean).join(' · ')} · {w.count} places {w.places.map((p) => {link(p)})}
  • ))}
)}
); }