Hub 2.26.1: devotionals two years ahead; Apps fetch 2 weeks

Devotionals can be written, edited and imported up to two years ahead
(was 3 months), and a CSV holds two years in one file (800 rows, 8 MB).
GET /api/v2/devotionals answers 2 weeks (from and the 13 days after it)
instead of 3 months. Contracts 1.24.0 vendored. No migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 23:23:37 +02:00
co-authored by Claude Opus 5.5
parent 28b108a577
commit 20ea32d533
14 changed files with 73 additions and 52 deletions
+13
View File
@@ -5,6 +5,19 @@ versions follow [Semantic Versioning](https://semver.org/).
## [Unreleased]
## [2.26.1] - 2026-11-30
No migration; no API is removed. Contracts 1.24.0 (vendored).
### Changed
- **Devotionals up to two years ahead** (was 3 months; contracts
`CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS`): writing, editing and Import CSV take any day up to
two years from today, and the calendar shows them all. A CSV can hold two years in one file
(800 rows, 8 MB; was 400 and 2 MB).
- **`GET /api/v2/devotionals` answers 2 weeks** (`from` and the 13 days after it; contracts
`CROSSCODE_DEVOTIONALS_FETCH_DAYS`), not 3 months. An App fetches it every night.
## [2.26.0] - 2026-11-30
The Church App (crosscode-platform docs/APP-1.0-PLAN.md §6, §12). One migration
+6 -6
View File
@@ -1,16 +1,16 @@
{
"name": "events-hub-backend",
"version": "2.26.0",
"version": "2.26.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "events-hub-backend",
"version": "2.26.0",
"version": "2.26.1",
"hasInstallScript": true,
"dependencies": {
"@anthropic-ai/sdk": "^1.3.0",
"@crosscode/contracts": "file:vendor/crosscode-contracts-1.23.0.tgz",
"@crosscode/contracts": "file:vendor/crosscode-contracts-1.24.0.tgz",
"@prisma/adapter-pg": "^7.10.1",
"@prisma/client": "^7.10.1",
"bcryptjs": "^2.4.3",
@@ -609,9 +609,9 @@
"license": "MIT"
},
"node_modules/@crosscode/contracts": {
"version": "1.23.0",
"resolved": "file:vendor/crosscode-contracts-1.23.0.tgz",
"integrity": "sha512-2P86mOLRiPsfSFBxBdx65cATKqsUpZ/dcOWC6qIGJjLNq0h4RH1+nz3yYkbfMjl6HjdkBE6qc491cc5tLKIFZQ==",
"version": "1.24.0",
"resolved": "file:vendor/crosscode-contracts-1.24.0.tgz",
"integrity": "sha512-PmlpaFjnytV4WuxU4rvjAwuggLYQQKiCoH4K9tutk412uuDMlXNsqPsGe2eKSwp9eqOclMZzUkDw+ghnUYV7oQ==",
"license": "UNLICENSED",
"dependencies": {
"zod": "^4.6.7"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "events-hub-backend",
"version": "2.26.0",
"version": "2.26.1",
"private": true,
"description": "Cross Events Hub — API for managing Cross Events installs, licences and heartbeats",
"main": "src/index.js",
@@ -20,7 +20,7 @@
},
"dependencies": {
"@anthropic-ai/sdk": "^1.3.0",
"@crosscode/contracts": "file:vendor/crosscode-contracts-1.23.0.tgz",
"@crosscode/contracts": "file:vendor/crosscode-contracts-1.24.0.tgz",
"@prisma/adapter-pg": "^7.10.1",
"@prisma/client": "^7.10.1",
"bcryptjs": "^2.4.3",
+2 -2
View File
@@ -8,9 +8,9 @@ app.disable('x-powered-by');
// Installs call the Hub server-to-server; only the dashboard needs CORS.
app.use(cors({ origin: (process.env.FRONTEND_URL || 'http://localhost:3200').replace(/\/$/, '') }));
// 2.26.0: a devotionals CSV is up to 2 MB (contracts DEVOTIONAL_CSV_MAX_BYTES), sent as JSON text.
// 2.26.0: a devotionals CSV, sent as JSON text (2.26.1: up to 8 MB, contracts DEVOTIONAL_CSV_MAX_BYTES).
// Parsed here first; the parser below skips a body already read.
app.use('/api/admin/devotionals/import', express.json({ limit: '4mb' }));
app.use('/api/admin/devotionals/import', express.json({ limit: '12mb' }));
// Keep the exact bytes: heartbeat signatures are over the raw body. 300 KB fits the largest AI
// request the Hub accepts (utils/ai.js MAX_INPUT_TOKENS).
+3 -3
View File
@@ -1,6 +1,6 @@
/**
* Cross Code's devotionals (Hub 2.26.0, APP-1.0-PLAN §6): write and schedule them up to 3 months
* ahead, the calendar, Import CSV with its preview, and the template. Admin login required.
* Cross Code's devotionals (Hub 2.26.0, APP-1.0-PLAN §6): write and schedule them up to two years
* ahead (2.26.1; 3 months before), the calendar, Import CSV with its preview, and the template. Admin login required.
*/
const express = require('express');
@@ -30,7 +30,7 @@ router.get('/template.csv', (req, res) => {
res.send(DEVOTIONAL_CSV_TEMPLATE);
});
// A CSV comes as text in JSON ({ csv }), up to 2 MB (app.js parses these two with a larger limit).
// A CSV comes as text in JSON ({ csv }), up to 8 MB (app.js parses these two with a larger limit).
router.post('/import/preview', wrap(async (req, res) => {
res.json(await devotionals.previewCsv(req.body?.csv));
}));
+1 -1
View File
@@ -409,7 +409,7 @@ router.post('/installs/update-request/cancel', updateRequestLimiter, async (req,
// ─── Cross Code's devotionals (Hub 2.26.0, contracts hub.DEVOTIONALS_PATH) ─────
/**
* GET /api/v2/devotionals?from=YYYY-MM-DD: the next 3 months of Cross Code's devotionals for an App
* GET /api/v2/devotionals?from=YYYY-MM-DD: the next 2 weeks of Cross Code's devotionals for an App
* set to "From Cross Code" (once a night, and on "Sync now"). `Authorization: Bearer <licence
* token>`: App licences only, active or in their grace days.
*/
+17 -13
View File
@@ -1,15 +1,15 @@
/**
* Cross Code's devotionals (Hub 2.26.0, crosscode-platform docs/APP-1.0-PLAN.md §6, decisions 1, 5
* and 14; contracts crosscode.devotional/1). Written here, or imported from CSV, up to 3 months
* ahead, one per day, in the free translations only (KJV and BSB). An App set to "From Cross Code"
* fetches the next 3 months once a night (`GET /api/v2/devotionals`) and keeps its copy.
* and 14; contracts crosscode.devotional/1). Written here, or imported from CSV, up to two years
* ahead (2.26.1, contracts CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS; 3 months in 2.26.0), one per day, in the free translations only (KJV and BSB). An App set to "From Cross Code"
* fetches the next 2 weeks once a night (`GET /api/v2/devotionals`, 2.26.1; 3 months before) and keeps its copy.
*
* No AI touches a devotional's passage (Crossway and Biblica forbid it), and nothing here sends
* one: the Apps show and send them.
*/
const {
BIBLE_TRANSLATIONS, FREE_BIBLE_TRANSLATION_IDS, DEVOTIONAL_CSV_TEMPLATE, DEVOTIONAL_CSV_COLUMNS, CROSSCODE_DEVOTIONALS_AHEAD_MONTHS, DEVOTIONAL_SCHEMA, PASSAGE_WARN_VERSES,
BIBLE_TRANSLATIONS, FREE_BIBLE_TRANSLATION_IDS, DEVOTIONAL_CSV_TEMPLATE, DEVOTIONAL_CSV_COLUMNS, CROSSCODE_DEVOTIONALS_FETCH_DAYS, CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS, DEVOTIONAL_SCHEMA, PASSAGE_WARN_VERSES,
checkDevotionalCsv, devotionalContentSchema, devotionalsReplySchema, parseBibleReference, formatBibleReference, passageVerseCount,
youVersionUrl, bibleTranslation,
} = require('@crosscode/contracts');
@@ -30,8 +30,11 @@ function addMonths(date, months) {
return new Date(Date.UTC(y, m - 1 + months, Math.min(d, last))).toISOString().slice(0, 10);
}
/** The last day a devotional can be scheduled for: 3 months from today. */
const latestDate = (now = new Date()) => addMonths(today(now), CROSSCODE_DEVOTIONALS_AHEAD_MONTHS);
/** The last day a devotional can be scheduled for: two years from today (2.26.1). */
const latestDate = (now = new Date()) => addMonths(today(now), CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS);
/** "two years", "3 months": how far ahead, in words. */
const aheadWords = (m = CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS) => (m % 12 === 0 ? (m === 12 ? 'a year' : m === 24 ? 'two years' : `${m / 12} years`) : `${m} months`);
/** The translations the Hub offers (the free ones), for the form. */
function translations() {
@@ -49,7 +52,7 @@ function shape(row) {
/**
* The form's fields as devotional content: the passage parsed and written out in the
* translation's language, the free translations only, the date within 3 months.
* translation's language, the free translations only, the date within two years.
* Returns { devotional, warnings }.
*/
function contentFrom(input, now = new Date()) {
@@ -57,7 +60,7 @@ function contentFrom(input, now = new Date()) {
const date = String(b.date || '').trim();
if (!DATE.test(date)) throw fail(400, 'BAD_REQUEST', 'Give the date as YYYY-MM-DD.');
const latest = latestDate(now);
if (date > latest) throw fail(400, 'TOO_FAR_AHEAD', `Devotionals are scheduled up to ${CROSSCODE_DEVOTIONALS_AHEAD_MONTHS} months ahead (the last day is ${latest}).`);
if (date > latest) throw fail(400, 'TOO_FAR_AHEAD', `Devotionals are scheduled up to ${aheadWords()} ahead (the last day is ${latest}).`);
const translation = String(b.translation || '').trim().toUpperCase();
if (!FREE_BIBLE_TRANSLATION_IDS.includes(translation)) {
const t = BIBLE_TRANSLATIONS.find(x => x.id === translation);
@@ -109,7 +112,7 @@ async function overview(now = new Date()) {
const filled = new Set(rows.map(r => r.date));
const empty = [];
for (let d = from; d <= to; d = addDays(d, 1)) if (!filled.has(d)) empty.push(d);
return { today: from, latest: to, aheadMonths: CROSSCODE_DEVOTIONALS_AHEAD_MONTHS, devotionals: rows, empty, translations: translations(),
return { today: from, latest: to, aheadMonths: CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS, ahead: aheadWords(), appFetchDays: CROSSCODE_DEVOTIONALS_FETCH_DAYS, devotionals: rows, empty, translations: translations(),
csv: { columns: DEVOTIONAL_CSV_COLUMNS, template: DEVOTIONAL_CSV_TEMPLATE } };
}
@@ -136,7 +139,7 @@ async function create(input, admin, now = new Date()) {
async function update(id, input, now = new Date()) {
const existing = await prisma.devotional.findUnique({ where: { id } });
if (!existing) throw fail(404, 'NOT_FOUND', 'Devotional not found.');
// An old one keeps its date even when that's now in the past; a new date must be within 3 months.
// An old one keeps its date even when that's now in the past; a new date must be within two years.
const { devotional, warnings } = contentFrom(input, now);
if (devotional.date !== existing.date) {
const taken = await prisma.devotional.findUnique({ where: { date: devotional.date } });
@@ -187,11 +190,12 @@ async function importCsv(text, { replace = false } = {}, admin, now = new Date()
/**
* `GET /api/v2/devotionals?from=YYYY-MM-DD` (contracts hub.DEVOTIONALS_PATH): the devotionals
* from `from` (today by default) to 3 months on, for an App install.
* from `from` (today by default), for an App install: 2 weeks, `from` included (2.26.1,
* contracts CROSSCODE_DEVOTIONALS_FETCH_DAYS; 3 months before).
*/
async function reply(from, now = new Date()) {
const start = from || today(now);
const to = addMonths(start, CROSSCODE_DEVOTIONALS_AHEAD_MONTHS);
const to = addDays(start, CROSSCODE_DEVOTIONALS_FETCH_DAYS - 1);
const rows = (await list({ from: start, to })).slice(0, 100);
return devotionalsReplySchema.parse({
schema: DEVOTIONAL_SCHEMA, from: start, to,
@@ -203,4 +207,4 @@ async function reply(from, now = new Date()) {
/** The YouVersion link for a devotional's passage (the page's "Read in YouVersion"). */
const youVersionLink = d => youVersionUrl(d.passage.location, d.passage.translation);
module.exports = { today, addMonths, latestDate, translations, contentFrom, list, overview, get, create, update, remove, previewCsv, importCsv, reply, youVersionLink, DATE };
module.exports = { today, addMonths, addDays, latestDate, translations, contentFrom, list, overview, get, create, update, remove, previewCsv, importCsv, reply, youVersionLink, DATE };
+16 -13
View File
@@ -1,5 +1,5 @@
// Hub 2.26.0 (crosscode-platform docs/APP-1.0-PLAN.md §6): Cross Code's devotionals. Written up to 3
// months ahead in the free translations only, imported from CSV with a preview, and fetched by App
// Hub 2.26.0 (crosscode-platform docs/APP-1.0-PLAN.md §6): Cross Code's devotionals. Written up to two
// years ahead (2.26.1) in the free translations only, imported from CSV with a preview, and fetched by App
// installs (GET /api/v2/devotionals with the licence token; App licences only). Also the App's
// tier alert (its active-member band above its tier).
const crypto = require('crypto');
@@ -29,20 +29,21 @@ const form = (over = {}) => ({
beforeEach(() => { for (const k of Object.keys(db.tables)) db.tables[k].length = 0; });
describe('writing devotionals', () => {
test('a devotional: the passage written out, in a free translation, within 3 months', async () => {
test('a devotional: the passage written out, in a free translation, within two years', async () => {
const { devotional, warnings } = await devotionals.create(form(), admin, NOW);
expect(devotional).toMatchObject({ date: '2026-12-05', passage: { reference: '1 Corinthians 13:4–7', translation: 'BSB', text: 'Love is patient, love is kind.' }, prayer: 'Lord, teach me to love.' });
expect(warnings).toEqual([]);
await expect(devotionals.create(form({ title: 'Another' }), admin, NOW)).rejects.toMatchObject({ code: 'DATE_TAKEN' });
});
test('refused: a translation that needs permission, more than 3 months ahead, a reference that can\'t be read, an empty field', async () => {
expect(devotionals.latestDate(NOW)).toBe('2027-02-28');
test('refused: a translation that needs permission, more than two years ahead, a reference that can\'t be read, an empty field', async () => {
expect(devotionals.latestDate(NOW)).toBe('2028-11-30');
await expect(devotionals.create(form({ translation: 'NIV' }), admin, NOW)).rejects.toMatchObject({ code: 'TRANSLATION_NOT_FREE', message: expect.stringContaining('KJV or BSB') });
await expect(devotionals.create(form({ date: '2027-03-01' }), admin, NOW)).rejects.toMatchObject({ code: 'TOO_FAR_AHEAD', message: expect.stringContaining('2027-02-28') });
expect((await devotionals.create(form({ date: '2028-11-30', title: 'Two years on' }), admin, NOW)).devotional.date).toBe('2028-11-30');
await expect(devotionals.create(form({ date: '2028-12-01' }), admin, NOW)).rejects.toMatchObject({ code: 'TOO_FAR_AHEAD', message: expect.stringContaining('up to two years ahead (the last day is 2028-11-30)') });
await expect(devotionals.create(form({ reference: 'Hezekiah 1:1' }), admin, NOW)).rejects.toMatchObject({ code: 'BAD_REFERENCE' });
await expect(devotionals.create(form({ body: ' ' }), admin, NOW)).rejects.toMatchObject({ status: 400, message: expect.stringContaining('The devotional') });
expect(await db.devotional.findMany({})).toEqual([]);
expect((await db.devotional.findMany({})).map(d => d.date)).toEqual(['2028-11-30']);
});
test('a long passage is saved, with a warning', async () => {
@@ -56,7 +57,7 @@ describe('writing devotionals', () => {
await expect(devotionals.update(devotional.id, form({ date: '2026-12-06' }), NOW)).rejects.toMatchObject({ code: 'DATE_TAKEN' });
expect((await devotionals.update(devotional.id, form({ date: '2026-12-07', title: 'Moved' }), NOW)).devotional).toMatchObject({ date: '2026-12-07', title: 'Moved' });
const o = await devotionals.overview(NOW);
expect(o).toMatchObject({ today: '2026-11-30', latest: '2027-02-28', aheadMonths: 3 });
expect(o).toMatchObject({ today: '2026-11-30', latest: '2028-11-30', aheadMonths: 24, ahead: 'two years', appFetchDays: 14 });
expect(o.devotionals.map(d => d.date)).toEqual(['2026-12-06', '2026-12-07']);
expect(o.empty).toContain('2026-12-05');
expect(o.empty).not.toContain('2026-12-06');
@@ -72,12 +73,12 @@ describe('Import CSV', () => {
test('the preview checks every row: a translation needing permission, too far ahead, a day taken', async () => {
await devotionals.create(form({ date: '2026-12-11' }), admin, NOW);
const csv = devotionalCsv([row(), row({ date: '2026-12-11' }), row({ date: '2026-12-12', translation: 'ESV' }), row({ date: '2027-06-01' })]);
const csv = devotionalCsv([row(), row({ date: '2026-12-11' }), row({ date: '2026-12-12', translation: 'ESV' }), row({ date: '2028-12-01' })]);
const preview = await devotionals.previewCsv(csv, NOW);
expect(preview.fileError).toBeNull();
expect(preview.rows.map(r => [!!r.devotional, r.taken])).toEqual([[true, false], [true, true], [false, false], [false, false]]);
expect(preview.rows[2].errors[0].message).toContain('Crossway');
expect(preview.rows[3].errors[0].message).toContain('3 months');
expect(preview.rows[3].errors[0].message).toContain('too far ahead (the last day is 2028-11-30)');
});
test('importing saves the valid rows; days already filled are skipped or replaced', async () => {
@@ -109,16 +110,18 @@ describe('GET /api/v2/devotionals', () => {
}
const get = (token, query = '') => fetch(`${base}/v2/devotionals${query}`, { headers: token ? { Authorization: `Bearer ${token}` } : {} });
test("an App's licence token gets the next 3 months from `from`, as crosscode.devotional/1", async () => {
test("an App's licence token gets the next 2 weeks from `from`, as crosscode.devotional/1", async () => {
const today = devotionals.today();
const later = devotionals.addMonths(today, 1);
const later = devotionals.addDays(today, 13);
const tooLate = devotionals.addDays(today, 14);
await db.devotional.create({ data: { id: crypto.randomUUID(), date: tooLate, title: 'Too late', passage: { reference: 'John 3:16', location: { book: 'JHN', chapter: 3, verse: 16, endChapter: 3, endVerse: 16 }, translation: 'KJV', text: 'x' }, body: 'Body', prayer: null, author: null, updatedAt: new Date() } });
await db.devotional.create({ data: { id: crypto.randomUUID(), date: later, title: 'Later', passage: { reference: 'John 3:16', location: { book: 'JHN', chapter: 3, verse: 16, endChapter: 3, endVerse: 16 }, translation: 'KJV', text: 'For God so loved the world' }, body: 'Body', prayer: null, author: null, updatedAt: new Date() } });
await db.devotional.create({ data: { id: crypto.randomUUID(), date: '2020-01-01', title: 'Old', passage: { reference: 'John 3:16', location: { book: 'JHN', chapter: 3, verse: 16, endChapter: 3, endVerse: 16 }, translation: 'KJV', text: 'x' }, body: 'Body', prayer: null, author: null, updatedAt: new Date() } });
const res = await get(await licence());
expect(res.status).toBe(200);
const body = await res.json();
expect(devotionalsReplySchema.safeParse(body).success).toBe(true);
expect(body).toMatchObject({ from: today, to: devotionals.addMonths(today, 3) });
expect(body).toMatchObject({ from: today, to: later });
expect(body.devotionals.map(d => [d.date, d.source])).toEqual([[later, 'crosscode']]);
});
Binary file not shown.
Binary file not shown.
+3 -2
View File
@@ -264,9 +264,10 @@ X-Hub-Install / X-Hub-Timestamp / X-Hub-Signature (as in §3)
`GET /api/v2/devotionals?from=YYYY-MM-DD` (contracts `hub.DEVOTIONALS_PATH`), with
`Authorization: Bearer <the install's licence token>` (§4); no signature. An App set to "From
Cross Code" calls it once a night (and on "Sync now") and keeps what it gets, so a Hub outage
changes nothing.
of less than 2 weeks changes nothing.
- `from` defaults to today (South Africa); the answer covers `from` to 3 months on, one
- `from` defaults to today (South Africa); the answer covers `from` and the 13 days after it
(2 weeks, contracts `CROSSCODE_DEVOTIONALS_FETCH_DAYS`; Hub 2.26.0 answered 3 months), one
devotional per day at most, oldest first (`devotionalsReplySchema`, `crosscode.devotional/1`,
each with `source: "crosscode"`). The App replaces its copy of that range: a day missing from
the list was removed in the Hub.
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "events-hub-frontend",
"version": "2.26.0",
"version": "2.26.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "events-hub-frontend",
"version": "2.26.0",
"version": "2.26.1",
"dependencies": {
"lucide-react": "^0.536.0",
"next": "^15.5.24",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "events-hub-frontend",
"version": "2.26.0",
"version": "2.26.1",
"private": true,
"scripts": {
"dev": "next dev -p 3200",
+7 -7
View File
@@ -10,7 +10,7 @@ type Translation = { id: string; name: string; language: string; copyright: stri
type Passage = { reference: string; translation: string; text: string; location: unknown };
type Devotional = { id: string; date: string; title: string; passage: Passage; body: string; prayer: string | null; author: string | null; updatedAt: string };
type Overview = {
today: string; latest: string; aheadMonths: number; devotionals: Devotional[]; empty: string[];
today: string; latest: string; aheadMonths: number; ahead: string; appFetchDays: number; devotionals: Devotional[]; empty: string[];
translations: Translation[]; csv: { columns: string[]; template: string };
};
type CsvIssue = { column: string | null; message: string };
@@ -39,7 +39,7 @@ function months(from: string, to: string) {
return out;
}
/** The days from today to 3 months ahead: filled ones open their devotional, empty ones a new one. */
/** The days from today to two years ahead (2.26.1): filled ones open their devotional, empty ones a new one. */
function Calendar({ o, onOpen }: { o: Overview; onOpen: (date: string, d: Devotional | null) => void }) {
const byDate = useMemo(() => new Map(o.devotionals.map(d => [d.date, d])), [o]);
return (
@@ -53,7 +53,7 @@ function Calendar({ o, onOpen }: { o: Overview; onOpen: (date: string, d: Devoti
if (!day) return <span key={`pad-${i}`} />;
const inRange = day >= o.today && day <= o.latest;
const d = byDate.get(day) || null;
const label = `${longDate(day)}: ${d ? d.title : inRange ? "no devotional yet" : "outside the 3 months"}`;
const label = `${longDate(day)}: ${d ? d.title : inRange ? "no devotional yet" : "outside the dates allowed"}`;
return (
<button key={day} type="button" disabled={!inRange} title={label} aria-label={label} onClick={() => onOpen(day, d)}
className={`rounded py-1 ${!inRange ? "text-slate-300" : d ? "bg-emerald-100 font-medium text-emerald-900 hover:bg-emerald-200" : "bg-amber-50 text-amber-900 ring-1 ring-inset ring-amber-200 hover:bg-amber-100"} ${day === o.today ? "outline outline-2 outline-indigo-500" : ""}`}>
@@ -200,8 +200,8 @@ function ImportModal({ o, onClose, onDone }: { o: Overview; onClose: () => void;
/**
* Hub 2.26.0 (APP-1.0-PLAN §6): Cross Code's devotionals, for every Church App set to "From Cross
* Code". Written or imported up to 3 months ahead, in the free translations (KJV, BSB). Apps fetch
* the next 3 months once a night, so a change here reaches them by the next morning.
* Code". Written or imported up to two years ahead (2.26.1; 3 months before), in the free
* translations (KJV, BSB). Apps fetch the next 2 weeks once a night, so a change here reaches them by the next morning.
*/
export default function DevotionalsPage() {
const [o, setO] = useState<Overview | null>(null);
@@ -223,7 +223,7 @@ export default function DevotionalsPage() {
const total = o ? o.devotionals.length + o.empty.length : 0;
return (
<div>
<PageTitle title="Devotionals" subtitle="Cross Code's devotionals for every Church App set to “From Cross Code”: up to 3 months ahead, in the King James Version or the Berean Standard Bible. Apps fetch them every night."
<PageTitle title="Devotionals" subtitle="Cross Code's devotionals for every Church App set to “From Cross Code”: up to two years ahead, in the King James Version or the Berean Standard Bible. Each App fetches the next 2 weeks every night, so fill the days well ahead."
actions={o && (
<div className="flex flex-wrap gap-2">
<button type="button" className="btn-secondary" onClick={downloadTemplate}><Download className="h-4 w-4" /> Template</button>
@@ -238,7 +238,7 @@ export default function DevotionalsPage() {
<Stat label="Filled" value={`${o.devotionals.length} of ${total} days`} tone={o.empty.length ? "amber" : undefined} />
<Stat label="Next empty day" small value={o.empty[0] ? longDate(o.empty[0]) : "None"} onClick={o.empty[0] ? () => setPopup({ kind: "edit", date: o.empty[0], d: null }) : undefined} />
<Stat label="Filled until" small value={(() => { const gap = o.empty[0]; const until = o.devotionals.filter(d => !gap || d.date < gap).at(-1); return until ? longDate(until.date) : "Not today yet"; })()} />
<Stat label="Up to" small value={longDate(o.latest)} sub={`${o.aheadMonths} months ahead`} />
<Stat label="Up to" small value={longDate(o.latest)} sub={`${o.ahead} ahead`} />
</div>
<Calendar o={o} onOpen={(date, d) => setPopup({ kind: "edit", date, d })} />
<div className="card overflow-x-auto p-0">