Commit Graph

366 Commits

Author SHA1 Message Date
113e689932 fix(admin): handle duplicate tag name with 409 + polish inline tag form
- admin-tags.ts: wrap createTag in try/catch, detect UNIQUE constraint violations and return 409 with friendly message
- tags/index.tsx: surface server error message in catch block via err.message (ApiError carries the message from response body)
- tags/index.tsx: replace bare form row with card-style wrapper — label for Name and Parent, card border/bg, shrink-0 submit button
2026-04-20 22:50:35 +02:00
b41b8329bc fix(admin): return presignedUrl from from-url endpoint and update image preview after fetch
- images.ts: import getImageUrl from storage service, call after fetchImageFromUrl and include presignedUrl in response
- $itemId.tsx: update handleFetchFromUrl to use presignedUrl and dominantColor from response, set imageUrl in form state so ImageUpload component shows preview immediately
2026-04-20 22:49:34 +02:00
2f39a7241a fix: persist crop preview in ImageUpload via initialCrop prop
All checks were successful
CI / ci (push) Successful in 1m52s
CI / e2e (push) Has been skipped
CI / deploy (push) Successful in 16s
Crop values were stored in DB but never passed back to ImageUpload on reload,
causing images to revert to object-contain. Now both admin and user item pages
pass persisted crop data so the cropped view displays correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 22:29:19 +02:00
8b60428b3b feat(admin): replace image URL input with ImageUpload component + fetch-from-URL
All checks were successful
CI / ci (push) Successful in 1m56s
CI / e2e (push) Has been skipped
CI / deploy (push) Successful in 17s
Admin item edit page now uses the same ImageUpload component as the rest
of the app (file upload, preview, crop editor). Also adds a "Fetch from URL"
input that uses /api/images/from-url. Renames "Source URL" to "Product Page URL".

Backend updated to accept imageFilename, dominantColor, cropZoom/X/Y fields
and return presignedImageUrl for display.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 22:01:39 +02:00
31a9e3c1ff fix(admin): move detail routes to directory structure to fix rendering
All checks were successful
CI / ci (push) Successful in 1m54s
CI / e2e (push) Has been skipped
CI / deploy (push) Successful in 18s
Admin item/tag edit pages weren't rendering because TanStack Router treated
them as children of the list route (which had no Outlet). Moving to
directory-based routing (items/index.tsx + items/$itemId.tsx) makes them
siblings that render directly in the admin layout.

Also adds UAT results for phases 35-38 and backlog item 999.12 (Admin UX Polish).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-20 21:40:57 +02:00
e044547121 chore: fix lint errors — auto-format, isNaN, unused imports, button type
Some checks failed
CI / ci (push) Failing after 1m41s
CI / e2e (push) Has been skipped
CI / deploy (push) Has been skipped
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 22:54:37 +02:00
0571ee47fb feat(38-02): tag edit page + enable Tags sidebar link
- Create admin/tags.$tagId.tsx with rename, reparent (cycle-safe), and delete
- getDescendantIds excludes self + all descendants from parent picker
- getDeleteConfirmText builds impact-aware confirmation (item count + child count)
- Delete confirmation modal with This cannot be undone
- Enable Tags sidebar Link in admin.tsx (remove disabled div + Soon badge)
2026-04-19 22:31:45 +02:00
1f8b85dc62 feat(38-02): admin tag hooks + list page with tree view and quick-add
- Create useAdminTags.ts with 5 hooks (useAdminTags, useAdminTag, useCreateAdminTag, useUpdateAdminTag, useDeleteAdminTag)
- Dual query key invalidation on all mutations (admin-tags + tags)
- Create admin/tags.tsx with collapsible tree view, search/filter, quick-add form
- buildTree, flattenTree, filterTree utilities for hierarchy rendering
- Chevron expand/collapse with LucideIcon, depth-based indent
2026-04-19 22:31:06 +02:00
311ebe8afe feat(38-01): admin tag routes + route registration + integration tests
- Create admin-tags.ts with GET list, GET single, POST, PUT (cycle guard → 400), DELETE
- Register /tags route in admin.ts
- Add 13-test integration suite covering CRUD, cycle detection, orphan behavior
2026-04-19 22:28:02 +02:00
8cefdf625b feat(38-01): schema parentId + tag service CRUD + cycle detection
- Add parentId self-ref FK to tags table (ON DELETE SET NULL)
- Generate Drizzle migration 0010_yielding_random.sql
- Extend tag.service.ts with getAdminTags, getTagWithCounts, createTag, updateTag, deleteTag, isDescendant
- Add service tests (14 tests, all pass)
2026-04-19 22:26:47 +02:00
6931c33f73 feat(37-02): admin global items client — list, edit, sidebar activation
- Add useAdminGlobalItems hooks: infinite query, detail query, update/delete mutations
- Activate Items sidebar link in admin.tsx (replace disabled div with active Link)
- Create /admin/items list page with table, infinite scroll, search, tag filters, skeleton
- Create /admin/items/$itemId edit page with all fields, manufacturer dropdown, TagInput chip component
- Delete confirmation dialog shows ownerCount impact message
- routeTree.gen.ts updated with /admin/items and /admin/items/$itemId routes

