Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The PR introduces a behavioral change to how “weekly specials” are selected (and currently doesn’t sort by savings before taking the first 4), and the scope change should be corrected and/or the selection logic fixed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Homepage “Weekly Specials” section to support the AD-FE-T2 navigation flow between Homepage → Specials page and Homepage Featured Special card → Product Details, while keeping “Add to List” behavior independent.
Changes:
- Added navigation from “View All Specials” to the Specials page route.
- Made each featured special card navigable to its Product Details route (while stopping propagation from the “Add to List” button).
- Updated the specials data loading logic to derive specials from the
/productsendpoint and render product images when available.
File summaries
| File | Description |
|---|---|
| Frontend/components/home/WeeklySpecialsSection.tsx | Adds navigation to Specials and Product Details from the Homepage specials section; updates specials fetching/mapping and card rendering. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| import React, { useState, useEffect } from "react"; | ||
| import { View,Text,Pressable,ActivityIndicator,Image,} from "react-native"; |
| const response = await fetch(`${API_URL}/products?limit=50`); | ||
|
|
||
| if (data.success && data.data) { | ||
| setSpecials(data.data); | ||
| } else { | ||
| setError(data.error || "Failed to load weekly specials"); | ||
| // Fallback to empty array or show error message | ||
| console.error("Error fetching weekly specials:", data.error); | ||
| if (!response.ok) { | ||
| throw new Error(`Products request failed: ${response.status}`); | ||
| } |
| (p: any) => p.product_name === product.product_name | ||
| ) | ||
| ) | ||
| .slice(0, 4) |
|
Hi @JaferRadi, I've re-reviewed the latest version. The navigation changes look good and the PR is mergeable. There is just one thing I’d like to fix before merge: the new /products logic currently takes .slice(0, 4) before sorting by savings, so the homepage may not display the four best specials. Could you please sort the filtered specials by savings/discount first, then take the first 4? This should be a small change. Once updated, I’m happy for this to proceed to the next approval step. |
Why
This PR completes the navigation flow required for AD-FE-T2 between the Homepage Featured Specials section, the Specials page, and Product Details.
What changed
Testing
Notes
No API, filtering, or UI design changes were made outside the scope of AD-FE-T2.