From a3680a3259d602acabc4474d1c779a21297d47ac Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Sun, 23 Aug 2026 20:38:12 +0530 Subject: [PATCH] enh --- .commandcode/taste/taste/taste.md | 4 +++- apps/user-ui/app/(drawer)/(tabs)/home/index.tsx | 9 +++++---- apps/user-ui/components/ProductCard.tsx | 4 +++- apps/user-ui/src/store/centralSlotStore.ts | 6 ++++-- packages/ui/index.ts | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.commandcode/taste/taste/taste.md b/.commandcode/taste/taste/taste.md index 04ba820..60c4b9d 100644 --- a/.commandcode/taste/taste/taste.md +++ b/.commandcode/taste/taste/taste.md @@ -1,7 +1,7 @@ # Taste - Prefers that the agent not run typechecks; instead, read the project's AGENTS.md for instructions on what to do/not do before finalizing work. Confidence: 0.9 - Judges completion by seeing the feature live in the running app ("I still don't see it on the /home route page"), so for data-driven features the agent must verify the app's actual runtime data source (API base URL, cache/backend) has the required data — not just that code builds and typechecks. Confirmed when the user signaled success only after the fix (pointing web-ui at the local backend with the tags data) made the section visible in the running app, and reconfirmed with the admin-ui product selector showing no products because it points at the production worker. Confidence: 0.9 -- Prefers detailed analysis and explicit error/mistake checking before executing git operations (e.g., merges), rather than just performing the action. Confidence: 0.6 +- Prefers detailed analysis and explicit error/mistake checking before executing destructive operations, rather than just performing the action — e.g., before a git merge, or before deleting a row directly from the DB (asked "Can I simply delete the row from db. Will it cause any problems" about an unclaimed reserved coupon, expecting the agent to trace all referencing tables/FKs — couponUsages, couponApplicableUsers/Products — before answering). Confidence: 0.7 - Do not run `git stash` or other destructive git operations that would discard or modify working-tree changes without explicit permission. Confidence: 0.9 - When removing unused code (e.g., an unused tRPC procedure), prefers a complete cleanup: also remove internal helper methods used only by it, associated types, re-exports, orphaned hook/API files and their shared types, and even commented-out imports, leaving zero remaining references. Confidence: 0.9 - Before removing or deciding on code, likes to first verify where it is actually used across the codebase (asks questions like "where is X used"), rather than removing based on assumption. Confidence: 0.4 @@ -88,6 +88,8 @@ er-ui/app/(drawer)/(tabs)/home/index.tsx, I want similar here") and expects the - Expects back navigation in the mobile app to return to the screen he navigated from, not to an unrelated tab root — when a link from the cart page to the coupons page (which lives in another tab's stack) made pressing back land on the "Me" page instead of the cart, he reported it as a bug ("when I try to press back I don't come to the cart page again. I come to me page. why is that"); cross-tab navigation flows must preserve a way back to the origin screen. Confidence: 0.6 - When the same screen can be reached from multiple entry points, wants its UI to adapt based on the entry point — e.g., the coupons page opened from the cart page (via a `?from=cart` param) should hide the bottom tab bar while focused and restore it on leaving, while the same page opened from its own tab keeps the tab bar visible ("if coupons page is accessed from cart page, I want to hide the bottom nav bar"). Confidence: 0.7 - For bulk/sequential generation from a code pattern (e.g., ABC12 → ABC13...), expects numbering to continue from the HIGHEST existing value so regeneration never re-emits already-entered codes — after entering ABC12, the next batch must start at ABC13, not restart at 12 (the first matching code). Confidence: 0.6 +- Dislikes UI that renders transient loading states as definitive business states — e.g., the home page showed every item as "out of stock" until slot data loaded, because the out-of-stock check treated "no slot yet" (data not loaded) as genuinely out of stock. Expects a "data loaded" guard so the UI never flashes a wrong definitive status (out of stock) before data arrives, while still applying real out-of-stock detection once loaded. Confidence: 0.7 +- When deleting a record, prefers the existing soft-delete/invalidate path over hard-deleting rows: the supported delete already sets `isInvalidated: true` (keeping history/audit and avoiding broken FK joins), and a raw hard delete should only be considered when confirmed nothing references the row (no usage records), with related rows (couponApplicableUsers/Products) removed transactionally to avoid orphans. Confidence: 0.75 e changes. Confidence: 0.95 er-ui/app/(drawer)/(tabs)/home/index.tsx, I want similar here") and expects the agent to mirror that pattern exactly, including details like item counts and container styling. Confidence: 0.9 als) rather than introducing new brand palettes; approval of a redesign's layout/composition does not imply approval of color or theme changes. Confidence: 0.95 diff --git a/apps/user-ui/app/(drawer)/(tabs)/home/index.tsx b/apps/user-ui/app/(drawer)/(tabs)/home/index.tsx index ee9b9cf..b4ee60b 100755 --- a/apps/user-ui/app/(drawer)/(tabs)/home/index.tsx +++ b/apps/user-ui/app/(drawer)/(tabs)/home/index.tsx @@ -513,6 +513,7 @@ export default function Dashboard() { const [hasMore, setHasMore] = useState(true); const { getQuickestSlot } = useProductSlotIdentifier(); const productSlotsMap = useCentralSlotStore((state) => state.productSlotsMap); + const isSlotsLoaded = useCentralSlotStore((state) => state.isSlotsLoaded); const refetchProducts = useCentralProductStore((state) => state.refetchProducts); const refetchSlotsFromStore = useCentralSlotStore((state) => state.refetchSlots); const [isRefreshing, setIsRefreshing] = useState(false); @@ -552,8 +553,8 @@ export default function Dashboard() { const slotA = getQuickestSlot(a.id) const slotB = getQuickestSlot(b.id) - const aOutOfStock = Boolean(productSlotsMap[a.id]?.isOutOfStock) || !slotA - const bOutOfStock = Boolean(productSlotsMap[b.id]?.isOutOfStock) || !slotB + const aOutOfStock = Boolean(productSlotsMap[a.id]?.isOutOfStock) || (isSlotsLoaded && !slotA) + const bOutOfStock = Boolean(productSlotsMap[b.id]?.isOutOfStock) || (isSlotsLoaded && !slotB) if (aOutOfStock && !bOutOfStock) return 1 if (!aOutOfStock && bOutOfStock) return -1 @@ -605,14 +606,14 @@ export default function Dashboard() { for (const product of ordered) { const isOut = Boolean(productSlotsMap[product.id]?.isOutOfStock) || - !getQuickestSlot(product.id); + (isSlotsLoaded && !getQuickestSlot(product.id)); if (isOut) outOfStock.push(product); else inStock.push(product); } map[tag.id] = [...inStock, ...outOfStock]; } return map; - }, [dashboardTags, products, productSlotsMap, getQuickestSlot]); + }, [dashboardTags, products, productSlotsMap, getQuickestSlot, isSlotsLoaded]); const handleRefresh = useCallback(async () => { setIsRefreshing(true); diff --git a/apps/user-ui/components/ProductCard.tsx b/apps/user-ui/components/ProductCard.tsx index 549705c..3191254 100644 --- a/apps/user-ui/components/ProductCard.tsx +++ b/apps/user-ui/components/ProductCard.tsx @@ -118,7 +118,9 @@ const ProductCard: React.FC = ({ // Use isOutOfStock from productSlotsMap (all products now included) const productSlotInfo = productSlotsMap[item.id]; const isOutOfStockFromSlots = productSlotInfo?.isOutOfStock; - const displayIsOutOfStock = isOutOfStockFromSlots || !slotId; + const isSlotsLoaded = useCentralSlotStore((state) => state.isSlotsLoaded); + // Don't treat "no slot yet" as out of stock while slot data is still loading + const displayIsOutOfStock = isOutOfStockFromSlots || (isSlotsLoaded && !slotId); // if(item.name.startsWith('Mutton Curry Cut')) { // console.log({slotId, displayIsOutOfStock}) diff --git a/apps/user-ui/src/store/centralSlotStore.ts b/apps/user-ui/src/store/centralSlotStore.ts index fa72172..914d2d3 100644 --- a/apps/user-ui/src/store/centralSlotStore.ts +++ b/apps/user-ui/src/store/centralSlotStore.ts @@ -17,6 +17,7 @@ interface ProductSlotInfo { interface CentralSlotState { slots: Slot[]; productSlotsMap: Record; + isSlotsLoaded: boolean; refetchSlots: (() => Promise) | null; setSlotsData: (slots: Slot[], productAvailability: ProductAvailability[], availability: AvailabilityEntry[]) => void; clearSlotsData: () => void; @@ -26,6 +27,7 @@ interface CentralSlotState { export const useCentralSlotStore = create((set) => ({ slots: [], productSlotsMap: {}, + isSlotsLoaded: false, refetchSlots: null, setSlotsData: (slots, productAvailability, availability) => { const productSlotsMap: Record = {}; @@ -53,9 +55,9 @@ export const useCentralSlotStore = create((set) => ({ }); }); - set({ slots, productSlotsMap }); + set({ slots, productSlotsMap, isSlotsLoaded: true }); }, - clearSlotsData: () => set({ slots: [], productSlotsMap: {} }), + clearSlotsData: () => set({ slots: [], productSlotsMap: {}, isSlotsLoaded: false }), setRefetchSlots: (refetchSlots) => set({ refetchSlots }), })); diff --git a/packages/ui/index.ts b/packages/ui/index.ts index 91d4254..9c0a77a 100755 --- a/packages/ui/index.ts +++ b/packages/ui/index.ts @@ -59,7 +59,7 @@ const isDevMode = Constants.executionEnvironment !== "standalone"; // const BASE_API_URL = 'http://192.168.100.109:8787'; // let BASE_API_URL = "https://raw.freshyo.in"; let BASE_API_URL = "https://worker.freshyo.in"; -// let BASE_API_URL = "https://freshyo.technocracy.ovh"; +// let BASE_API_URL = "https://devapi.freshyo.in"; // let BASE_API_URL = 'http://192.168.100.120:8787'; // let BASE_API_URL = 'http://192.168.29.176:4000';