Events: archive button (hover) moves event to archived section;
archived events collapsible at bottom with count; PATCH /api/events/[id]
for status change; getArchivedEvents() query; page fetches both in parallel.
Commitments: inline edit mode per row (pencil icon on hover); PATCH
/api/commitments/[id] for description/dueDate/financialImpact; extracted
CommitmentItem client component, CommitmentsCard stays server component.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- getEvents: filter by EVENT_STATUS.ACTIVE (consistency with getEventsDueSoon)
- getGoalStats: use GOAL_STATUS constants in filter expressions
- getActionStats: use ACTION_STATUS constants in filter expressions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ACTION_STATUS covers the full draft→approved→executed/rejected/expired flow
with the iron-rule comment intact. ALERT_SEVERITY covers info/warning/urgent.
actions.ts, today.ts, AlertsCard.tsx now use constants throughout.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
today.ts line 87, money.ts commitments query, api/commitments/route.ts all
now use GOAL_STATUS/COMMITMENT_STATUS constants. Status SSOT is now complete.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
today.ts and money.ts now use GOAL_STATUS/SUB_STATUS/COMMITMENT_STATUS instead
of magic strings. Adds COMMITMENT_STATUS (active/fulfilled) and SUB_STATUS.UNVERIFIED
to complete the status constants SSOT across the full stack.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
goals/route.ts, goals/[id]/route.ts, subscriptions/route.ts now import from
lib/constants/statuses.ts instead of using magic strings. Completes SSOT for
status values across the full stack (DB → API → components).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the two helper components into project-overview-helpers.tsx.
ProjectOverviewTab drops from 401 → 257 lines.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ProgressInput, DateInput, AddMilestoneInline, MilestoneRow moved out of
GoalCard.tsx into a dedicated helpers file. GoalCard drops 507 → 240 lines.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract ScheduleModal and RunModal from the 649-line god component into
separate files. Add shared types.ts for Project type used by both modals.
PromptLibraryClient drops from 649 → 338 lines.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lib/api/goals.ts: new patchGoal/createGoal/deleteGoal/listGoals helpers,
replacing inline fetch blocks in GoalCard (removes local patchGoal fn),
NewGoalButton, DeleteGoalButton, and ProjectGoalsTab. Same pattern as
attrs/crons helpers established earlier.
lib/constants/statuses.ts: GOAL_STATUS and SUB_STATUS constants replace
hardcoded "active"/"completed"/"cancelled" strings across 7 files.
Type-safe, single rename point if values ever change.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
goals schema: export Milestone type as SSOT — removes duplicate local
definitions in GoalCard (correct shape) and ProjectDetail (narrower, missing date?).
lib/api/crons.ts: new helpers createCronJob/patchCronJob — eliminates
5 identical fetch blocks across AutopilotCard, ProjectDetail, PromptLibraryClient.
All callers now one-liners; API contract changes are a single-file edit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lib/api/attrs.ts: new SSOT for entity-attr mutation calls. Eliminates 9
identical fetch blocks (4 in ProjectDetail, 5 in PersonDetail) — all
now one-liners via setAttr/removeAttr.
SubscriptionActions: extract shared onDeleteRecord() to remove the
duplicate DELETE fetch from both <DeleteButton> onDelete callbacks.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both confirmDelete patterns in SubscriptionActions (post-cancel branch
and main actions bar) now delegate to the shared <DeleteButton> component.
Removes ~50 lines of duplicated state + JSX.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three SSOT violations fixed:
1. CronJob type was defined in an API route and imported by components/pages
— now lives in lib/crons.ts, re-exported from route for back-compat
2. system/page.tsx hardcoded the cron file path instead of using CRON_FILE
— replaced loadJobs() with readCronJobs() from lib/crons
3. getLinkedJobs() in projects API route duplicated the file-read pattern
— now delegates to readCronJobs(), simplified with filter+map
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
confirmDelete state + Yes/No UI was repeated in EventsGrid, PersonDetail,
ProjectDetail, and DeleteGoalButton. Extracted to components/ui/delete-button.tsx
which manages confirming/deleting state internally; callers pass only onDelete().
DeleteGoalButton simplified from 50 lines to 15.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Searches project name, description, and all attribute values.
Shows live count, zero-results message. No API round-trip — all
15 projects are already loaded.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PersonDetail.tsx had its own copy of HEALTH_LABEL identical to the one
in lib/utils.ts. Import from the SSOT instead.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
router.refresh() updates server props but can't re-initialize useState that
was already mounted. Instead, PersonCard calls onLogged(id, at) immediately
on success; PeopleGrid uses setPeople to update lastInteraction,
interactionCount, and health (via deriveRelationshipHealth) in place.
Card reflects the new state without any network round-trip.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
actions.ts was directly writing DB operations (update subscriptions set
status=cancelled) instead of delegating to the queries layer. Extracted
cancelSubscription() to db/queries/money.ts; actions.ts now calls it.
Matches the pattern used by all other server actions (approveAction,
rejectAction, dismissAlert, fulfillCommitment).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The "X contacts need attention" pill now links to /people?health=fading,stale,unknown
so it's immediately actionable rather than just informational.
People page now reads searchParams.health to initialize the health filter for
SSR and passes initialHealthFilter to PeopleGrid, which uses it as the initial
useState value. The skipInitialFetch ref still correctly suppresses the
redundant client fetch since SSR data already matches the filter.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SSOT fix: health day thresholds (14/30) were duplicated between lib/utils.ts
(JS) and db/queries/people.ts (SQL strings). Extracted HEALTH_ACTIVE_DAYS=14
and HEALTH_FADING_DAYS=30 from utils.ts; people.ts now imports and uses them
via make_interval(days => ${N}) for proper parameterized binding.
Mission: Today SummaryBar now shows "X contacts need attention" (amber pill)
counting all people not contacted in the last 14+ days. Query runs in parallel
with existing getTodaySummary queries. Gives daily relationship OS pulse
without needing Ivy to have generated check-in actions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
opacity-0 group-hover:opacity-100 means hover never fires on touch —
buttons for edit/delete/clear on goals, events, people attrs, project
attrs are permanently invisible on mobile.
Changed to sm:opacity-0 sm:group-hover:opacity-100 across 5 components
(9 occurrences): always visible below sm breakpoint, hover-revealed on
desktop. Decorative Zap hint in ProjectGrid left hover-only.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Log button used opacity-0 group-hover:opacity-100 which never fires
on touch devices. Changed to always-visible on mobile (opacity-100),
hover-revealed on sm+ (sm:opacity-0 sm:group-hover:opacity-100).
Also moved from absolute positioning to normal flow to avoid overlap.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DRY fix: SubscriptionActions had both subName (required) and name (optional)
passed identically as sub.name — name was introduced alongside subName without
removing the original, making editName initialize from name ?? subName. Removed
name prop; editName now initializes from subName directly.
UX fix: CommitmentsCard had a fulfill button but no way to remove a commitment
added by mistake. DELETE /api/commitments/[id] existed but was unused. Added
DeleteCommitmentButton (confirm → Del/No pattern) next to the fulfill button.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Avoids the open-PersonDetail → scroll → Log friction for the most
common daily action. Hover the card, click Log, pick channel + direction,
optional note, Enter/Log saves instantly with a 1.2s "Logged ✓" flash.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
No way to record new commitments from the UI previously; only Ivy could create them.
- api/commitments: POST (description required, dueDate + financialImpact optional)
- api/commitments/[id]: DELETE
- AddCommitmentButton: client component — "+ Add commitment" expands inline form,
POSTs then router.refresh() to rerender the server component with updated list
- CommitmentsCard: embeds AddCommitmentButton below the active commitments list
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
HEALTH_FILTER_LABELS in PeopleGrid was a hardcoded duplicate of RelationshipHealth
display strings. Moving to lib/utils.ts alongside HEALTH_DOT_COLOR ensures a single
source of truth: adding a new health value only requires updating utils.ts.
PersonDetail's local HEALTH_LABEL has distinct semantics (lowercase + "no interactions"
for unknown) so it intentionally stays local.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PersonDetail had a hardcoded CHANNELS const duplicating CHANNEL_CONFIG keys.
Adding a new channel to CHANNEL_CONFIG would have left the dropdowns stale.
- config/channels.ts: export CHANNEL_NAMES derived by stripping "channel:" prefix
- PersonDetail: import CHANNEL_NAMES, remove local CHANNELS const and Channel type
- Both interaction-log and add-channel selects now driven from single source
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GoalsGrid client component wraps the goals list with a search input.
Filters active + completed goals by title and description (case-insensitive).
Tree structure is preserved: parent shown if any descendant matches.
Count display shows "N / total" when filtering, total otherwise.
No API round-trip needed — goal counts are small enough for client filter.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
status: click badge → text input (free-form, e.g. "Production / Active")
maturity: click bar → range slider 1–10, saves as "N/10" format
Both write via POST /api/projects/[id]/attrs (upsert). Header row now
always shown when data is loaded so missing fields can be added directly
without touching the generic attrs grid.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PATCH endpoint already supported name/vendor; this wires up the UI.
Edit form now includes name (required) and vendor (optional) fields
above amount/currency. Initialises from current values so edits are
non-destructive. router.refresh() re-renders the server component.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
HEALTH_FILTERS array now built from the exported const, so new health statuses
are automatically included in the filter UI without a separate code change.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously the type was defined separately from any runtime value, so VALID_HEALTH
in the API route had to manually list the same values. Now the type is derived from
the const array, which is the SSOT. Adding a new health status requires one file change.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AttrRow now has a trash icon (group-hover reveal) that calls
DELETE /api/projects/[id]/attrs and reloads the panel.
Matches the delete capability in PersonDetail.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add trash icon to attr edit mode in DetailAttrs — visible when editing a row,
calls DELETE /api/people/[id]/attrs and updates lifted attrs state immediately.
Matches the delete capability already in ChannelsSection.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously null amount rendered as nothing, making the row look broken.
Now shows a dimmed dash with the currency code.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
EUR and GBP subscriptions were being bucketed into the USD total.
Now each currency is tracked separately in MonthlyBurn.
Monthly Burn stat card shows all non-zero currency totals.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously these 3 channel types fell back to MessageCircle (the WhatsApp icon),
making them visually identical to WhatsApp. Now each has a distinct icon.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Destructure paymentMethod prop properly and add its input field
to the inline edit form alongside amount/currency/notes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>