Make uploaded calendars live with drag-and-drop days and readable chips.

Posts persist to the tenant calendar document when moved; contrast on the month grid no longer uses dark text on dark fills.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-10-06 17:07:09 +02:00
parent 91380e2285
commit 392af11060
5 changed files with 355 additions and 80 deletions

View File

@@ -121,8 +121,18 @@ export function mergePipelineIntoPlans(
for (const it of items) {
const day = pipelinePublishDay(it);
if (!day) continue;
const ym = day.slice(0, 7);
let plan = byMonth.get(ym);
const ig = instagramUrlFromNotes(it.notes);
const igKey = normPermalink(ig);
let existing: CalendarPieceLike | undefined;
let plan = out.find((p) => p.pieces.some((x) => x.pipeline_id === it.id));
if (plan) {
existing = plan.pieces.find((p) => p.pipeline_id === it.id);
}
const ym = (existing?.date || day).slice(0, 7);
if (!plan) {
plan = byMonth.get(ym);
}
if (!plan) {
const label = monthLabel(ym);
plan = {
@@ -140,15 +150,15 @@ export function mergePipelineIntoPlans(
out.push(plan);
byMonth.set(ym, plan);
}
const ig = instagramUrlFromNotes(it.notes);
const igKey = normPermalink(ig);
const existing = plan.pieces.find((p) => {
if ((p.date || '').slice(0, 10) !== day) return false;
if (igKey && normPermalink(p.meta_line) === igKey) return true;
const a = (p.title || '').toLowerCase().slice(0, 28);
const b = (it.title || '').toLowerCase().slice(0, 28);
return a && b && (a.includes(b) || b.includes(a));
});
if (!existing) {
existing = plan.pieces.find((p) => {
if ((p.date || '').slice(0, 10) !== day) return false;
if (igKey && normPermalink(p.meta_line) === igKey) return true;
const a = (p.title || '').toLowerCase().slice(0, 28);
const b = (it.title || '').toLowerCase().slice(0, 28);
return a && b && (a.includes(b) || b.includes(a));
});
}
const slides = slidesOf(it.slide_paths);
if (existing) {
existing.pipeline_id = it.id;