Commit Graph
1304 Commits
Author SHA1 Message Date
g-butandClaude Opus 4.7 41fa885ce6 refactor(hooks): extract useInlineEdit, collapse 6 inline editors
Six inline-edit toggles across two files all hand-rolled the same
state machine: editing/draft/saving + start/cancel/setSaving wrap.
Pull that into hooks/use-inline-edit.ts.

Migrated:
- ProjectInlineEditors.tsx: NameEditor, DescriptionEditor, StatusEditor,
  MaturityEditor (4 editors, 221 → 200 lines)
- PersonDetail.tsx: name and description toggles (-30 lines of plumbing)

Each call site keeps its own validation/equality/transform — the hook
only owns the lifecycle. Net: -32 lines across the two files, and
adding a new inline editor anywhere is now ~3 calls of useInlineEdit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:31:37 +02:00
g-butandClaude Opus 4.7 941c5a8b80 refactor(ui): extract Field + FIELD_INPUT_CLASS, sweep New*Button forms
Every "New X" form repeated the same label-wrapping div and an 80-char
Tailwind className for inputs/selects/textareas — 15 call sites with
the exact same string. Pull that into components/ui/form.tsx:

- FIELD_INPUT_CLASS: shared className constant
- <Field label required>: label + child wrapper

The four migrated forms (Person, Project, Goal, Subscription) now read
as the form, not the form-styling. A future global tweak to input
visuals lands in one place.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:24:49 +02:00
g-butandClaude Opus 4.7 f78be4de0f refactor(hooks): extract useCreateMutation, drop the four-fold copy
The four "New X" buttons (Person, Project, Goal, Subscription) all
hand-rolled the same flow: setSaving(true), POST, decode { ok, error },
router.refresh(), surface a fallback "Failed to create <thing>". Pull
that into hooks/use-create-mutation.ts.

Each consumer now declares only its body type, the request fn (or a
typed lib helper like createGoal), and an errorLabel. The reset-fields
+ close logic stays per-component since the field shape varies.

Net: -20 lines across the four call sites, and adding a fifth "New X"
button is now a one-page implementation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:19:14 +02:00
g-butandClaude Opus 4.7 21b61cff64 refactor(prompts): collapse Run/Schedule modal wiring into hook
PromptRow and FeaturedCard each repeated the same showRun/showSchedule
useState pair plus the conditional <RunModal>/<ScheduleModal> renders.
Extract usePromptModals(template, projects) returning openRun,
openSchedule, and a modals JSX node. Both call sites now have one line
of state setup and one {modals} render — adding a third modal type
later means changing one file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:11:24 +02:00
g-butandClaude Opus 4.7 e74b857466 fix(projects): show subtle refresh indicator on in-place reload
When a child (e.g. an inline attribute editor) calls onReload(),
loading was no longer flashing because the loading derivation
(data?.id !== projectId) stays false during a same-projectId refetch.
That left the user with no feedback that the save updated the
displayed source-of-truth.

Add a separate `refetching` state set during every fetch and a small
animated Loader2 anchored to the drawer's top-right while refetching
with stale data on screen. The full-page loader still triggers on the
initial-load case (no data yet).

The setRefetching(true) call is wrapped in Promise.resolve().then() to
defer it off the synchronous effect path, satisfying
react-hooks/set-state-in-effect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:07:08 +02:00
g-butandClaude Opus 4.7 f14e162bad refactor(projects): split ProjectDetailHeader into focused components
ProjectDetailHeader.tsx (323 lines) tangled four inline-editing widgets
(name, description, status pill, maturity slider) with a tab bar and
the action toolbar in a single component. Splitting:

- ProjectInlineEditors.tsx (221L): Name/Description/Status/Maturity
  editors as named exports. Each owns its editing/draft/saving state
  and exposes a single onSave(next) callback. Container keeps the
  optimistic-override state so the UI updates immediately on commit.
- ProjectDetailTabBar.tsx (50L): tab strip with overview/prompts/goals
  badges.
- ProjectDetailHeader.tsx (156L): orchestration — resolves displayed
  values from data + overrides, wires the four save handlers, and
  composes the editors with the action toolbar and tab bar.

No behavior change. All three files are now under 300 lines with a
single concern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:02:52 +02:00
g-butandClaude Opus 4.7 3cf944bff6 refactor(prompts): split PromptLibraryClient into focused components
PromptLibraryClient.tsx (359 lines) housed four concerns: a compact
list row, a featured card, a category filter bar, and the search/scope
container. Splitting:

