-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.tsx
More file actions
56 lines (49 loc) · 1.57 KB
/
app.tsx
File metadata and controls
56 lines (49 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { type Product } from "./types";
import { Layout } from "./components/layout";
import { Main } from "./components/main";
import { ProductGrid } from "./components/product-grid";
import { ProductCard } from "./components/product-card";
import { Summary } from "./components/summary";
import { useQuery } from "@tanstack/react-query";
import { Skeleton } from "./components/ui/skeleton";
function App() {
// TODO implement application logic to track order state
// TODO
const orderTotal = 0;
const { data: products, isLoading } = useQuery({
queryKey: ["products"],
queryFn: () => fetch("/api/products").then((res) => res.json()),
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const submitPayment = () => {
// TODO: Implement application logic to submit the payment
};
return (
<Layout>
<Main>
<ProductGrid>
{isLoading && (
<>
<Skeleton className="h-64 w-full" />
<Skeleton className="h-64 w-full" />
<Skeleton className="h-64 w-full" />
<Skeleton className="h-64 w-full" />
</>
)}
{!isLoading &&
products?.map((product: Product) => (
<ProductCard
product={product}
key={product.id}
onClick={() => {
// TODO - add to order
}}
/>
))}
</ProductGrid>
</Main>
<Summary total={orderTotal}>{/* TODO - show summary */}</Summary>
</Layout>
);
}
export default App;