// "Your reading": how much of the Bible you have read (every chapter you spent time on in the Reader, plus the // ones you finished in reading plans), a tile for each book that fills as you read it, and a calendar of the // days you read in the last six months. import { useMemo } from 'react'; import { getPlanSchedule } from '../utils/readingPlans.js'; import { heatmapWeeks, planChapterKeys, progressSummary } from '../utils/readingHistory.js'; const pct = (n) => `${Math.round(n * 100)}%`; export default function ReadingProgress({ history, planProgress = [], activity = [], onOpenBook }) { const summary = useMemo(() => progressSummary(history, planChapterKeys(planProgress, getPlanSchedule)), [history, planProgress]); const days = useMemo(() => new Set([...(history.days ?? []), ...activity]), [history.days, activity]); const weeks = useMemo(() => heatmapWeeks(days), [days]); const daysInView = weeks.flat().filter((d) => d.on).length; const group = (list) => (
{pct(summary.pct)} of the Bible · {summary.read} of {summary.total} chapters
Old Testament {summary.ot.read}/{summary.ot.total} · New Testament {summary.nt.read}/{summary.nt.total}. A chapter counts once you’ve had it open for a bit in the Reader, or finished it in a plan.