From f89b19c1740ec78e4cf6299258e5e04b085bfa10 Mon Sep 17 00:00:00 2001 From: Svetoslav Dimitrov Date: Wed, 13 Nov 2024 11:08:49 +0200 Subject: [PATCH] fix build errors --- .../src/components/CardHolder.tsx | 2 -- .../src/components/CardNumber.tsx | 2 -- .../src/components/ExpiryDate.tsx | 2 -- .../src/components/FilterComponent.tsx | 2 +- .../src/components/Header.tsx | 5 +-- .../src/components/ShoppingCartList.tsx | 32 +++++++------------ .../src/data/types.ts | 11 ++++--- .../src/pages/PaymentDetails.tsx | 3 +- .../src/pages/ProductsDetails.tsx | 12 ++++--- .../ecommerce-jewellery-store/tsconfig.json | 2 +- 10 files changed, 28 insertions(+), 45 deletions(-) diff --git a/examples/ecommerce-jewellery-store/src/components/CardHolder.tsx b/examples/ecommerce-jewellery-store/src/components/CardHolder.tsx index fe6acd6e..2d3772c8 100644 --- a/examples/ecommerce-jewellery-store/src/components/CardHolder.tsx +++ b/examples/ecommerce-jewellery-store/src/components/CardHolder.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import { TextBox } from '@progress/kendo-react-inputs'; const CardNumber = () => { diff --git a/examples/ecommerce-jewellery-store/src/components/CardNumber.tsx b/examples/ecommerce-jewellery-store/src/components/CardNumber.tsx index e6fd266b..eef0c2d2 100644 --- a/examples/ecommerce-jewellery-store/src/components/CardNumber.tsx +++ b/examples/ecommerce-jewellery-store/src/components/CardNumber.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import { MaskedTextBox } from '@progress/kendo-react-inputs'; const CardNumber = () => { diff --git a/examples/ecommerce-jewellery-store/src/components/ExpiryDate.tsx b/examples/ecommerce-jewellery-store/src/components/ExpiryDate.tsx index 9f81ddc7..442dcc43 100644 --- a/examples/ecommerce-jewellery-store/src/components/ExpiryDate.tsx +++ b/examples/ecommerce-jewellery-store/src/components/ExpiryDate.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - import { DateInput } from "@progress/kendo-react-dateinputs"; const ExpiryDate = () => { diff --git a/examples/ecommerce-jewellery-store/src/components/FilterComponent.tsx b/examples/ecommerce-jewellery-store/src/components/FilterComponent.tsx index 632f1258..9be40605 100644 --- a/examples/ecommerce-jewellery-store/src/components/FilterComponent.tsx +++ b/examples/ecommerce-jewellery-store/src/components/FilterComponent.tsx @@ -26,7 +26,7 @@ const statuses: string[] = ["Sale", "Recommended", "Must Have"]; const materials: string[] = ["Gold", "Silver"]; const DropDownSettings: DropDownsPopupSettings = { - minWidth: "119px", + width: "119px", }; export const FilterComponent = (props: any) => { diff --git a/examples/ecommerce-jewellery-store/src/components/Header.tsx b/examples/ecommerce-jewellery-store/src/components/Header.tsx index 4f0e31ff..6b9b366a 100644 --- a/examples/ecommerce-jewellery-store/src/components/Header.tsx +++ b/examples/ecommerce-jewellery-store/src/components/Header.tsx @@ -1,8 +1,7 @@ import React from "react"; -import { Menu, AppBarSpacer, MenuItem } from "@progress/kendo-react-layout"; +import { Menu, AppBarSpacer } from "@progress/kendo-react-layout"; import { Button } from "@progress/kendo-react-buttons"; import { SvgIcon } from "@progress/kendo-react-common"; -import { useNavigate } from "react-router-dom"; import { InputPrefix, @@ -24,8 +23,6 @@ import languageItems from "@/data/language-items"; import { AppBar, AppBarSection } from "@progress/kendo-react-layout"; const Header: React.FC = () => { - const navigate = useNavigate(); - return ( <> diff --git a/examples/ecommerce-jewellery-store/src/components/ShoppingCartList.tsx b/examples/ecommerce-jewellery-store/src/components/ShoppingCartList.tsx index d5848ae2..80d970a7 100644 --- a/examples/ecommerce-jewellery-store/src/components/ShoppingCartList.tsx +++ b/examples/ecommerce-jewellery-store/src/components/ShoppingCartList.tsx @@ -11,14 +11,15 @@ import { Field, FormElement, FieldRenderProps, - FormRenderProps, FieldWrapper, } from "@progress/kendo-react-form"; import { Error } from "@progress/kendo-react-labels"; import { Input } from "@progress/kendo-react-inputs"; import { Button } from "@progress/kendo-react-buttons"; import { useCart } from "../helpers/CartContext"; -import { NumericTextBox } from "@progress/kendo-react-inputs"; +import { + NumericTextBox +} from "@progress/kendo-react-inputs"; import { useNavigate } from "react-router-dom"; import { Layout } from "./Layout"; import shoppingCartImage from "../assets/shoppingCartImg.png"; @@ -48,18 +49,13 @@ export const ShoppingCartList: React.FC = () => { }; const updateQuantity = (event) => { + console.log(typeof event); const target = event.target.element; const id = target.getAttribute("id"); updateIndividualCartItem(id); }; - const onResetClick = (event) => { - const target = event.target.element; - const id = target.getAttribute("id"); - - updateIndividualCartItem(id); - }; return ( <> @@ -89,8 +85,8 @@ export const ShoppingCartList: React.FC = () => { > {isCartItem { ) : ( Quantity not available )} - + - {isCartItem - ? `$${( - item.quantity * item.product.newPrice - ).toLocaleString()}` - : `$${item.product.newPrice.toLocaleString()}`} + {`$${( + item.quantity * item.product.newPrice + ).toLocaleString()}`} @@ -135,7 +125,7 @@ export const ShoppingCartList: React.FC = () => {
( + render={() => (
Order Details diff --git a/examples/ecommerce-jewellery-store/src/data/types.ts b/examples/ecommerce-jewellery-store/src/data/types.ts index a51a2fc7..6de34d0b 100644 --- a/examples/ecommerce-jewellery-store/src/data/types.ts +++ b/examples/ecommerce-jewellery-store/src/data/types.ts @@ -4,16 +4,17 @@ export type CardDescriptor = { }; export type DataModel = { - text: string; + text: string | undefined; } export type ListDataDescriptor = { id?: number; - img: string | null; + img: string | undefined; status: string | null; title: string; - category: "Bracelets" | "Earrings" | "Rings" | "Watches" | "Necklaces"; - material: "Silver" | "Gold"; + rating?: number; + category: string; + material: string; oldPrice: number | null; newPrice: number; }; @@ -21,7 +22,7 @@ export type ListDataDescriptor = { export type BackgroundImageProps = { title: string; subtitle: string; - buttonText: string; + buttonText?: string; img: string; }; diff --git a/examples/ecommerce-jewellery-store/src/pages/PaymentDetails.tsx b/examples/ecommerce-jewellery-store/src/pages/PaymentDetails.tsx index 3ed78db5..79eeeb55 100644 --- a/examples/ecommerce-jewellery-store/src/pages/PaymentDetails.tsx +++ b/examples/ecommerce-jewellery-store/src/pages/PaymentDetails.tsx @@ -11,7 +11,6 @@ import { Form, Field, FormElement, - FormRenderProps, FieldWrapper, } from "@progress/kendo-react-form"; import { @@ -50,7 +49,7 @@ const PaymentDetails: React.FC = () => {
( + render={() => (
diff --git a/examples/ecommerce-jewellery-store/src/pages/ProductsDetails.tsx b/examples/ecommerce-jewellery-store/src/pages/ProductsDetails.tsx index df50f380..dda3ea55 100644 --- a/examples/ecommerce-jewellery-store/src/pages/ProductsDetails.tsx +++ b/examples/ecommerce-jewellery-store/src/pages/ProductsDetails.tsx @@ -12,10 +12,10 @@ import { CustomSection } from "../components/CustomizedSection"; import { useCart } from "../helpers/CartContext"; import { useNavigate } from "react-router-dom"; - export const ProductDetails = () => { const { id } = useParams(); - const productId = parseInt(id, 10); + const productId = id ? parseInt(id, 10) : null; + const descriptionText = "Elegant wedding bands featuring lustrous pearls, beautifully set in sleek, timeless bands. These rings offer a unique blend of classic charm and modern sophistication, making them a perfect symbol of everlasting love. The delicate pearls add a touch of grace, creating a refined and distinctive look that’s perfect for a memorable occasion."; const { addItemToCart } = useCart(); @@ -23,9 +23,11 @@ export const ProductDetails = () => { const navigate = useNavigate(); const addToCart = () => { - addItemToCart(productToAdd); - navigate("/shoppingcart") - } + if (productToAdd) { + addItemToCart(productToAdd); + } + navigate("/shoppingcart"); + }; const data: CardDescriptor[] = [ { diff --git a/examples/ecommerce-jewellery-store/tsconfig.json b/examples/ecommerce-jewellery-store/tsconfig.json index 1ffef600..c452f432 100644 --- a/examples/ecommerce-jewellery-store/tsconfig.json +++ b/examples/ecommerce-jewellery-store/tsconfig.json @@ -4,4 +4,4 @@ { "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" } ] -} +} \ No newline at end of file