- PromptRow.tsx (89L): compact row with run/schedule/preview actions
- FeaturedCard.tsx (61L): larger card for the Quick Access grid
- CategoryBar.tsx (52L): "All (n)" + per-category filter chips
- PromptLibraryClient.tsx (148L): search, scope filter, and orchestration

Each file is now under the 300-line god-component threshold and owns a
single concern. ALL_CATEGORIES moved to CategoryBar and re-exported.
No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 16:59:05 +02:00
g-butandClaude Opus 4.7 ab34ad8aaa refactor(events): split EventsGrid into single-responsibility files
EventsGrid.tsx (371 lines) housed three concerns: an event card, an
inline create-event form, and the search/filter container. Splitting:

- EventCard.tsx (97L): presentation + delete + archive for one event
- AddEventForm.tsx (124L): self-contained inline create form
- EventsGrid.tsx (153L): search, type-chip filter, and list orchestration

Each file is now well under the 300-line god-component threshold and has
one job. No behavior change — purely a structural refactor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 16:55:47 +02:00
g-butandClaude Opus 4.7 6b7b34c60f refactor(ui): extract Modal/Drawer primitives, migrate 10 sites
Eliminates the duplicated 'fixed inset-0 z-50 + backdrop + Esc handler'
boilerplate that was repeated across 10 components. Modal and Drawer
now own:
- backdrop element + click-to-close
- window keydown Esc handler
- panel surface, border, sizing, shadow

Modal: centered with a 'bottom-mobile' position option (covers AskIvy's
bottom-anchored sheet on small screens). Accepts size sm/md/lg/xl/2xl,
padded, disableClose for in-flight async work.

Drawer: right-anchored. Surface variant ('drawer' | 'modal' |
'background') preserves the per-site shading that already existed
(ProjectDetail darker, JobDetail modal-shade, PersonDetail page bg).

Migrations:
- NewPersonButton, NewSubscriptionButton, NewGoalButton, NewProjectButton
- ScheduleModal, RunModal, AskIvyModal
- ProjectDetail, JobDetail, PersonDetail

Net: -58 lines, and a future modal palette tweak hits one file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 16:51:16 +02:00
g-butandClaude Opus 4.7 92fdf04e64 refactor(theme): replace hardcoded modal/drawer hex with CSS tokens
CLAUDE.md is explicit: 'Use shadcn theme tokens — never hardcode hex'.
The modal/drawer surface colors #0f1117 and #0c0e14 were duplicated
across 10 files, violating SSOT.

- globals.css: add --surface-modal / --surface-drawer custom properties
  in :root and .dark, register as Tailwind colors via @theme inline