Closes ADMN-02, ADMN-03, ADMN-04 (client side)
2026-04-19 21:34:53 +02:00
db471001fa feat(37-01): admin global item services, routes, and unit tests
- Add listGlobalItemsForAdmin: paginated with batched tag/ownerCount queries
- Add updateGlobalItemById: partial update in transaction, syncs tags
- Add deleteGlobalItem: nullifies FK refs, removes tag associations before delete
- Create src/server/routes/admin-items.ts with GET/GET:id/PUT/DELETE endpoints
- Mount adminItemRoutes at /items in admin.ts (protected by requireAuth+requireAdmin)
- Extend global-item.service.test.ts with 13 new tests (all passing)

Closes ADMN-02, ADMN-03, ADMN-04 (server side)
2026-04-19 21:32:42 +02:00
72473bc5c5 chore(36-02): regenerate routeTree.gen.ts with /admin and /admin/ routes 2026-04-19 20:49:19 +02:00
8f62edc91d feat(36-02): add conditional Admin link to UserMenu for admin users 2026-04-19 20:49:03 +02:00
7a3dca768a feat(36-02): add /admin layout route and placeholder index
- admin.tsx: createFileRoute('/admin') with sidebar shell (Items, Tags disabled with Soon badge)
- admin/index.tsx: createFileRoute('/admin/') placeholder with shield icon
- useEffect guard redirects non-admin users to /
2026-04-19 20:48:53 +02:00
080838ecb5 feat(36-02): add isAdmin to AuthState interface in useAuth.ts 2026-04-19 20:48:30 +02:00
48381105b5 feat(36-01): add /api/admin placeholder route with requireAuth + requireAdmin middleware 2026-04-19 20:47:36 +02:00
18883fb9f0 feat(36-01): surface isAdmin in /api/auth/me response 2026-04-19 20:47:12 +02:00
34c7d27ee5 feat(36-01): add requireAdmin middleware to auth.ts
- Import eq from drizzle-orm and users from schema
- Export requireAdmin(c, next) that returns 401 if userId not in context, 403 if user.isAdmin is falsy
2026-04-19 20:47:06 +02:00
23cdb25063 feat(36-01): add isAdmin column to users table schema and generate migration
- Add isAdmin boolean(is_admin) NOT NULL DEFAULT false to users table
- Generate migration 0009_spotty_lord_tyger.sql
- NOTE: db:push requires DATABASE_URL with correct credentials to apply
2026-04-19 20:46:51 +02:00
7e684176ab fix(35): WR-04 use startsWith/slice for brand-stripping to avoid mid-string matches
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 20:14:28 +02:00
93c273d266 fix(35): WR-03 add onError to GearImage to dismiss skeleton on broken images
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 20:14:07 +02:00
65f25e5964 fix(35): WR-02 close FAB menu before opening catalog search overlay
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 20:13:33 +02:00
d58f7fab40 fix(35-03): add cursor-pointer to FabMenu and BottomTabBar buttons
- Add cursor-pointer to FabMenu menu item buttons (motion.button)
- Add cursor-pointer to FabMenu main FAB button (motion.button)
- Add cursor-pointer to BottomTabBar anonymous collection tab button
- Add cursor-pointer to BottomTabBar anonymous setups tab button
- Add cursor-pointer to BottomTabBar search tab button
2026-04-19 19:50:38 +02:00
e1d516cfe8 fix(35-03): add cursor-pointer to ItemCard navigable case
- Add cursor-pointer to the non-null linkTo branch of the outer button
- Preserve cursor-default for the null linkTo branch (setup cards)
2026-04-19 19:49:44 +02:00
88db308a16 feat(35-02): add image skeleton loading states to all card types
- Add useState(false) loaded state to ItemCard, CandidateCard, GlobalItemCard
- Show bg-gray-100 animate-pulse skeleton overlay while image loads
- Fade in image via transition-opacity duration-200 on onLoad callback
- No-image placeholders (icon on bg-gray-50) unchanged
- Add import { useState } from react to all three files with correct Biome import order
2026-04-19 19:47:11 +02:00
2d2259a0db feat(35-02): add loading=lazy and onLoad prop to GearImage
- Add optional onLoad prop to GearImageProps interface
- Destructure onLoad in function signature
- Forward loading="lazy" and onLoad to all three img render paths (cover, hasCrop, default)
2026-04-19 19:45:01 +02:00
053d56236f fix(35-01): replace login page card UI with immediate useEffect redirect (FIX-04)
- Remove auth check, useNavigate, useTranslation, and full card UI
- LoginPage now renders only "Signing in..." and immediately navigates to server /login
- Server /login route handles Logto OIDC redirect; no client-side logic needed
2026-04-19 19:41:57 +02:00
b43a932217 fix(35-01): extend ItemWithCategory with image and currency fields (FIX-02)
- Add imageUrl, dominantColor, cropZoom, cropX, cropY, priceCurrency to interface
- Server already returns these fields via withImageUrls(); type was just incomplete
2026-04-19 19:41:44 +02:00
7fca92985a fix(35-01): wire Add Candidate button to CatalogSearchOverlay, delete AddCandidateModal
- Replace setAddCandidateOpen(true) with openCatalogSearch("thread") + setCatalogSessionThreadId
- Remove addCandidateOpen useState
- Delete entire AddCandidateModal component (~300 lines of dead code)
- Remove imports only used by the deleted modal: useCreateCandidate, useCurrency, ImageUpload, CategoryPicker
2026-04-19 19:41:33 +02:00
beaea46e92 fix: use CategoryPicker in AddToThreadModal new-thread create mode
Replaces plain <select> with CategoryPicker for consistency with
ManualEntryForm, CreateThreadModal, and other thread creation flows.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 17:00:03 +02:00
5f63e6f75d fix: resolve Bun mock isolation contamination across test files
Some checks failed
CI / ci (push) Failing after 1m35s
CI / e2e (push) Has been skipped
CI / deploy (push) Has been skipped
- storage.service.ts: use dynamic import() inside each function so the
  current @aws-sdk mock is always picked up regardless of module load order
