freshyo/change-log.txt
2026-11-01 14:15:17 +05:30

172 lines
9.6 KiB
Text

[2026-10-29 22:54:34 IST] Admin app: open the order from an order-placed push, including cold start.
--- apps/admin-ui/services/notif-service/pending-order.ts (new)
+ Module-level pending order id: setPendingOrderId / takePendingOrderId / clearPendingOrderId.
--- apps/admin-ui/services/notif-service/notif-context.tsx
~ Extract openFromNotification(response): numeric-validates data.orderId, dedupes by
request.identifier, pushes order details when signed in, stashes the id when signed out.
~ Call it from the response listener AND from Notifications.getLastNotificationResponseAsync()
(terminated-app tap), then clearLastNotificationResponseAsync().
~ Wait for StaffAuthProvider hydration (isLoading === false) before handling the launch response.
--- apps/admin-ui/components/context/staff-auth-context.tsx
~ On login success, route to a pending order notification target instead of always the dashboard.
--- apps/admin-ui/tests/mocks/expo-notifications-mock.ts
+ clearLastNotificationResponseAsync mock; __setLastResponse() to seed the cold-start response.
--- apps/admin-ui/tests/app/root-layout.test.tsx
+ AROOT-06 cold-start tap, AROOT-07 duplicate response opened once, AROOT-08 signed-out deferral.
--- apps/admin-ui/tests/pages/login.test.tsx
+ ALOGIN-15 pending order target wins over the dashboard after login.
--- apps/admin-ui/JEST-TEST-CASES.md
+ Catalogue rows for AROOT-06..08 and ALOGIN-15.
[2026-10-29 22:57:48 IST] Admin push notifications for order cancellation and new complaints.
--- apps/backend/src/lib/admin-notif.ts
~ notifyAllAdmins payload gains optional complaintId; forwarded in jobData.
--- apps/backend/src/lib/notif-job.ts
~ sendAdminNotification accepts complaintId and includes it in the push data.
--- apps/backend/src/lib/queue-consumer.ts
~ forwards jobData.complaintId (null fallback) to sendAdminNotification.
--- apps/backend/src/lib/post-order-handler.ts
~ handleOrderCancelled pushes "Order Cancelled" to every admin device with data.orderId.
--- packages/db_helper_sqlite/src/user-apis/complaint.ts
~ createComplaint returns the inserted complaint id (was void).
--- apps/backend/src/trpc/apis/user-apis/apis/complaint.ts
~ complaint.raise pushes "New Complaint" to admin devices with data.complaintId;
notification failures are logged and never fail the complaint.
--- apps/admin-ui/services/notif-service/pending-navigation.ts (renames pending-order.ts)
~ Holds a pending href instead of an order id, so a signed-out tap on either
notification type resumes after login.
--- apps/admin-ui/services/notif-service/notif-context.tsx
~ Routes data.complaintId to the complaints list (orderId still wins).
--- apps/admin-ui/components/context/staff-auth-context.tsx
~ login consumes the pending href.
--- tests
~ queue-consumer expectation gains complaintId; admin-ui root-layout/login tests
updated for the href-based pending target; AROOT-09 complaint tap added.
[2026-10-29 23:02:23 IST] Scope admin order/complaint push notifications to the event's region.
--- packages/db_helper_sqlite/src/admin-apis/staff-user.ts
+ getStaffNotifTokensForRegion(regionId): staff_notif_creds inner-joined to
staff_users where staff_users.region_id = regionId.
--- packages/db_helper_sqlite/index.ts
+ export the new helper.
--- packages/db_helper_sqlite/src/user-apis/order.ts
~ OrderWithFullData gains regionId (already selected at runtime).
--- packages/db_helper_sqlite/src/user-apis/complaint.ts
~ createComplaint returns { id, regionId } instead of a bare id.
--- apps/backend/src/lib/admin-notif.ts
+ notifyRegionAdmins(regionId, payload) — refuses null region, otherwise batches
the region's tokens. notifyAllAdmins kept for manual broadcasts only.
--- apps/backend/src/lib/post-order-handler.ts
~ Order placed and order cancelled use notifyRegionAdmins(order.regionId, ...).
--- apps/backend/src/trpc/apis/user-apis/apis/complaint.ts
~ complaint.raise uses notifyRegionAdmins(complaint.regionId, ...).
--- apps/backend/tests/unit/admin-notif.test.ts
~ Rewritten for region scoping + manual broadcast; asserts null region is a no-op.
[2026-11-01 12:32:24 IST] user-ui home: match the All Available Products grid spacing to the tag grid.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ staticStyles.columnWrapper.paddingHorizontal 16 -> 28. Cards keep
heroItemWidth, so the horizontal gap becomes 8px, identical to the tag grid
(mx-4 + px-3 = 28px inset, same 8px gaps).
~ All Available Products heading row px-1 -> px-3 so the title sits on the same
28px gutter as the rows.
No data, paging, or card changes.
[2026-11-01 12:34:02 IST] user-ui home: give the catalog grid the extra space as card width.
--- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx
~ Reverts the 28px row gutter: columnWrapper.paddingHorizontal back to 16 so the
grid keeps the page's 16px margin (and the heading returns to px-1).
+ catalogItemWidth = (screenWidth - 48) / 3; ProductItem (catalog rows only)
uses it instead of heroItemWidth, so three cards fill the row with 8px gaps.
Tag grid keeps heroItemWidth inside its 28px inset card.
[2026-11-01 12:37:54 IST] user-ui Offers/Combos: same compact 3-up grid as the home catalog.
--- apps/user-ui/app/(drawer)/(tabs)/order-again/index.tsx
~ heroItemWidth -> catalogItemWidth = (screenWidth - 48) / 3.
~ Grid gap-5 (20px) -> gap-2 (8px); px-4 page margin unchanged.
Three cards now fill the row, matching the All Available Products grid.
Web offers page already uses a 12px grid gap (gap-3), so no web change.
[2026-11-01 12:51:23 IST] Flash delivery: tag tabs instead of the store drawer, 3-up hero grid.
--- apps/user-ui/components/ProductCard.tsx
+ cartType?: 'regular' | 'flash' (default regular). Flash reads/writes the flash
cart, prices flashPrice ?? price, adds with slotId 0 and the 1hr alert, and
skips scheduled-slot out-of-stock/delivery badges. Regular call sites unchanged.
--- apps/user-ui/components/SlotSpecificView.tsx
+ FlashTagStrip: horizontal, fixed strip copied from home's TagTabStrip mechanics.
~ SlotLayout: isForFlashDelivery renders selector + strip + <Slot/>; the
scheduled view keeps its Drawer untouched.
~ FlashDeliveryProducts: tags from useAllProducts (first tag default), filter by
tag.productIds then search, numColumns 3, width (sw-48)/3, columnGap 8,
rowGap 12, ProductCard hero cards. Store filtering/loading gates removed.
--- apps/user-ui/app/(drawer)/(tabs)/flash-delivery/(products)/index.tsx
--- apps/user-ui/app/(drawer)/(tabs)/flash-delivery/(products)/_layout.tsx
~ storeId param no longer read or written; route shape unchanged.
--- apps/web-ui/src/routes/flash.tsx
~ Store tabs -> tag tabs (same order, first default); store filtering removed;
cart storeId still taken from the product.
--- tests
~ flash-products store cases rewritten for tags; slot-view flash asserts no
drawer; JEST-TEST-CASES rows updated.
[2026-11-01 12:56:02 IST] Flash delivery: page the tag feed 9 at a time with Show More.
--- apps/user-ui/components/SlotSpecificView.tsx
+ FLASH_PAGE_SIZE = 9; visibleCount state, reset on tag/search change; grid renders
the first 9, footer Show More adds 9 (home's pattern). testID flash-products-show-more.
--- apps/web-ui/src/routes/flash.tsx
~ Same 9-at-a-time paging with a Show More button; reset on tag change.
--- apps/user-ui/tests/pages/flash-products.test.tsx
+ FLASH-19: nine products render, Show More reveals the rest.
--- apps/user-ui/JEST-TEST-CASES.md
+ FLASH-19 row.
[2026-11-01 12:59:05 IST] Flash delivery: scroll-away tabs + a "Shop by Store" tab section.
--- apps/user-ui/components/SlotSpecificView.tsx
~ FlashTagStrip generalised to FlashTabStrip (items + testID prefix); reused for
tags and stores.
~ FlashDeliveryProducts becomes a ScrollView: search, tag strip, tag grid (9 +
Show More), then "Shop by Store" heading, store strip, store grid (9 + Show
More). Both strips scroll with the page; paging resets per section on
tab/search change. Search filters both grids. Every store gets a tab.
--- apps/web-ui/src/routes/flash.tsx
~ Same two sections, store tabs below the tag grid, independent 9-item paging.
--- tests
~ Product assertions scoped to the tag grid; new store-section cases.
[2026-11-01 14:06:51 IST] Flash delivery: the pull-to-refresh spinner no longer reports background fetches.
Diagnosed with a throwaway cache-subscription test (25s, real timers): the flash
screen itself starts no background fetches (only the 7 initial ones), and the
catalogue URL is built from assetsDomain/apiCacheKey/region/version — stable, so
the products query key does not churn. There is no 10s timer anywhere in
user-ui. What is wrong is the wiring: `refreshing` was bound to
`productsQuery.isFetching`, so *any* fetch (mount-after-stale, invalidation,
version bump, pull) drove the pull-to-refresh control, and the control element
was rebuilt on every render (re-attaching the platform control).
--- apps/user-ui/components/SlotSpecificView.tsx
~ FlashDeliveryProducts: `isRefreshing` local state + handleRefresh
(refetch products + stores, clear in finally), RefreshControl element
memoised. Mirrors home's handleRefresh. Background fetches are invisible.
--- apps/user-ui/src/hooks/useHideTabNav.ts
~ Focus callback memoised (was recreated every render, so useFocusEffect
unsubscribed/resubscribed per render and wrote false->true into the store,
flickering the tab bar on every render of every screen using it).
--- apps/user-ui/src/store/appStore.ts
~ setHideTabsNavKey no longer allocates when the key already has that value,
so it cannot notify subscribers spuriously.
--- tests
+ FLASH-24: a background refetch leaves the spinner idle.
+ FLASH-25: a pull keeps the spinner up until the refresh settles.
+ HIDE-04: re-render does not rewrite the store.
+ STORE-20: same-value write keeps the map identity.