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:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user