- images.test.ts + image.service.test.ts: replace module-level storage.service
  mock with @aws-sdk/client-s3 mock to avoid contaminating storage.service.test.ts
- routes/auth.test.ts: remove unnecessary oauth.service mock (no test uses
  verifyAccessToken) which was contaminating oauth.service.test.ts
- middleware/auth.test.ts: complete oauth.service mock shape with all exports

All 464 tests now pass in a single bun test run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 16:19:39 +02:00
4ccbb2b070 fix: wire catalog add buttons, fix Trans bold rendering, lint cleanup
Some checks failed
CI / ci (push) Failing after 1m44s
CI / e2e (push) Has been skipped
CI / deploy (push) Has been skipped
- CatalogSearchOverlay: replace handleAddStub with real openAddToCollection/openAddToThread routing based on catalogSearchMode
- ConfirmDialog + __root.tsx: swap t() for Trans component on deleteItemMessage, deleteCandidateMessage, pickWinnerMessage — fixes <bold> rendering as literal text
- Biome format pass: fix 23 lint/format errors across scripts, services, tests
- Planning: mark all UAT and verification gaps resolved for phases 07, 11, 16, 20, 21, 22, 24, 32, 34; close debug sessions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 15:36:16 +02:00
44b1eac0ba feat(catalog): migrate dev seed data to manufacturer-slug-based global items
Replace brand text field with manufacturerSlug in DEV_GLOBAL_ITEMS,
global-items-seed.json, and seed-global-items.ts. Add DEV_MANUFACTURERS
for dev-only brands not in SEED_MANUFACTURERS. Expand SEED_MANUFACTURERS
with 8 additional manufacturers referenced by seed JSON (Nemo, Therm-a-Rest,
Toaks, Katadyn, HydraPak, Nitecore, Outdoor Research, Exposure Lights).
Update dev-seed.ts to resolve slug→id before insert and use manufacturerId
as the deduplication key.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:37:27 +02:00
0b4715b80c fix: update all tests and MCP catalog tool for manufacturerId schema migration 2026-04-18 16:30:11 +02:00
a508773809 feat: all services join manufacturers for global item brand display 2026-04-18 16:24:24 +02:00
2924c2269c feat: item service joins manufacturers for brand display 2026-04-18 16:22:10 +02:00
12b3f8e380 feat: upsertGlobalItemSchema — brand → manufacturerSlug 2026-04-18 16:21:32 +02:00
5037350aa0 feat: global-item service uses manufacturerSlug, joins manufacturers for brand 2026-04-18 16:21:25 +02:00
8ff680ef92 feat: migrate globalItems — drop brand text, add manufacturerId FK 2026-04-18 16:19:31 +02:00
f868bbdecf feat: seed manufacturers list, update seedGlobalItems to resolve by name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:16:52 +02:00
ec27df1d0f feat: manufacturers route — list, get, create
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:16:27 +02:00
8c1b19f07d feat: manufacturer service with list, get, create
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:15:40 +02:00
7de3e9e957 feat: add manufacturers table to schema
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:54:23 +02:00
bea386e7db style(i18n): fix lint — formatting and import ordering across 21 files
All checks were successful
CI / ci (push) Successful in 1m21s
CI / e2e (push) Has been skipped
CI / deploy (push) Successful in 1m15s
Biome auto-fix for formatting (line length, ternary wrapping) and
import organization in files touched by phase 34 i18n work.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 14:49:10 +02:00
dbab84ef2a fix(i18n): wire useTranslation into SetupsView — close verification gap
Replace hardcoded English strings in SetupsView.tsx with t() calls
using existing setups namespace keys. Closes the 1 gap found during
phase 34 verification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 14:41:23 +02:00
31297a3921 fix(34-05): add missing German translation keys to collection namespace
- Add form.msrp, form.purchasePrice, form.itemNamePlaceholder, form.optionalNotes
- Fixes key parity test failure in tests/i18n/locales.test.ts
2026-04-18 14:08:51 +02:00
bf64b8f6a5 chore: merge executor worktree (worktree-agent-a1291d63 — plan 34-02) 2026-04-18 14:04:14 +02:00
2aa156a6b7 feat(34-02): extract hardcoded strings from modals, routes, and catalog
- AddToCollectionModal: all labels, placeholders, toast messages
- collection/index.tsx: tab labels (Gear/Planning)
- threads/$threadId/index.tsx: thread detail page and AddCandidateModal
- items/$itemId.tsx: back links, action buttons, field labels, metadata
- setups/$setupId.tsx: all setup detail strings and confirm dialog
- users/$userId.tsx: public profile page strings
- global-items/index.tsx: discover/catalog filter UI strings
- Added catalog.json namespace (en + de) and registered in i18n.ts
- Extended en/de threads, setups, collection, common locales with missing keys
2026-04-18 14:01:09 +02:00
6fd8874970 feat(34-02): extract hardcoded strings from thread/candidate components
- CandidateCard: replace all hardcoded titles and badge text with t()
- CandidateListItem: add useTranslation, replace winner/delete/open labels and +/- Notes badge
- CandidateForm: add useTranslation, replace all form labels, placeholders, validation errors, submit button
- ComparisonTable: move STATUS_LABELS inside component with t(), replace all ATTRIBUTE_ROWS labels, View button, impact row labels
- StatusBadge: refactor STATUS_CONFIG to STATUS_ICONS + runtime STATUS_LABELS via t()
- CreateThreadModal: replace title, thread name label, category label, placeholder, cancel/submit buttons, error messages
- AddToThreadModal: replace modal titles, labels, placeholders, back/cancel/submit buttons, error messages
- threads.json: extend candidateForm with category, notes, pros, cons, product link labels and all placeholders
2026-04-18 13:44:26 +02:00