Commit Graph
84 Commits
Author SHA1 Message Date
CatoandClaude 4a40a03d44 feat(charts): health trends and twin meters on @bitbaum/chartkit 0.7 (#141)
ChartKit 0.7.0 closes both gaps recorded in package-plan.json (#140):
LineChart now labels days on a 30-day span, and Meter takes a tone and
showValue={false}.

- HealthTrendChart renders ChartKit's LineChart on the server: one line
  per metric, the species' normal range as a reference band, the portal
  locale for dates and numbers. A day without a reading is left out of
  that line. The trend charts sit one per row: in the portal's 4xl
  column, three across left each plot about 190px and the day ticks ran
  into each other.
- The twin score and per-metric bars (DigitalTwinCard, public pet page,
  portal dashboard) are ChartKit Meters coloured by the twin state's
  tone, with the figure printed once by the page.
- The twin score block wraps under the state name on a narrow card; at
  390px in German it was clipped ("41 / 1") before this change.
- recharts is removed, with the chart colour config and the tooltip
  shadow that only it used. Both exceptions leave package-plan.json; the
  bindings are recorded instead.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-29 20:02:23 +01:00
CatoandClaude Opus 5.5 5ea4dab4fa fix(copy): every public claim matches the code — contact, legal, pricing, pros, 9 locales (#106)
* fix(copy): contact mail goes to a mailbox that exists

hello@ and support@petvity.com sat on the footer, every legal page, the
structured data and every email template. petvity.com is not ours (it is a
Netlify site with Zoho MX; lib/config/email.ts already lists it as "not
ours"), so privacy and support mail went to a stranger. APP.email is now
cato@orangecat.ch, the one address on the receiving apex, and supportEmail
is folded into it. lib/config/app.test.ts fails if it leaves the apex.

The pet-edit form also showed "petvity.com/pets/" as the share prefix; it
now derives the host from APP_URL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): privacy and cookie policies describe the running system

Privacy: Neon was decommissioned in 2026-06 (the database is PostgreSQL on
the same Hetzner box, listening on 127.0.0.1 only), Google sign-in is not
configured in production while OrangeCat sign-in is, groomers and guest
checkout were missing, and "database connections use TLS" did not hold for
a localhost connection.

Cookies: Auth.js v5 sets authjs.* cookies, not next-auth.*, plus PKCE/state
cookies during OrangeCat sign-in; NEXT_LOCALE is a session cookie set on any
locale page, not a one-year cookie set only by the switcher.

Effective dates moved to October 2, 2026.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): marketing pages say only what the product does, in all 9 languages

- pricing: Pro and Clinic cards cut. Their buttons were href="#", neither
  plan is on ROADMAP.md, yet the FAQ called them "next".
- pros: cut vets reading clients' health history and sitters logging health
  during stays (records are owner-scoped; "Vet-facing records" is 0% on the
  roadmap), the unmeasured "growing community" card, and a sitter card that
  repeated its heading. Reviews tie to completed bookings, not confirmed ones.
- features: no refill tracking exists; charts span 30 days, not months; the
  twin is not built from 30 days on the dashboard (7); unverified pros are
  listed; cross-border adoption and "any language" were not true; handle host
  is the live one; groomers added.
- about: the "Behind the project" section was empty in 4 locales and claimed
  "a team of software engineers" in 5; cut.
- ar/ja/ko/tr/zh: the features, pricing, pros and about pages carried an
  older, differently ordered copy (stats swapped, "data export coming soon",
  "VitaReba"); retranslated from the current English.
- CHANGELOG: removed "health metrics that matter per species" (the
  observations config is not wired into any screen) and the Stripe claim;
  added 2026-10-02. ROADMAP: OrangeCat sign-in shipped, Google item dropped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): close the gaps the verifier found, in all 9 languages

- Cookie policy names both ways NEXT_LOCALE is set: a session cookie per
  page, one year when picked with the language switcher.
- Privacy policy lists the Loki feedback widget as a service provider.
- /pros no longer says owners share pet records or Digital Twin data with
  vets and sitters (a booking shows them only the pet's name): rewrote
  metaDesc, heroDesc, vet/sitter hero copy; cut vb1 ("months of structured
  health history"); dropped 72 unrendered pros keys that still shipped the
  same claims in every page's message payload.
- Cut unmeasured timings: home heroSub ("30-second check-in"),
  benefitTrackDesc ("in 30 seconds"), "set up in minutes", "a few minutes".
- Species guide CTA: a record to show your vet, not one shared with them.
- ROADMAP/CHANGELOG: email+password sign-up still works for new users;
  changelog line lists what was cut instead of claiming all copy is true.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(copy): privacy names what an OrangeCat sign-in stores; drop a dead features key

- Privacy, "Data we collect": an OrangeCat sign-in also stores the name and
  profile picture from the OrangeCat account (accountkit's orangecatProfile
  maps name and picture onto users.name and users.image), not only the id.
- features.heroSubtitle is rendered nowhere but still shipped in every page's
  message payload, carrying "cross-border adoption" and "in any language" —
  both cut elsewhere in this PR. Removed from all nine locales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-29 17:45:53 +01:00
Cato b9c4899ee7 feat(auth): one password rule from accountkit (non-empty, up to 128); no local minimum or hint text (#123) 2026-10-28 03:53:21 +01:00
Cato 6a3044927b feat(auth): password recovery uses the shared accountkit form (#122)
Forgot/reset pages render PasswordRecoveryForm from @bitbaum/accountkit 0.8.1
through a small adapter over Petvity's own routes, so users, bcrypt passwords,
roles and Auth.js sessions are untouched. The hand-written pages could stay
stuck after a network error; the shared form leaves its busy state and says so.
The reset route now answers an invalid link with code INVALID_TOKEN.
2026-10-28 01:29:57 +01:00
CatoandClaude f1e98e2ae6 fix(layout): one <html>, so the fonts and the language survive navigation (#114)
The owner walked the site with Loki on 2026-10-18 and said the design was
inconsistent between the home page and the portal. It was, and not by
design: app/[locale]/layout.tsx rendered a second <html> inside the root
one. React keeps one document element and, when that nested <html>
unmounted on a client navigation from the marketing site into /login or
/portal, cleared what it had set on it — lang, dir and the font classes.
Measured on the live site, /de → /login without a reload: lang null,
class "", body font Roboto instead of Plus Jakarta Sans, headings out of
Jost. Loki's checks also kept reporting "the page does not declare its
language", which was true after every such navigation. German pages
were also served as lang="en" (the browser kept the first <html>'s).

- The root layout renders the only <html>, with the request's locale and
  direction (next-intl getLocale: the URL's on the localized site, the
  default elsewhere).
- Each route group keeps document lang/dir right across client
  navigations with a small client component (DocumentLanguage):
  [locale] with the URL's locale, the portal with the user's, auth and
  admin in English.
- lib/i18n/one-html.test.ts: only the root layout renders <html>, and
  every route group says its language.

Checked on a production build: /de, /login and /ar serve one <html> each
with lang de / en / ar and dir rtl for Arabic; /de → /login → /de/features
by client navigation keeps the font classes and the right lang at every
step.


Claude-Session: https://claude.ai/code/session_01TNLstupcdvsPfTjy8yjR67

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 08:17:21 +02:00
CatoandClaude Sonnet 5.5 9450bc14ed feat(forms): dates read in words — all date fields use @bitbaum/whenkit's DateInput (#109)
Twelve raw <input type="date"> fields (pet birth date, health log,
vaccinations, medications, records, availability, provider search) showed the
browser's bare "tt.mm.jjjj" box. They now render whenkit's DateInput, a
drop-in with the same props and onChange(event): the tag changes and
nothing else. The visible box carries the SAME .form-input class, and in
petvity's real CSS build it takes that look exactly (border, 10px radius,
padding, font); the real input stays on top, so the picker, keyboard and
validation are unchanged.

components/ui/date-input.tsx is the one place petvity imports it from (and
where the stylesheet is imported). Migrated with whenkit's
scripts/migrate-date-inputs.mjs (tag + one import per file). Lockfile
written with petvity's pinned pnpm 11.6.0 so only whenkit's 14 lines change.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-08 07:37:41 -07:00
CatoandClaude Opus 5.5 2b7a71cb4f feat(auth): sign in with OrangeCat (#104)
"Sign in with OrangeCat" (OIDC) is now the primary action on /login and
/register; email + password stays behind a disclosure so existing accounts
are not locked out. OrangeCat's own page carries Google, GitHub, email and
open registration.

- Provider: client_secret_post + PKCE + state, scope "openid profile email",
  issuer https://orangecat.ch (ORANGECAT_OAUTH_ISSUER overrides). Absent,
  not broken, until ORANGECAT_OAUTH_CLIENT_ID/SECRET are set.
- Users are keyed ONLY on the new users.orangecat_sub (additive migration
  0007). The provider profile carries no email, so Auth.js never looks a
  user up by email; a new sub always creates a new user. A taken email gets
  an undeliverable @users.invalid placeholder.
- An OrangeCat login never earns ADMIN_EMAILS promotion (email unverified).
- Identity only: no OrangeCat token refresh, tokens not stored.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-02 05:01:17 -07:00
CatoandClaude cf6912e957 feat(records): public roadmap and changelog, from the repo through the fleet map (#103)
The fleet's building-in-public contract puts each product's record in its
own repository as two markdown files and renders it through Loki's fleet map
via bip-kit. Petvity had neither the files nor the pages.

- ROADMAP.md: Now / Next / Later / Shipped, derived from the phases in
  AGENTS.md and the merged history. Planned work is written as plans.
- CHANGELOG.md: Keep-a-Changelog dialect, user-facing, newest first, from
  merged PRs; today's homepage rewrite is the top entry.
- /[locale]/roadmap and /[locale]/changelog render bip-kit's DevelopmentPage
  inside the marketing nav/footer; the records are English by contract, the
  chrome and metadata stay localized (keys in all 9 locales, footer links).
- lib/config/development.ts is the SSOT for the map URL, slug and profile;
  lib/development/records.ts fetches with revalidate 300 and an 8s ceiling.
- The --bp-* theme scope already mapped for the blog (.pv-longform) covers
  the records; the page title and record name take the editorial faces.
- Vitest covers the data path with a fleet-map fixture, no network.
- Sitemap lists both pages.

Verified at 390px in de/en/ar: no horizontal overflow.


Claude-Session: https://claude.ai/code/session_01NJJp6XiUkeEVzjDaBmWjL3

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 04:09:11 -07:00
CatoandClaude b1fedec17b feat(home): mobile-first homepage — one line, one CTA (#102)
Owner feedback: far too much text; visitors should look and act.
- Hero: short headline + one sub-line + HeroCTA (sign up / demo), CTA above
  the fold at 320-390px
- Three one-line benefit tiles, one compact check-in mock
- 'Free, forever' with three checks and a final CTA
- Removed species strip, feature essays, digital-twin and signal sections,
  ecosystem cards, live proof, how-it-works and the 9-item pricing list
- New keys in all 9 locales; unused home keys dropped
- .btn-editorial-wrap lets long localized CTAs wrap on 320px


Claude-Session: https://claude.ai/code/session_01NJJp6XiUkeEVzjDaBmWjL3

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 01:46:58 -07:00
CatoandClaude Opus 5.5 24a39c01f4 fix(nav): every header control is a 44px target; one header for the public detail pages (#100)
The fleet render sweep (nav contract rule 3) counted sub-44px nav controls
in two places:

- MarketingNav: px-3 py-2 links and the Platform button were 36px; the
  Sign-in link 20px. They now carry min-h-11 and trade vertical padding for
  it, so the h-16 header is unchanged. The Platform and mobile-menu toggles
  also gain aria-expanded (rule 2), and the species-guide chips inside the
  Platform menu get the same floor so opening it does not add new ones.
- adopt, adopt/[listingId], find, pets/[handle] and pros/[userId] each
  hand-rolled the same slim header (logo 28px, Sign in 20px, CTA 38px). It is
  now PublicPageNav, once, with every control at 44px; .btn-editorial-sm
  (the nav CTA pill) gets min-height: 44px.

Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 00:07:44 -07:00
CatoandClaude Fable 5.1 18776a4251 refactor: one definition per concern — shared forms, one directory handler, limitkit, zero lint noise (#95)
* fix(lint): anchor the ignore patterns so eslint stops linting build output

`eslint` reported 18 unparseable files and 2 `no-explicit-any` errors that
exist in no source file. They came from `.claude/worktrees/*/.next/**` —
generated, minified code inside the repo. The default ignores of
eslint-config-next are unanchored (`.next/**`), which only matches at the
config root, so nested build output was walked.

Every pattern is now `**/`-prefixed, and `.claude/**` is ignored outright:
a worktree's files are linted on its own branch, never as a copy of this one.

Before: 2 errors, 36 warnings. After: 0 errors, 16 warnings — and the same
result whether you run it from the checkout or from a worktree.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* refactor(pets): one set of pet fields for both add and edit

"Add a pet" and "edit a pet" rendered the same ~120 lines twice — name,
species, breed, birth date, sex, bio, public toggle — so a new field or a
fixed label had to be applied in two places, and the two only stayed
identical by luck.

The fields now live in `components/portal/PetFormFields.tsx`. Each takes the
whole form plus a patch callback rather than a value and a setter, because
the pages hold one `useState` object (the edit page's also carries `handle`)
and a patch is what they can actually apply. The pages keep what genuinely
differs: one creates and can send you on to the first health log, the other
uploads an avatar, owns a handle and a delete zone.

Two primitives came out with it: `ToggleSwitch` (the peer-checkbox switch is
easy to get subtly wrong in a copy — the knob detaches from the track and
nobody sees it until they toggle) and `UploadedImage` (the plain `<img>` for
user-uploaded files, with the reason `next/image` is wrong for them written
down once instead of thirteen bare `eslint-disable` lines).

Render output is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* refactor(api): one handler behind /api/vets, /api/sitters and /api/groomers

The three directory routes differed in a role string, a table and a list of
columns — and agreed, character for character, on everything that decides
what a caller sees: the session guard, the completeness rule, the city
filter, the 50-row page, the review aggregate and the response envelope.
Three copies of a paging rule is three chances for one directory to quietly
start answering a different question from its siblings.

`createProfessionalDirectoryRoute` in `lib/api/professional-directory.ts`
now owns that shared half. Each route file declares only what it publishes:
its role, its table, the extra columns a profile must have filled to be
listed at all, and its SELECT list — because that list IS the contract the
directory offers (a sitter has a day rate, a vet has a clinic).

Responses are byte-identical: 106 + 103 + 106 lines became three ~35-line
declarations over one handler.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* refactor(products): the add/edit-a-product state machine, once

`/admin/products` and `/portal/my-products` look nothing alike — a table with
an inline panel versus a grid with a modal, and only one of them is
translated — but underneath they ran the same 55 lines: the same form shape,
the same "blank stock means unlimited", the same dollars-to-cents rounding,
the same POST-or-PATCH decision, the same optimistic list update.

The arithmetic is the part worth having in one place. `parseFloat * 100` is
where a product silently goes on sale for the wrong money, and it was
written twice.

`useProductEditor` takes the create URL (the admin page appends
`?platform=true` — the one behavioural difference), the two messages it may
need to show, and a callback for the saved row. The pages keep their markup,
their copy, and ownership of their list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* refactor(portal): one labelled input and one contact block for the profile forms

`ProfessionalProfileForm` carried the same four-field grid twice — once for a
vet's practice, once for a sitter's or groomer's services — which jscpd
reported as a 40-line clone of the file against itself. Two copies inside ONE
file is the worst kind: a reviewer reads the first, recognises it, and skims
the second, which is exactly where "city" kept its label and lost its
placeholder.

`ProfileTextField` is that labelled input; `ContactFields` is the
city/country/phone trio as a fragment, so the caller still owns the grid the
cells sit in. `country` is passed through as typed — the route takes the
first two characters and upper-cases them on submit, and normalising here
would be a second opinion about the same value. `SellerProfileForm` uses
both, and its on/off row is now the shared `ToggleSwitch`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* fix(security): key the guest rate limits on the hop Caddy wrote, via limitkit

The hand-rolled limiter in `lib/utils/rate-limit.ts` keyed on the FIRST entry
of `X-Forwarded-For`, with a comment asserting that was the original client
and a test pinning it. Both were wrong in the same direction: a reverse proxy
APPENDS to that header, so the first entry is a string the caller typed. Any
client could send a different `X-Forwarded-For` with each request, mint a
fresh bucket every time and never trip the limit at all — the guest checkout,
which reserves stock without a session, was effectively unlimited. A limiter
that cannot be tripped is not a limiter.

The same bug was found in three sibling repos during this migration, and in
limitkit itself before v0.2.0 (bitbaum/orangecat#563, finding 2). It is
exactly the kind of thing one shared implementation exists to fix once.

So the mechanism is now `limitkit` (fleet/SHARED.md; it replaces 12 copies of
this across 9 repos) and the local copy is deleted: window arithmetic, the
bounded store, the refusal shape and the client-IP dance all come from the
package. What stays local is what is genuinely ours — the limit VALUES, still
declared at each route next to the reason for them, and the proxy depth,
stated once in `rate-limit.ts` because it is a fact about our deployment
(Caddy on the box is the single proxy, so `trustedProxies: 1`).

Behaviour otherwise unchanged: same 429s, same copy, same `Retry-After`, same
per-key allowances. `slidingWindow` (not `fixedWindow`) because the local
implementation started its window at the first hit, which is what sliding
means — the old test expecting 45s of wait after 15s still describes it.

The window-arithmetic tests moved with the code they tested; what this repo
keeps is a test of the part that was broken, including one that a caller
cannot split its bucket by varying the hops it sends.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* fix(portal): give the page loaders a stable identity instead of muting the rule

Eight portal pages declared a `loadX()` that fetches the page's list, then ran
it from a `useEffect` with an empty dependency array and an
`eslint-disable-next-line react-hooks/exhaustive-deps` above the `useEffect(`
line. The directive did nothing: the rule reports on the dependency array two
lines down, so every one of these files produced BOTH an "unused
eslint-disable" warning and the exhaustive-deps warning it was meant to
silence. Sixteen warnings from eight disables that never applied.

The cause is that `loadX` was redefined on every render, so listing it as a
dependency would have refetched forever. `useCallback` fixes that at the
source: each loader is now stable over the translation function (plus the
route param where there is one), the effect depends on the loader like the
rule asks, and the disables are gone. The retry buttons already called these
same loaders and keep working.

Lint: 16 warnings → 0. `pnpm run lint` now passes with nothing to say, so the
next real warning will be visible instead of arriving in a crowd.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* refactor(ui): one uploaded-image component, and a no-console rule so it stays that way

Thirteen components carried their own `<img>` for user-uploaded files, each
with its own `// eslint-disable-next-line @next/next/no-img-element` above it
and none with the reason written down. Thirteen places for that reasoning to
rot and thirteen exemptions a reviewer has to re-audit independently.

They now all render `<UploadedImage>`, which holds the exemption once and
explains it: these URLs are written by the upload routes at request time
(`/uploads/…` on the box, or an `object:` URL while a preview is in flight),
so `next/image` would need the path known at build time or matched by a
configured pattern — and a missing pattern fails the whole render, not just
the picture. The optimizer has nothing to add either; the upload route already
resized the file.

The last `any` went with them: `TSignal` in `lib/i18n/signal-reason.ts` now
says `Record<string, string | number>`, which is what a reason actually
interpolates — counts, days, formatted measurements, nested translations. The
loose shape is still structural rather than next-intl's own type, because the
key is composed at runtime (`metric_${id}`) and the real literal-keyed type
rejects that by design; that reason is now in the file.

eslint-disable directives: 25 → 1 (the one inside `UploadedImage`).

And `no-console` is on, allowing `warn` and `error`. There were no stray
`console.log`s to remove — `error` is how these routes report a failure they
swallowed, and it is what `journalctl -u petvity-app` shows at 2am — so this
is the ratchet rather than a cleanup: a forgotten debug line on a server
writes a stranger's data into the journal forever. `scripts/**` is exempt,
where stdout IS the output. Verified by mutation: a planted `console.log`
fails the lint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* style: wrap the two UploadedImage calls prettier wanted on four lines

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

* fix(deps): install limitkit from npm, not from git

CI refused the git-hosted form: a package fetched from a tarball has no
`dist/`, so pnpm must run its `prepare` build, and pnpm 11 will not run a
git dependency's build scripts unless the exact resolved URL is listed in
`allowBuilds`. The local install had it cached from before that rule, which is
why this was green on the laptop and red the moment CI installed from scratch.

limitkit has been published to npm since, so the fix is the npm form rather
than an allowlist entry pinned to a commit sha that has to be re-edited every
time the version moves. fleet/SHARED.md still shows the github install line;
the published tarball ships `dist/` and needs no build here.

Same version, same resolution: 0.2.0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 02:09:23 -07:00
f094747822 fix(nav): the sidebar highlighted the current page and never announced it (#74)
Both the desktop sidebar loop and the mobile bottom tab bar called isActive()
to paint nav-link-active / mobile-tab-item-active, and the desktop Settings
link compared pathname directly — none of the three set aria-current, so the
current page existed only for people who can see it. Zero occurrences of
aria-current anywhere in the repo.

.nav-link also came out near 41px (10px vertical padding around 14px text),
just under the 44px touch floor this repo already states explicitly on
.browse-chip. Says the floor now instead of leaving it to arithmetic.
.mobile-tab-item was already comfortably above it.

No visual change beyond the min-height.

Found by the fleet nav-contract audit, which flags a repo whose navigation
computes an active state and never announces it anywhere.


Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 12:32:47 +00:00
4133ee1dcd refactor(nav): portal paths were written down 38 times; now once (#72)
`/portal/dashboard` and `/portal/find` were each hand-typed six times in
SidebarNav.tsx alone — 38 occurrences of thirteen paths across the portal
components, plus `/portal/pets/${petId}/health/log` templated in two files.
Renaming a route meant finding every copy, and a missed one did not fail to
compile: it became a dead link only a visitor would discover.

lib/config/routes.ts is now the one place. Static paths as a const object,
and functions for the two that need an id — a template literal in a component
is a copy like any other.

The guard is the point. routes.test.ts scans components/portal for a quoted
/portal/ literal and fails on one, so this cannot quietly come back. It is
stricter than the first pass of the fix was: it caught QuickActions.tsx and
both dynamic paths that a file-by-file sweep had missed, which is exactly the
job. Recorded in CLAUDE.md's SSOT table and Red Flags list so the rule is
findable without reading this commit.

No behaviour change: every path resolves to the same string it did before.
Typecheck clean, lint clean, 904 tests pass.

Found by a fleet-wide navigation audit across 20 repos, where petvity had the
highest concentration of hand-typed destinations in a single file.


Claude-Session: https://claude.ai/code/session_01XeELB8b3N4JrT2asYL9WvE

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 07:56:52 +00:00
GandClaude Opus 5 c65ac4b7d7 chore: add a formatter (#71)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (252 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 10:05:01 +00:00
GandClaude Opus 5 37b1f59ed7 feat(shop): sell to visitors who don't have an account (#50)
The public storefront was a brochure. It shipped a Product/Offer JSON-LD so
search engines treat it as purchasable, then the only buy path was
"Sign up to buy" -> /register?returnTo=/portal/shop, which both forced
registration before a first purchase and dropped the product the visitor came
for. Cold traffic could not buy anything.

A visitor can now add to cart on the catalogue and the product page, check out
in one page with an email and an address, and read their order back from a
receipt link. No account anywhere in that path.

orders.userId becomes nullable, alongside guestEmail and an unguessable
publicToken. A CHECK constraint enforces exactly one of userId / guestEmail,
because an order with no reachable buyer cannot be repaired after the fact.
The token is the guest's only handle on their order: it is emailed, never
listed, and authorises resuming payment and cancelling while pending.

Order placement moves to placeOrder() in lib/domain/orders.ts so the authed
cart and the guest checkout share one implementation -- the stock reservation
and its compensation must not exist twice. setOrderStatus() joins it for the
same reason: a cancellation that forgot to restore stock destroys inventory,
and that happens when one route remembers and another does not.

Two joins were fixed before any UI existed. app/api/orders/seller and
app/api/admin/orders inner-joined users on orders.userId; with a nullable
column that drops every guest order from the views of the people who have to
ship them -- real revenue, invisible, nothing appearing broken. Both are now
leftJoin + COALESCE onto the address the buyer typed.

Also fixed while reviewing:
- toLocale() used `value in LOCALE_CONFIG`, true for inherited keys like
  "constructor", and the result goes straight into a URL path.
- orderShippingSchema accepted any two letters as a country, so "XX" could be
  stored and printed on an undeliverable label. Checked against a new ISO-3166
  SSOT whose names come from Intl.DisplayNames, so all nine locales are
  translated with no message files to maintain.
- Guest input (shippingName, notes) reaches a seller's inbox unauthenticated;
  email templates now escape it.

Guards, not just fixes: locale parity across all nine message files is now a
test rather than a convention, and the prod walkthrough places a real guest
order and asserts the seller can see the buyer's email -- the check that goes
red if anyone reintroduces an inner join there.

The public endpoints are deliberately outside PRIVATE_API_PREFIXES; a session
guard there would silently delete the feature. They are rate limited per
client, and the payment and cancel routes require the order token.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 08:56:48 +00:00
GandClaude Opus 5 12438d36e3 feat(shop): list a product with a photo from your phone, not a URL (#45)
Listing a product required pasting an image URL, which quietly assumed the
seller already hosted the picture somewhere. Everyone who sells has photos on
their phone; nobody has a CDN. That single field is why a real listing could
not be created without leaving the product first — and prod currently has zero
products.

Both product forms (seller's /portal/my-products and /admin/products) now take
a file: pick, preview, replace, remove.

The upload endpoint is deliberately not scoped to a product id. The seller
chooses the photo while filling in the "new product" form, before a row exists;
scoping it would force create-then-upload and leave a product visibly imageless
whenever the second call failed. It returns a URL the form submits as imageUrl,
so create and edit take the identical path.

Files land in UPLOADS_DIR (/opt/petvity/uploads on the box, outside the app
directory so they survive deploys) and Caddy serves them from /uploads/*.

Also fixes a drift this would have made worse: the upload limits lived inline
in the avatar route, and its file picker offered JPEG/PNG/WebP while the API
also accepted GIF — so a GIF was rejectable by the UI and acceptable to the
API. Limits are now SSOT in lib/config/uploads.ts, used by both routes, both
pickers and the hint text, so they cannot disagree again.

/api/uploads is added to PRIVATE_API_PREFIXES — it writes files to disk and
must never be reachable without a session.

8 tests cover the endpoint: stores and returns the URL, keys uploads by
uploader, refuses anonymous callers, no file, over-cap, exactly-at-cap,
non-image type, and a storage failure reported instead of a fake success. The
size gate needed real bytes — FormData rebuilds the File from its content, so a
patched `size` property is discarded in transit and the gate would never fire.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 14:03:18 +02:00
G 69adbcb805 feat(portal): every page opens the same way and says what it is for (#36)
PR #34 introduced PageHeader but only nine pages used it. The other
eighteen hand-rolled their own heading markup, and the copies had drifted:
mb-8 vs mb-6, items-center vs items-start, and five variants of the same
back link (gap-1 vs gap-1.5, mb-1 vs mb-5 vs none) that all meant "go up
one level". Two admin pages skipped the heading classes entirely.

All of them now render <PageHeader>, which gains two things it needed to
absorb the stragglers:

- `back` — the "← Pet name" link above a title, now one .back-link class
  instead of eighteen lines of duplicated utilities per page.
- `flush` — drops the bottom margin where the parent already spaces its
  children. An `mb-0` utility from outside would not reliably win, because
  Tailwind resolves same-property utilities by stylesheet order rather than
  attribute order, so the choice is made inside the component.

Copy: two pages had no purpose line at all. /portal/pets showed a pet count
where a purpose belongs, and /portal/seller-profile explained itself only
while the store was new — an existing seller landed on an unexplained form.
Both now state what the page is for, in all nine locales. The dead petsCount
key is removed. Four admin pages traded vague labels ("Platform at a glance")
for sentences that say what you can do there.

Also splits .stat-value / .stat-label / .stat-caption out of .page-title.
Admin was styling numbers with the page-heading class, so restyling a page
title would have silently restyled every stat card. Tints are modifier
classes, not utilities — .stat-value is unlayered, so a text-[var(--teal)]
beside it would have been silently dead.

Verified: lint clean · tsc --noEmit exit 0 · css-vars ✓ · 1220/1220 tests
across 137 files · pnpm build succeeds.
2026-08-14 10:59:10 +00:00
GandClaude Opus 5 b8595fd86e feat(portal): the dashboard covers the whole platform, and every page says what it is for (#34)
The dashboard answered one question — how are my pets? — and left everything
else the platform does undiscovered behind the sidebar. It now also shows what
is already in motion (the next three appointments, the three most recent
orders) and a role-aware "what would you like to do?" grid: find care, shop,
adopt, and either offer your services or manage your bookings, either set up a
store or manage the one you have.

The greeting was computed from new Date().getHours() during a server render,
which is the box's UTC rather than the reader's clock — an evening visitor in
Zurich could be wished good afternoon. It is now clock-free, and the space it
occupied says what the page is for instead.

Page purpose lines, all nine locales. The worst of them was Find a Pro:
"Connect with verified veterinarians and trusted pet sitters" claimed a
verification most professionals do not have, and omitted groomers entirely
even though grooming has been a first-class vertical since #27. Six others
described what the page contained rather than what you could do on it.

PageHeader replaces the hand-rolled title/subtitle/action markup on bookings,
find, settings, shop and orders — one header instead of five near-copies.
Status badges now resolve to the semantic badge-* tones from globals.css
through a `badge` field on the status config, rather than a parallel set of
arbitrary-value Tailwind strings that happened to render the same colours.

Documented that the liveness probe is /api/healthz: /api/health is the private
prefix for health metrics and records, so it always redirects to /login and can
never report healthy — the runbook pointed at a path that could not work.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 01:49:49 +00:00
GandClaude Opus 5 42bcc47ff4 feat(marketplace): real onboarding replaces fake profiles; orders become shippable (#33)
Three things made the marketplace a demo rather than a business.

1. Orders had no delivery address. A seller could receive an order and have
   nowhere to send it. Orders now carry a required address (migration 0004,
   additive); the API rejects an order without one, and both the seller and
   admin order views expose it so fulfilment is actually possible.

2. The directory was populated by five invented businesses. Dr. Brunner,
   Sam Keller, Nadia Roth, Pfoten & Co. and Tierheim Sonnenhof do not exist —
   a customer in Zurich searching for a groomer would have found a fiction.
   They are removed from lib/config/resident-pet.ts, and ensureCommunity is
   gone from the resident-checkin cron so nothing recreates them.

3. Nothing replaced them. lib/domain/profile-readiness.ts is now the single
   rule for when a professional or seller is real enough to be listed:
   identity, services, price, location, a 40-character intro, contact, and
   the pro's own "accepting clients" switch. The same predicate drives the
   ProfileReadiness checklist the pro sees and the SQL conditions the public
   directory queries use — so the listing is earned, never hand-curated.

Selling was already open to any account (products.sellerId = userId) but was
undiscoverable; /portal/become-a-pro now says so and links to the store setup,
which shows the seller's own readiness checklist including "list your first
product".

Also: deleting a pet was reachable only by guessing it lived inside the edit
form — the pet profile now links straight to the danger zone. Professionals
could not accept a booking from /portal/bookings, and groomers were missing
from the booking role union entirely.

E2E gains two checks: an order without an address must be rejected, and the
seller must be able to see where to ship.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 01:10:42 +00:00
GandClaude Fable 5 4883c8eae2 feat(platform): public directory, blog, 6-item sidebar, portal design vocabulary (#32)
The two-sided answer. 'How do I find a groomer in Zürich?' had no
logged-out answer — the directory lived behind auth. Now /find is a
public, SEO-indexed directory (vets/sitters/groomers tabs, city filter,
ItemList schema, review aggregates, links to public profiles) with a
provider CTA; the megamenu pros pillar and footer point at it.

'If I'm a groomer, how do I find customers?' — your profile IS your
storefront, and the new blog post documents the whole two-sided
proposition honestly (/blog, content SSOT in lib/content/blog.ts,
BlogPosting schema; no invented claims, resident accounts disclosed).

Portal navigation: six entries, no section labels needed — Care, Shop,
and Adopt are hubs whose sibling pages became segmented tabs (HubTabs;
same URLs). Seller/pro upsells moved out of daily nav into a Grow card
in Settings; active sellers get one 'My Store' entry.

Portal design vocabulary (the missing discipline): .page-title/.page-sub,
.badge + tones, .icon-tile(-lg), .modal-overlay/.modal-panel, .hub-tabs —
71 hand-built repetitions of these patterns replaced across portal+admin.

verify + build green; /find (incl. groomers/Zürich), blog, and post pages
render-verified locally.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 21:37:58 +00:00
GandClaude Fable 5 d2fa44325f feat(nav): platform-first IA — 7 header items instead of 10, grouped sidebar, honest footer (#31)
Header: Platform ▾ · Pricing · ❤️ Adopt + locale/login/CTA. 'How it works'
(anchor), 'For Pros' (now a megamenu pillar), and the header demo link
(hero + login page still carry the demo funnel) are gone; Adopt no longer
appears twice. The megamenu is rebuilt from 9 fake-depth items (all
pointing at /features, hardcoded English) to 4 translated pillars that
link to their real surfaces — Health & Digital Twin, Vets/Sitters/
Groomers, Marketplace, Adoption — plus species guides driven by the
species SSOT instead of a duplicated hardcoded list.

Sidebar: ~10 flat links become four labelled groups (Care team /
Marketplace / Adoption / Your business) — same routes, half the scanning.

Footer: the three dead '#' links (Help Centre, Status, Community) are
gone; Company section (About, Live demo, Contact) replaces them; Shop and
Join-as-groomer added.

Homepage: hero subtitle and Find-a-Pro card repositioned from
health-tracker copy to the full platform (pros incl. groomers,
marketplace, adoption). All copy ×9 locales.

verify + build green; header/megamenu browser-verified.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 19:58:47 +00:00
GandClaude Fable 5 300fe1cdc2 feat(groomers): grooming as a first-class professional vertical (#27)
Groomer joins vet and sitter everywhere a professional exists:
- user_role enum + groomer_profiles (salon, services, from-price) + migration
- /api/groomers browse + /api/groomers/me CRUD; role plumbed through
  registration (?role=groomer), become-a-pro, availability, bookings,
  conflict guard, admin verification, dashboards, sidebar
- Find a Pro gains a Groomers tab; booking modal books grooming as a
  one-hour session with the salon's from-price in the header
- Public pro profile renders groomers (salon, services, starting price)
- Resident groomer Nadia Roth / Salon Pfotenschick seeds via the daily
  cron with a completed booking + 5-star review, so the tab ships alive
- 6 grooming services in the professionals SSOT; role badge tokens in
  globals.css; ~25 strings x 9 locales

Verified end-to-end locally: register groomer -> profile -> visible in
browse -> booked 201 -> overlap 409. verify + build green.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 15:36:56 +00:00
GandClaude Fable 5 763d55daea feat(ux): humane booking flow, self-serve pro upgrade, role-aware dashboard (#26)
* chore: nudge CI (pull_request event was never delivered)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(ux): humane booking flow, self-serve pro upgrade, role-aware dashboard

Booking modal rebuilt around how people actually book:
- Sitter: drop-off/pick-up dates (no datetime-local minute-picking), live
  'N nights × rate = total' before any commitment
- Vet: one date + tap-a-time-slot chips (1h appointments)
- Availability surfaced BEFORE submit: busy ranges fetched from the new
  /api/bookings/busy (privacy-safe date ranges), clashing dates disable the
  button with a plain-words warning instead of a post-submit 409
- One pet -> stated, not asked; request-not-final explainer under the CTA

True multi-tenancy path: existing owners can now become professionals —
/portal/become-a-pro (sidebar 'Offer your services') POSTs the new
/api/account/role (pet_owner -> vet/sitter only, trust-first like
registration), session refreshes in place via the update trigger.

Dashboard attention strip now spans every role: pending booking requests
(pros) and open orders (sellers) join adoption applications and vaccines.

24 new strings x 9 locales. verify green (1212 tests), build green,
modal + clash state + sidebar verified in the browser.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 14:49:13 +00:00
GandClaude Fable 5 bb5615c0fa feat(bookings,shop): calendar conflict blocking + Stripe payment integration (#25)
* feat(bookings,shop): calendar conflict blocking + Stripe payment integration

Tier-1 scheduling: the booking API now rejects (409) any request that
overlaps a professional's active bookings or their self-declared blocked
dates; vets/sitters manage blocked ranges at /portal/professional-profile
(new professional_blocked_dates table + /api/availability CRUD).

Payments: full Stripe Checkout flow, env-gated like Resend — without
STRIPE_SECRET_KEY nothing changes; with it, checkout redirects to Stripe,
the signed webhook (/api/payments/webhook) marks orders paid, and unpaid
orders stay payable from /portal/orders (Pay now + paid/awaiting badges).
orders gains paid_at + checkout_session_id.

Critical bug found by the smoke test: the login JWT callback wrote
resolveRole(email) back to the DB, silently DEMOTING every vet/sitter to
pet_owner at their next sign-in (residents were safe only because they
never log in). ADMIN_EMAILS now only promotes; professional roles survive.

Verified end-to-end locally: sitter registers → blocks dates → owner
booking overlap 409, blocked-dates 409, disjoint 201; checkout w/o keys
falls back to recorded orders. verify green (1209 tests incl. 12 new).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: nudge CI (pull_request event was never delivered)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 13:49:47 +00:00
GandClaude Fable 5 d2fcae9824 feat(shop): branded category art — no product ever renders as a placeholder box (#24)
New ProductArt component: uploaded photo when present, otherwise a per-category
line illustration in the brand palette (CSS-var driven, re-themes with
globals.css). Wired into every product surface: portal shop grid + cart drawer,
public shop grid + product detail, buyer/seller/admin order items, seller
product list. Order APIs now expose productCategory for the fallback.

Also: public shop hero title was invisible — .ed-title is platinum-on-dark
marketing typography and PR #22 placed it on the light cream hero; now matches
the adopt page's ink title (surfaces stay unmixed per AGENTS.md).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 12:27:10 +00:00
GandClaude Fable 5 68991544ed fix(auth): config-driven auth surface, dead-token repair, css-var CI gate (#22)
PR #20 removed the editorial tokens (--gold*, --cream*, .section-warm-dark,
.section-cream) but only reskinned the marketing pages — all 6 (auth) pages
and 4 (public) pages still referenced them and rendered with unresolved
var() styling. Repaired and hardened:

- (auth) layout: brand panel re-expressed on the obsidian/champagne surface
  (the same language visitors arrive from), form panel on the light product
  surface; all 6 auth pages now use only live tokens
- (public) shop/adopt/pets/pros pages swept to live tokens
- New verify gate scripts/ci/check-css-vars.mjs: any var(--x) referenced in
  app/, components/, lib/ that globals.css doesn't define fails the build —
  this class of regression can't ship again (2nd occurrence; never-twice)
- DRY/SSOT: .form-label replaces 86 identical label-class repeats across 19
  files; .link-accent replaces repeated link styling; register role labels
  derive from USER_ROLE_CONFIG; password hint derives from
  PASSWORD_MIN_LENGTH; POST_LOGIN_PATH centralized in lib/config/auth.ts
  (login, demo, proxy, email templates); Terms/Privacy now link to the
  actual legal pages
- Settings: display-name field no longer renders empty when the session
  loads after mount (profile editing bug found in browser testing)
- Root layout <html> now carries dir="ltr" — fixes the hydration attribute
  mismatch with the [locale] layout's dir
- .gitignore no longer hides scripts/ (verify depends on scripts/ci/)

Browser-verified on desktop (1280px) and mobile (390px): login (credentials
+ demo), registration end-to-end, forgot/reset password, profile edit save,
sign-out, marketing nav megamenu + mobile drawer, footer, portal sidebar +
bottom tabs. verify green: lint + typecheck + css-gate + 1181 tests; build
green.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 13:01:04 +02:00
GandClaude Fable 5 0cdd565cd3 feat(design): obsidian luxury marketing surface — platinum/champagne on near-black (#20)
Reskin the entire marketing surface (homepage, features, about, pricing,
pros, species guides, nav, footer, OG image) in a luxury-futurist dark
design language: obsidian ground, onyx cards with hairline borders,
warm platinum text, champagne-gold accent, Jost 200 display face and
IBM Plex Mono instrument labels.

- globals.css: new obsidian token layer + .lux-* / .ed-* / .btn-editorial*
  semantic classes (aurora hero, staggered reduced-motion-safe entrance)
- lib/fonts.ts: new fonts SSOT (Plus Jakarta Sans / Jost / IBM Plex Mono)
  applied to BOTH html-rendering layouts — also fixes the pre-existing
  hydration className mismatch on /[locale] pages
- MarketingNav: always-solid obsidian bar (works over dark marketing and
  light legal pages); LocaleSwitcher gains a tone="dark" variant
- design-tokens.ts synced; OG image redrawn on the obsidian palette
- Portal/admin product UI intentionally untouched (light teal/terracotta);
  AGENTS.md documents the two-surface rule

verify green: lint + typecheck + 1174 tests; build green; visually
verified via headless screenshots (desktop/mobile, home/pricing/legal).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 16:26:43 +00:00
GandClaude Fable 5 9ed916af14 feat(system): healthz, one-click /demo funnel, public demo profile, new-pet grace, score labeling (#17)
- /api/healthz: public DB-pinging healthcheck. /api/health is the auth-gated
  pet-data API, so deploys and uptime monitors had nothing honest to probe.
- /demo: signs a visitor into the shared demo account in one click; linked
  from the marketing hero ('Try the live demo') and nav across all locales.
  Also fixes two hardcoded English strings in HeroCTA.
- Demo seed claims the public handle /pets/luna (when free), so the
  public-influencer-profile feature has a live showcase.
- New-pet grace: a profile younger than the 7-day alert window with no data
  and nothing overdue reads healthy/'new profile' instead of an alarming
  Watch badge seconds after creation. Overdue vaccinations still escalate.
- Digital-twin score is labeled 'Emotional wellness' (9 locales) so it stops
  reading as a contradiction of the all-metric wellness % on the health page.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 21:00:07 +00:00
GandClaude Opus 4.8 03b3c075af feat(marketing): align marketing surface to petvity.com editorial brand (#2)
Translate the petvity.com design language onto the marketing pages while
keeping Petvity's own content (pet-signal / digital-twin). Adds an editorial
token layer (warm cream, warm-dark, gold) + Cormorant Garamond display serif
alongside the existing teal/terracotta product palette, plus reusable editorial
classes (.ed-*, .btn-editorial*). Reskins hero, all landing sections, nav and
footer. Removes the off-brand violet digital-twin gradient. Product UI
(portal/admin) intentionally untouched.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 19:45:14 +02:00
g-butandClaude Sonnet 4.6 1f1c571c95 refactor(design): centralize all design tokens — CSS vars, utility classes, design-tokens.ts
Extract every hardcoded color, shadow, and repeated nav-link className pattern into a single
source of truth so a future redesign touches only globals.css and design-tokens.ts.

- globals.css: add --secondary, --info, --twin, --warm-bg, --danger-dark, --teal-wash, shadow
  tokens; add .nav-link / .nav-link-active|inactive|muted|danger, .mobile-tab-item variants,
  .btn-on-teal / .btn-on-teal-ghost, .eyebrow-badge; fix .card-hover border-color
- lib/config/design-tokens.ts (new): JS hex constants for Satori OG / Recharts SVG contexts
- SidebarNav: replace 10x repeated nav-link ternary with utility classes
- HealthTrendChart: replace hardcoded hex / box-shadow literals with CSS vars
- Marketing pages: replace bg-pink-*, bg-violet-*, bg-amber-*, bg-blue-*, shadow literals
- OG images: import TOKENS; fix stale accent color in pros OG image
- dashboard, settings, MarketingNav: replace remaining Tailwind color literals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 12:39:07 +02:00
g-butandClaude Sonnet 4.6 05c07e66fd feat(species): extend species guides from 3 to 9 — add bird, rabbit, guinea pig, hamster, reptile, fish
Each new species gets a blurb + 5 care tips across all 9 locales (EN/DE/FR/ES/JA/ZH/KO/TR/AR).
generateStaticParams, SPECIES_BLURB_KEY, CARE_TIP_KEYS, sitemap, nav megamenu, and footer updated
to cover all trackable species. Footer now derives its guides list from SPECIES_CONFIG + public
translations rather than hardcoded per-species i18n keys.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-08 08:43:03 +02:00
g-butandClaude Sonnet 4.6 13f88f2621 fix(nav): swap mobile bottom-nav Settings for Bookings
Settings is already accessible via the top-bar avatar; Bookings is the
natural follow-up destination after using Find a Pro on mobile but had
no bottom-nav entry, leaving users unable to track appointments easily.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 22:09:01 +02:00
g-butandClaude Sonnet 4.6 ad09ef5308 refactor(dry): extract EmptyState/ErrorState to shared component
Created components/portal/PageState.tsx with EmptyState and ErrorState.
The identical empty-state and error-state card patterns were repeated
inline across 7 portal pages (orders, bookings, shop, adopt, adoptions,
pets, find). find/page.tsx had a local EmptyState already — the shared
component is that component promoted to the portal component layer.

Each page now uses <EmptyState icon title body cta/actions /> and
<ErrorState message onRetry retryLabel /> instead of 10-20 lines of
duplicated JSX per page. No behavior change.

Also fix SidebarNav mobile tab labels: text-[11px] → text-xs (last
remaining sub-12px typography violation in user-facing UI).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 20:06:26 +02:00
g-butandClaude Sonnet 4.6 3bb5e0a225 fix(i18n): make emotional metric scale descriptions locale-aware
Replace hardcoded English def.description under each emotional metric
select (e.g. "1 = depleted, 5 = very energetic") with composed strings
from the already-translated tTwin scale labels ("1 = Very low · 5 = Very high"
in en, "1 = Sehr niedrig · 5 = Sehr hoch" in de, etc.).

Also remove unused EMOTIONAL_SCALE_LABELS export from health-metrics.ts —
scale labels are sourced from next-intl translations, not this constant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 18:14:08 +02:00
g-butandClaude Sonnet 4.6 b50f277150 feat(charts): replace dual reference lines with shaded normal range band in health trend charts
Shows a green ReferenceArea band between species-specific normalMin/normalMax instead of
two separate dashed lines, making the "healthy zone" immediately obvious at a glance.
Adds a "Normal range" legend swatch (translated across all 9 locales) to physical charts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 15:42:41 +02:00
g-butandClaude Sonnet 4.6 4c0568ae46 fix(i18n): render noDataText prop in HealthTrendChart instead of hardcoded English string
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 15:06:25 +02:00
g-butandClaude Sonnet 4.6 c5085874bd feat(i18n): persist SignalReasonData in DB and translate signal history
Add reason_data jsonb column to pet_signal_history; write reasonData in
signal-cache.ts and health-alerts cron; update SignalHistoryTimeline to
call translateSignalReason() for new rows, falling back to stored English
text for legacy rows (graceful degradation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 13:30:28 +02:00
g-butandClaude Sonnet 4.6 1e1e111c75 fix: replace string-interpolated twin keys with explicit lookup tables
- DigitalTwinCard + public pet profile: TWIN_METRIC_LABEL_KEYS + TWIN_SCALE_KEYS tables replace template-literal key construction
- health/page.tsx: PORTAL_METRIC_LABEL_KEYS typed as Record<MetricId,...> so TypeScript catches missing metric entries at compile time
- Both approaches are safe to unknown metric ids (explicit fallback to raw id/value)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 18:53:15 +02:00
g-butandClaude Sonnet 4.6 72e407c1d2 feat(i18n): translate digital twin metric labels, scale values, and summaries across 9 locales
- TwinMetricDisplay: removed English-only label/valueLabel fields; components now resolve via i18n
- TwinState: summary field renamed to summaryKey (translation key); summaryText() returns a twin namespace key
- DigitalTwinCard + public pet profile: metric labels, scale value labels, and summary now translated
- HealthLogForm: emotional metric labels and 1-5 scale options now use portal/twin namespaces
- health/page.tsx: metric grid labels and emotional chart legend now use portal namespace
- 38 new twin namespace keys + 4 new portal keys added to all 9 locale JSON files
- EMOTIONAL_SCALE_LABELS duplication removed from HealthLogForm (was also in digital-twin.ts)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 18:47:48 +02:00
g-butandClaude Sonnet 4.6 1c6028f939 feat(i18n): translate DigitalTwinCard, SignalHistoryTimeline, HealthLogForm, HealthTrendChart across 9 locales
- DigitalTwinCard: 5 hardcoded strings replaced with t() calls (digital twin title, no-data empty state, stale-data nudge)
- SignalHistoryTimeline: Signal History heading + daily check source tag now translated
- HealthLogForm: wired existing healthWeightLabel/healthTemperatureLabel/healthHeartRateLabel keys
- HealthTrendChart: noDataText prop added; parent health page passes t(chartNoData) for all 4 chart instances
- 7 new portal namespace keys added to all 9 locale JSON files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 18:13:07 +02:00
g-butandClaude Sonnet 4.6 526da0fc9f feat(i18n): translate signal + digital twin labels across 9 locales
Signal labels (Healthy/Watch/Needs attention) and digital twin state/trend
labels (Thriving/Doing Well/Needs Attention/Struggling + Improving/Stable/
Declining) were hardcoded English in config. Now served from the existing
"signal" namespace and a new "twin" namespace in all 9 locale message files.

- Remove SIGNAL_LABELS from lib/config/pet-signal.ts (superseded by "signal" namespace)
- Remove .label from TWIN_STATE_CONFIG and TWIN_TREND_CONFIG in digital-twin.ts
- Add "twin" namespace to messages/{en,de,fr,es,ja,zh,ko,tr,ar}.json
- Update 5 pages (dashboard, pets, checkin, pet detail, public pet profile) to use tSignal()/tTwin() via getTranslations
- Update DigitalTwinCard (client) to use useTranslations("twin")
- Update SignalHistoryTimeline to async server component with getTranslations
- Fix find page: wrap Promise.all in try/finally so loading spinner always clears

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 17:01:18 +02:00
g-butandClaude Sonnet 4.6 2c1e2aadb9 fix(health-log): restore hint.unit from config in placeholder (SSOT)
Hardcoded 'kg' and '°C' in placeholder strings where the original
used hint.unit from the page-level config object. Restores SSOT —
the unit comes from health-metrics.ts config, not inline strings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:09:50 +02:00
g-butandClaude Sonnet 4.6 98ae16b60e feat(i18n): translate pets list, health log wrapper, and HealthLogForm into all 9 locales
Three heavily-used portal pages now show the user's selected language
instead of hardcoded English. Uses getTranslations({locale}) for the
two server components (pets list, log wrapper) and the existing
useTranslations hook for the HealthLogForm client component.

Adds 22 portal namespace keys (pet count, empty states, back link,
log page titles and subtitles, physical/emotional section headers,
normal range hint, date/notes labels) across EN/DE/FR/ES/JA/ZH/KO/TR/AR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 18:06:10 +02:00
g-butandClaude Sonnet 4.6 0ca9d3427d feat(nav): add My Adoptions link to sidebar nav
/portal/adoptions was shipped in Phase 4 but had no sidebar entry,
making it unreachable except via direct URL. Adds ClipboardList icon
link after the browse Adopt entry, translated into all 9 locales.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 17:07:18 +02:00
g-butandClaude Opus 4.7 c655c76004 fix(home): hero CTA points returning users at their dashboard
The homepage hero CTA was hardcoded "Get started free" → /register.
A returning user clicking it gets bounced through middleware to the
dashboard — works, but the label is misleading and the click is
wasted ("did I sign up? am I logged in?").

- New components/sections/HeroCTA.tsx — small client island that reads
  useSession() and renders either "Go to dashboard" (with role-aware
  destination: admins → /admin/users) or the original "Get started
  free" → /register pair, depending on auth state. During status ===
  "loading" it reserves the CTA's height with an aria-hidden div so
  the page doesn't shift on hydration.
- app/[locale]/page.tsx: hero block now renders <HeroCTA />; the rest
  of the homepage stays a server component / static-friendly.

Other "Get started" buttons further down the page (mid-section CTAs
in feature blocks, pricing tease, footer area) deliberately left
alone — they're aimed at scrolled-deep visitors who haven't engaged
yet, and the middleware redirect for logged-in clicks is acceptable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:40:54 +02:00
g-butandClaude Opus 4.7 369b8ca804 fix(marketing-nav): show "Go to dashboard" for logged-in users
Returning users on a marketing page (homepage, /features, /pricing,
/about, /pros, /adopt, /legal/*) saw "Log in" / "Get started free"
CTAs unconditionally — clicking "Log in" while already logged in just
bounced through the middleware to the dashboard. Friction + cognitive
mismatch ("did my session expire?").

- MarketingNav now reads useSession(); when status === "authenticated"
  it renders a single "Go to dashboard" CTA pointing at the right hub
  (/admin/users for admins, /portal/dashboard for everyone else).
- During status === "loading" the auth CTAs render nothing — avoids
  flashing "Log in" then swapping to "Dashboard" once the session
  resolves on the client.
- Same treatment in the mobile drawer (fewer buttons when logged in,
  matches the desktop behavior).
- Added "goToDashboard" translation to all 9 locales (en/de/fr/es/
  ja/zh/ko/tr/ar) — next-intl warns on missing keys, and skipping
  any locale would degrade that language's UX.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:28:26 +02:00
g-butandClaude Opus 4.7 279bae3208 feat(legal): ship Privacy / Terms / Cookie pages and wire footer
The auth login layout proudly says "GDPR compliant" but the marketing
footer's Privacy / Terms / Cookies links all pointed to "#". Closing
the gap with three honest, plain-language pages — accurate to what
the platform actually does, not boilerplate.

- /[locale]/legal/privacy: data collected by category, third-party
  service providers (Vercel, Neon, Resend, Vercel Blob, Google),
  user rights with direct pointers to the in-app surfaces shipped
  recently — Settings → Your data (GDPR Art. 15) and Settings →
  Danger zone (GDPR Art. 17), explicit "no advertising, no AI
  training" stance.
- /[locale]/legal/terms: account responsibilities, acceptable use,
  the load-bearing veterinary-advice disclaimer (Petvity is NOT a
  substitute for a vet — this matters for liability), marketplace
  + adoption + bookings caveats positioning Petvity as facilitator
  not party, account-deletion pointer for off-ramp.
- /[locale]/legal/cookies: enumerates the 4 cookies actually set
  (3 NextAuth, 1 NEXT_LOCALE) — all strictly-necessary or set by
  explicit user action, so no cookie banner needed under ePrivacy.
- Shared LegalPage component for consistent typography + cross-links.
- New .prose-legal CSS utility (h2/h3/p/ul/a/code) keeps long-form
  copy readable without polluting markup with classes.
- MarketingFooter: 6 anchor href="#" → real legal URLs (link section
  + bottom bar).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 10:32:25 +02:00
g-butandClaude Opus 4.7 14fdb9a847 feat(i18n): persist users.locale so cron emails match the user's choice
The LocaleSwitcher set a cookie but cron jobs (running outside any
session) had no way to know what language each recipient wanted —
so vaccination/medication/booking reminders were always English.

- Schema: add users.locale (varchar(5), nullable; null = default).
  pnpm db:push applied to Neon.
- New PATCH /api/account/locale: requireSession-guarded, validates
  against routing.locales, updates the user row.
- LocaleSwitcher: best-effort PATCH the new endpoint when picking a
  language (anonymous 401 is fine — cookie still drives portal/marketing).
- Reminder crons (vaccination, medication, booking): include
  ownerLocale in the join projection and pass it to formatDateShort
  / toLocaleDateString. Booking reminder also stops hardcoding "en-US".

Side-effects in LocaleSwitcher extracted to module-scope persistLocale()
so React Compiler's immutability rule doesn't flag the cookie write.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 18:27:59 +02:00
g-butandClaude Opus 4.7 2c7c2ab3ab feat(i18n): ship LocaleSwitcher — users can finally change language
The codebase had 9 locales, 9 message files, RTL handling for Arabic,
cookie-driven portal locale resolution, and i18n-aware date helpers —
but no UI to actually switch language. Users were stuck in whatever
locale the URL accidentally landed them in.

- New components/LocaleSwitcher.tsx: single component for both
  contexts. Sets NEXT_LOCALE cookie (1y), then either swaps the
  /[locale]/ segment in the URL (marketing) or refreshes (portal),
  detected via a regex built from routing.locales.
- Portal sidebar: switcher placed above Settings; layout passes
  the resolved locale through.
- Marketing nav: switcher in desktop CTA cluster + mobile drawer,
  current locale resolved via useLocale().

Native labels + flags from LOCALE_CONFIG (SSOT, no duplication).
Click-outside to close, escape via outside-click handler, max-height
with scroll for the 9-item list, ARIA listbox.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:57:27 +02:00
g-butandClaude Opus 4.7 2dd76e2d28 fix(i18n): thread locale through portal server components
Portal routes live outside next-intl's [locale] segment, so server
pages couldn't get the user's locale via getLocale() — date helpers
fell back to en. Non-English users saw English dates on the pet
profile and health page despite the language switcher.

- New lib/i18n/portal-locale.ts: getPortalLocale() reads the
  NEXT_LOCALE cookie, validates it against routing.locales, falls
  back to defaultLocale. The portal layout now uses this helper
  instead of inlining the cookie read.
- formatIsoDate / formatIsoDateTime: accept optional locale (matches
  the formatDateShort signature shipped last commit).
- Pet profile + health pages: resolve locale via getPortalLocale()
  and pass it to all formatDateShort calls.
- SignalHistoryTimeline: accept optional locale prop, threaded from
  the pet profile.

Client-side date callers (orders, bookings, etc.) intentionally
left as-is — they get the user's browser locale via undefined.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 17:39:21 +02:00