Files
study-bible-project/src/utils/planStudy.js
T
nmemmertandClaude Sonnet 5.5 eccc5e509d Studying: daily five minutes, reading list, plan-day studies use your template
- Home: "Your five minutes": a rotating Observe/Interpret/Apply prompt on the
  passage whose matching note is thinnest in your own words, a 5:00 clock and a
  box that appends to that note. Pasting is blocked; sessions show in Insights.
- Study: a Reading list tab (R) for the study: books and articles to consult,
  with a note and a tick; merges across devices.
- Starting a study from a reading-plan day now uses the notes template you last
  picked when starting a study by hand (logic moved to utils/planStudy.js).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 13:51:49 -04:00

34 lines
1.6 KiB
JavaScript

// A study started from one day of a reading plan: a chunk for each whole chapter in the day, with the notes template
// you last used when starting a study by hand (so the prompts and starter text are the ones you're used to).
import { templateStarter } from './studyTemplates.js';
export const lastTemplateId = () => { try { return localStorage.getItem('last-template') || 'blank'; } catch { return 'blank'; } };
export const rememberTemplate = (id) => { try { localStorage.setItem('last-template', id || 'blank'); } catch { /* storage unavailable */ } };
// chapters: [{ bookAbbrev, bookName, chapter, verses: [{ number, text }] }]; ids come from `makeId`.
export function planStudyProject({ chapters, title, templateId = 'blank', templateDef = null, makeId, now = Date.now() }) {
const built = chapters.map(({ bookAbbrev, bookName, chapter, verses }) => ({
book: bookName, bookAbbrev, chapter: String(chapter), verses,
chunks: [{
id: makeId(),
startVerse: verses[0]?.number ?? 1,
endVerse: verses.at(-1)?.number ?? 1,
spilloverEndVerse: null,
observation: '', interpretation: '', application: '',
crossReferences: [], greekWords: [], generalNotes: '',
episodeNumber: '', episodeTitle: '', finalScript: '', tags: [],
...templateStarter(templateDef ?? templateId),
}],
}));
return {
id: makeId(),
title: title || 'Reading Plan Study',
translation: 'BSB',
templateId,
...(templateDef ? { templateDef } : {}),
lastEdited: now,
selectedChunkId: built[0]?.chunks[0]?.id ?? null,
chapters: built,
};
}