5.7 KiB
Handoff
Project: ina-trading-web
Current branch: main
Latest verified commit: b266047
Summary
This codebase has recent updates around product creation, edit, review, detail, admin review, stock/price editing, and backend request logging.
The latest build was verified successfully with:
npm run build
Recent Commits
e9a0cd0Update product review, measurement, and backend logging flowsb266047Fix TypeScript build errors in product detail and admin review
Main Changes
1. Backend proxy logging
Files:
src/lib/backend-fetch-logger.tssrc/instrumentation.ts.env.localusesDEBUG_BACKEND_PROXY=truelocally
Behavior:
- Logs server-side
fetchrequests to backend - Logs request method, URL, headers, body preview
- Logs response status, duration, headers, body preview
- Redacts authorization header
Use this when tracing frontend-to-backend failures in local dev.
2. Product measurement mode on add product
Files:
src/app/(dashboard)/products/new/pricing/page.tsxsrc/lib/use-product-submit.tssrc/app/(dashboard)/products/new/review/page.tsx
Behavior:
- Each model has a
Product Measurementswitch - When enabled:
- nested measurements are shown
- model-level price, currency, weight, dimensions, promotion, packaging, and warehouse stock are disabled
- at least 1 measurement row is required
- Submit payload uses
model.hasMeasurements - When measurement mode is active, model-level numeric fields are zeroed and model warehouses are omitted
3. Product measurement mode on edit product
File:
src/app/(dashboard)/products/[productId]/edit/page.tsx
Behavior:
- Matches add-product measurement behavior
- Uses explicit
hasMeasurementsstate instead of guessing from array length - Disables model-level fields when measurement mode is on
4. Seller product review page improvements
File:
src/app/(dashboard)/products/new/review/page.tsx
Behavior:
- Review now renders actual product thumbnails using backend file URLs
- Previously it only showed image indicators, which was confusing
- Review also reflects measurement-based pricing correctly
5. Product list page improvements
File:
src/app/(dashboard)/products/page.tsx
Behavior:
- Edit stock/price modal supports:
- choosing model
- choosing measurement if present
- choosing warehouse
- Warehouse labels use warehouse names from master warehouse API, not raw UUIDs
- Product row status badges now show explicit state like active, draft, review, unpublished, deleted, rejected
6. Product detail page improvements
File:
src/app/(dashboard)/products/[productId]/detail/page.tsx
Behavior:
- Main category now resolves even when backend omits
subCategory.category.name - Warehouse display now uses warehouse master names instead of UUID slices
- TypeScript nullability issue for category resolution was fixed here
7. Admin review page improvements
File:
src/app/admin/review/[productId]/page.tsx
Behavior:
- Review supports model + measurement structures
- New product review and compare review now handle measurement-driven price/weight/dimension/promo/stock
- Compare view highlights updated sections using backend compare response and
isUpdate - Product images are rendered using main image + gallery images
- TypeScript issue around
row.fieldnullability was fixed here
8. Sidebar submenu reliability
Files:
src/components/product-submenu-nav.tsxsrc/components/admin-product-submenu-nav.tsx
Behavior:
- Click behavior was hardened because submenu items were sometimes not navigating
- Navigation is explicit via
router.push(...)
Translation Files Touched
src/lib/translations/id.tssrc/lib/translations/en.ts
These include labels added for statuses and stock/price modal UI.
Important Findings
Admin review image issue
For at least one reviewed product, backend review payload returned:
image: nullimageId: nullproductImages: []
In that case frontend cannot render images. If an image is missing in review, verify backend review payload before debugging frontend.
Edit product empty main image behavior
In edit product submit flow, empty imageId is currently sent as undefined, which means the field is omitted from JSON payload, not sent as null and not sent as empty string.
If backend requires explicit image removal via null, this behavior will need to be changed.
Local Dev Notes
Run local dev:
npm run dev
Build verification:
npm run build
Dev Server Update Guide
Based on current deployment notes, dev server update flow is:
sudo -iu inadev
cd ~/apps/ina-trading-web
git pull origin main
npm ci
npm run build
pm2 restart ina-trading-dev
pm2 save
sudo -iu inadev pm2 status
Optional logs:
sudo -iu inadev pm2 logs ina-trading-dev --lines 100
Suggested Next Checks
- Verify whether backend expects
nullwhen main image is intentionally removed during edit - Verify seller and admin review payload consistency for image fields
- Verify warehouse master API always contains all warehouse IDs referenced in product payloads
- If submenu click issue still appears, inspect layout overlays with browser tooling
- Consider adding field-level compare highlighting, not only section-level highlighting, in admin review compare page
Files Most Likely To Be Relevant Next
src/app/(dashboard)/products/new/pricing/page.tsxsrc/app/(dashboard)/products/[productId]/edit/page.tsxsrc/app/(dashboard)/products/new/review/page.tsxsrc/app/(dashboard)/products/[productId]/detail/page.tsxsrc/app/(dashboard)/products/page.tsxsrc/app/admin/review/[productId]/page.tsxsrc/lib/use-product-submit.tssrc/lib/backend-fetch-logger.ts