feat(frontend): add product detail view and navigation
Run Tests on Branches / Detect Changes (push) Successful in 12s
Run Tests on Branches / Backend Tests (push) Has been cancelled
Run Tests on Branches / Frontend Tests (push) Has been cancelled
Run Tests on Branches / Frontend Mobile Tests (push) Has been cancelled

- Create ProductView component with product details display
- Add ProductView.css with responsive styling
- Add product screen to App.jsx screen system
- Pass onNavigateToProduct callback from App to SearchView
- Update ProductResults onSelect to use callback instead of window.location
This commit is contained in:
Antoni Nuñez Romeu
2026-07-13 17:36:52 +02:00
parent 31c1a14343
commit 731a6c98ae
4 changed files with 246 additions and 2 deletions
+6 -2
View File
@@ -14,7 +14,7 @@ const suggestions = [
{ name: 'Omeprazol', icon: 'emergency_home', color: 'neutral-4' },
];
function SearchView({ currentUser, onLoginRequest, initialQuery = '' }) {
function SearchView({ currentUser, onLoginRequest, initialQuery = '', onNavigateToProduct }) {
const [searchQuery, setSearchQuery] = useState(initialQuery);
const [medicines, setMedicines] = useState([]);
const [products, setProducts] = useState([]);
@@ -331,7 +331,11 @@ function SearchView({ currentUser, onLoginRequest, initialQuery = '' }) {
<ProductResults
products={products}
onSelect={(p) => {
window.location.href = `/product/${p.source}/${p.id}`;
if (onNavigateToProduct) {
onNavigateToProduct(p.source, p.id);
} else {
window.location.href = `/product/${p.source}/${p.id}`;
}
}}
/>
</div>