Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { useMemo } from 'react'
import { useMemo, Suspense } from 'react'
import { Route, Routes } from 'react-router-dom'
import { useQuery } from '@apollo/client/react'
import { AuthProvider } from '#src/contexts/auth/AuthContext'
import { CartProvider } from '#src/contexts/cart/CartContext'
import { Layout } from '#src/components/layout/Layout'
import { LoadingState } from '#src/components/LoadingState'
import { GET_PRODUCTS } from '#src/graphql/queries'
import { routes } from '#src/routes'
import type { ProductsQueryResult } from '#src/types'

function AppRoutes() {
return (
<Routes>
{routes.map((route) => (
<Route
key={route.path}
path={route.path}
element={<Layout backLink={route.backLink}>{route.element}</Layout>}
/>
))}
</Routes>
<Suspense fallback={<LoadingState />}>
<Routes>
{routes.map((route) => (
<Route
key={route.path}
path={route.path}
element={<Layout backLink={route.backLink}>{route.element}</Layout>}
/>
))}
</Routes>
</Suspense>
)
}

Expand Down
11 changes: 7 additions & 4 deletions src/ProductCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ type ProductCardProps = {
product: Product
onAdd: () => void
isHighlighted: boolean
averageRating: number | null
}

export default function ProductCard({ product, onAdd, isHighlighted }: ProductCardProps) {
// Use product.rating from database (which should be kept up to date)
const averageRating = product.rating || null

export default function ProductCard({
product,
onAdd,
isHighlighted,
averageRating,
}: ProductCardProps) {
return (
<Link
to={`/product/${product.id}`}
Expand Down
Loading