Fix product image gallery and submenu navigation

This commit is contained in:
2026-06-01 08:16:16 +07:00
parent 2cfff02b69
commit 4e28ccdbd1
8 changed files with 174 additions and 45 deletions

View File

@ -8,6 +8,12 @@ Latest verified commit: `f090ba7`
This codebase has recent updates around auth/onboarding, help/privacy pages, dashboard search, product creation/edit/review/detail, admin review/detail, stock/price editing, seller in-review listing, backend request logging, expired-session redirects, product keyword limits, sanitized backend error display, AddProductRequest validation, and 10 MB upload limits.
Latest local verification before the newest push:
```bash
npm run build
```
The latest build was verified successfully with:
```bash
@ -20,6 +26,60 @@ Latest TypeScript verification after the validation/upload changes:
npx tsc --noEmit
```
## Latest Codex Changes After `2cfff02`
### Product edit image payload preservation
File:
- `src/app/(dashboard)/products/[productId]/edit/page.tsx`
Behavior:
- Edit-product save keeps `imageId` as the main image field.
- If the main image already exists inside `productImages`, the save payload preserves it at the same sequence.
- If the main image is replaced, the old main image entry inside `productImages` is replaced with the new `imageId` at the same sequence.
- The edit gallery UI hides duplicate thumbnails where `form.imageId` is also present in `form.productImages`, but the underlying array is preserved for payload sequence.
Expected image payload shape:
```json
{
"imageId": "imageBaru.jpg",
"productImages": [
{ "imageId": "gallery-0.jpg", "sequence": 1 },
{ "imageId": "imageBaru.jpg", "sequence": 2 },
{ "imageId": "gallery-2.jpg", "sequence": 3 }
]
}
```
### Product detail image gallery
Files:
- `src/app/(dashboard)/products/[productId]/detail/page.tsx`
- `src/components/product-variant-showcase.tsx`
- `src/lib/product-variants.ts`
Behavior:
- Product detail image thumbnails are deduplicated between root `imageId` and `productImages`.
- Thumbnail strip is horizontally scrollable when there are many images.
- Clicking a thumbnail updates the large preview image.
- The active thumbnail receives a visible selected state.
### Product submenu click lock fix
Files:
- `src/app/(dashboard)/layout.tsx`
- `src/app/(dashboard)/products/page.tsx`
- `src/components/product-submenu-nav.tsx`
Behavior:
- Product submenu items now use Next `<Link>` instead of manual `button` + `router.push`.
- `All Product` now navigates to `/products?tab=all`, matching the query-based pattern used by the other submenu tabs.
- Product API already normalizes `tab=all` to the all-product backend endpoint.
- Sidebar z-index was raised above product modals so submenu clicks are not blocked by stale overlays.
- Product list clears action-menu and modal state when tab/page changes.
- Delete/unpublish/stock-price-load errors now close the related modal after showing the error, preventing a full-screen overlay from trapping sidebar clicks.
## Latest Codex Changes After `76fb4f3`
### Product create preorder and warranty submit rules
@ -602,13 +662,13 @@ pm2 save
sudo -iu inadev pm2 status
```
Current expected deployed commit after latest push:
Current expected deployed commit after latest push is the latest `origin/main` commit from this handoff update. Verify short hash with:
```bash
2f64282
git rev-parse --short HEAD
```
Verify on server:
Verify full commit on server:
```bash
git rev-parse HEAD