diff --git a/src/components/chores/ChoreChart.tsx b/src/components/chores/ChoreChart.tsx index b6e100b..d2cbc14 100644 --- a/src/components/chores/ChoreChart.tsx +++ b/src/components/chores/ChoreChart.tsx @@ -21,23 +21,26 @@ interface ChoreItem { } function parseChore(item: { uid: string; summary: string; status: string }): ChoreItem { - // "Becca: Do dishes" → person=Becca, task=Do dishes - // "Take out trash" → person=null, task=Take out trash - const colonIdx = item.summary.indexOf(':'); + // Supports "Becca: Dishes", "Chris - Dishes", or just "Dishes" let person: string | null = null; let task = item.summary; let color = FALLBACK_COLOR; - if (colonIdx > 0 && colonIdx < 20) { - const prefix = item.summary.slice(0, colonIdx).trim().toLowerCase(); - if (PEOPLE[prefix]) { - person = item.summary.slice(0, colonIdx).trim(); - task = item.summary.slice(colonIdx + 1).trim(); - color = PEOPLE[prefix]; + // Try splitting on ":" or " - " + for (const sep of [':', ' - ', ' – ']) { + const idx = item.summary.indexOf(sep); + if (idx > 0 && idx < 20) { + const prefix = item.summary.slice(0, idx).trim().toLowerCase(); + if (PEOPLE[prefix]) { + person = item.summary.slice(0, idx).trim(); + task = item.summary.slice(idx + sep.length).trim(); + color = PEOPLE[prefix]; + break; + } } } - // Also check if any person name appears anywhere in summary + // Fallback: check if any person name appears anywhere if (!person) { for (const [name, c] of Object.entries(PEOPLE)) { if (item.summary.toLowerCase().includes(name)) {