- 10 components: bg-[#0f1117] → bg-surface-modal,
  bg-[#0c0e14] → bg-surface-drawer

A future palette tweak now changes 1 file, not 10.
Verified bg-surface-{modal,drawer} classes are present in the prod CSS.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 16:34:30 +02:00
g-butandClaude Opus 4.7 8cd50e77bb fix(lint): clear all React-hooks errors and unused imports
ESLint went from 6 errors / 17 warnings to 0/0:

react-hooks/set-state-in-effect (3 sites)
- ProjectDetail: derive loading from data?.id !== projectId, replace
  reload() helper with a reloadKey trigger so the effect owns the fetch
- AskIvyModal speech recognition: defer setSupported via queueMicrotask
- AskIvyModal useElapsedTimer: defer setElapsed(0) reset via queueMicrotask

react-hooks/static-components (1 site)
- WeatherCard: extract WeatherIcon as a module-level component instead
  of assigning a Lucide icon to a render-scope variable

react/no-unescaped-entities (2 sites)
- ProjectGrid: replace bare quotes around {query} with &ldquo;/&rdquo;

Plus: removed 14 unused imports/vars across 10 files.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 16:18:46 +02:00
g-butandClaude Opus 4.7 2431e31cb3 feat(habits): dedicated /habits page with 30-day heatmap
Adds a per-habit history view showing a 30-day completion calendar,
streak indicator, and completion-rate stat. Wires /habits into the
sidebar navigation.

- getAllHabitsWithHistory query batches habits + completions in window
- HabitHeatmap renders due/done/missed cells, marks today, respects
  per-habit frequency (daily, weekdays, weekly)
- Summary StatCards: active count, total completions, best streak

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 15:47:11 +02:00
g-butandClaude Sonnet 4.6 0ed6a88376 feat(habits): inline edit — rename and change frequency per row
API: PATCH /api/habits/[id] now handles both toggle (done: bool) and
edit (title + frequency). Added updateHabit() query.
UI: pencil icon appears on hover alongside delete; clicking opens an
inline form (title input + frequency select) in place of the row.
Enter/Escape shortcuts, optimistic local update, Escape cancels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 20:34:55 +02:00
g-butandClaude Sonnet 4.6 3fd50fd6ed fix(today): correct Promise.all destructuring order for habits/stale queries
Habits query is at index 7, stale contacts at 8 — destructuring had
them swapped, causing TS2352 type mismatch. Reorder to match array.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 20:21:50 +02:00
g-butandClaude Sonnet 4.6 23739218ba fix(habits): type error + wire habit progress into SummaryBar
Fix: HabitsList newFreq state typed as HabitFrequency to accept select value.
Feat: getTodaySummary now runs a parallel SQL query counting habits due
today (respects daily/weekdays/weekly frequency) and completions for
current_date. SummaryBar shows 'X/Y habits' pill — green when all done,
neutral otherwise. Hidden when no habits configured.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 20:17:45 +02:00
g-butandClaude Sonnet 4.6 6a690e918a feat(today): habit tracking card with daily check-off and streak
Schema: habits + habit_completions tables (unique per habit+date).
Queries: getTodayHabits (frequency-filtered, 7-day streak), toggle,
create, delete. API: GET/POST /api/habits, PATCH/DELETE /api/habits/[id].
UI: server HabitsCard + client HabitsList — optimistic toggle, flame
streak badge (>=2), inline add with frequency picker, hover-delete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 19:53:24 +02:00
g-butandClaude Sonnet 4.6 f3aa1e958f feat(today): add quick 'Log a conversation' widget
Inline search-as-you-type component below SummaryBar on Today page.
Two-step flow: search person → pick channel + optional note → POST to
/api/people/[id]/interactions. Refreshes /today so stale contacts pill
count updates immediately after logging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 19:37:28 +02:00
g-butandClaude Sonnet 4.6 dd2f00553c feat(people): auto-log interaction when approving check-in actions
When George approves a send_message/send_email/follow_up action tied
to an entity, createInteraction() now fires immediately so contact
health scores update without requiring a manual People → detail → log
interaction flow. Also revalidates /people on approval.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 19:31:32 +02:00
g-butandClaude Sonnet 4.6 9e524cc998 feat(events,commitments): add event archiving and commitment inline editing
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>
2026-04-24 18:16:43 +02:00
g-butandClaude Sonnet 4.6 9b6da430e2 refactor(money): add FREQUENCY constants, eliminate subscription frequency magic strings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:55:29 +02:00
g-butandClaude Sonnet 4.6 2c4f2f0ee0 refactor(constants): add ENTITY_TYPE constant, eliminate entity type magic strings
Covers 6 occurrences of 'person'/'project' across 6 files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:51:03 +02:00
g-butandClaude Sonnet 4.6 1159cec1db refactor(db): eliminate remaining SQL magic strings in filter/stats queries
- 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>
2026-04-23 09:46:40 +02:00
g-butandClaude Sonnet 4.6 9460a9993a refactor(money): use SUB_STATUS constants in ORDER BY CASE expression
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:41:39 +02:00
g-butandClaude Sonnet 4.6 b18c45dc01 refactor(constants): add DEFAULT_USER_EXTERNAL_ID, eliminate 'george' magic string
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:34:30 +02:00
g-butandClaude Sonnet 4.6 40b0aeaae7 refactor(projects): extract ProjectDetailHeader, reduce ProjectDetail 363→74 lines
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:31:55 +02:00
g-butandClaude Sonnet 4.6 da8c6f505d refactor(events): add EVENT_STATUS constant, eliminate magic strings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:27:56 +02:00
g-butandClaude Sonnet 4.6 7ea3711f9b refactor(today): use ACTION_STATUS constants in ActionButtons
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:25:27 +02:00
g-butandClaude Sonnet 4.6 f0699f884b refactor(constants): add ACTION_STATUS + ALERT_SEVERITY; replace magic strings
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>
2026-04-23 09:21:32 +02:00
g-butandClaude Sonnet 4.6 57b9f113a5 refactor(db): fix remaining hardcoded status strings missed in prior pass
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>
2026-04-23 09:16:35 +02:00
g-butandClaude Sonnet 4.6 2d6cacb993 refactor(db): use status constants in DB queries; add COMMITMENT_STATUS + SUB_STATUS.UNVERIFIED
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>
2026-04-23 09:11:13 +02:00
g-butandClaude Sonnet 4.6 c221216e05 refactor(api): replace hardcoded status strings with GOAL_STATUS/SUB_STATUS constants
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>
2026-04-23 09:07:25 +02:00
g-butandClaude Sonnet 4.6 7a3563bc22 refactor(projects): extract AddAttrInline + AttrRow from ProjectOverviewTab
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>
2026-04-23 09:00:20 +02:00
g-butandClaude Sonnet 4.6 544f89745c refactor(goals): extract GoalCard sub-components to goal-card-helpers.tsx
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>
2026-04-23 08:56:21 +02:00
g-butandClaude Sonnet 4.6 36ad0b2e6c refactor(people): decompose PersonDetail god component into focused files
Extract InteractionsSection, DetailAttrs, ChannelsSection into separate files.
Add person-detail-types.ts (types + pure utils) and PersonDetailHelpers.tsx
(Section + ChannelIcon shared helpers). PersonDetail drops 667 → 210 lines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 08:54:00 +02:00
g-butandClaude Sonnet 4.6 e0632a01d4 refactor(prompts): decompose PromptLibraryClient into focused modal files
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>
2026-04-23 08:48:27 +02:00
g-butandClaude Sonnet 4.6 add80b8389 refactor: extract goals API helpers + centralize status string constants
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>
2026-04-23 08:41:10 +02:00
g-butandClaude Sonnet 4.6 60e7585294 refactor(projects): decompose 1142-line ProjectDetail into focused modules
Split into 4 files with single responsibilities:
- project-detail-types.ts  — shared types + constants (53 lines)
- ProjectOverviewTab.tsx   — attrs, activity, relations + AddAttrInline/AttrRow (401 lines)
- ProjectPromptsTab.tsx    — jobs/crons + JobRow/NewJobForm (170 lines)
- ProjectGoalsTab.tsx      — goal linking/unlinking (146 lines)

ProjectDetail.tsx is now a thin coordinator: header editing state + tab
routing only (363 lines, down from 1142). Zero behaviour changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 08:23:21 +02:00
g-butandClaude Sonnet 4.6 87db0019e8 refactor: centralize Milestone type + extract cron API helpers
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>
2026-04-23 04:13:51 +02:00
g-butandClaude Sonnet 4.6 4fb4f4aa6e refactor: extract setAttr/removeAttr helpers, dedupe SubscriptionActions DELETE
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>
2026-04-23 04:06:24 +02:00
g-butandClaude Sonnet 4.6 90370a5b6d refactor(money): replace inline confirm-delete flows with DeleteButton
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>
2026-04-23 04:00:35 +02:00
g-butandClaude Sonnet 4.6 eb813994be refactor(crons): move CronJob type + read helper to lib/crons.ts
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>
2026-04-23 03:55:49 +02:00
g-butandClaude Sonnet 4.6 35122229d6 refactor: extract shared DeleteButton — eliminate 5 inline confirm patterns
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>
2026-04-23 03:48:23 +02:00
g-butandClaude Sonnet 4.6 8d81c976a3 feat(projects): add client-side search filter to ProjectGrid
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>
2026-04-23 03:38:59 +02:00
g-butandClaude Sonnet 4.6 3be85b5aed fix(people): remove local HEALTH_LABEL redeclaration in PersonDetail
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>
2026-04-23 03:37:08 +02:00
g-butandClaude Sonnet 4.6 2b3ad14438 fix(people): optimistic update on quick-log — no refresh needed
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>
2026-04-23 03:29:27 +02:00
g-butandClaude Sonnet 4.6 ff6e85e57a refactor(actions): move cancelSubscription DB logic to queries layer
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>
2026-04-23 03:22:54 +02:00
g-butandClaude Sonnet 4.6 6d6dea73b1 feat(today): make stale-contacts pill a link to pre-filtered People page
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>
2026-04-23 03:19:05 +02:00
g-butandClaude Sonnet 4.6 cd8f3822db feat(today): stale contacts pill in SummaryBar + fix SSOT for health thresholds
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>
2026-04-23 03:15:14 +02:00
g-butandClaude Sonnet 4.6 67add18793 fix(mobile): make all action buttons accessible on touch devices
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>
2026-04-23 03:07:45 +02:00
g-butandClaude Sonnet 4.6 225bb906dd fix(people): quick-log button visible on mobile — was permanently hidden
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>
2026-04-23 03:06:17 +02:00