Fix Tim Mathias Wall coding
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { createContext, useContext, useState } from 'react';
|
||||
import Item from '../components/Item';
|
||||
|
||||
interface BasketItem {
|
||||
export interface BasketItem {
|
||||
item: Item;
|
||||
quantity: number;
|
||||
}
|
||||
|
||||
@@ -14,11 +14,12 @@ import {
|
||||
TextField,
|
||||
Typography
|
||||
} from '@mui/material';
|
||||
import { TFunction } from 'i18next';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useBasket } from '../helper/BasketProvider';
|
||||
import Item from '../components/Item';
|
||||
import { BasketItem, useBasket } from '../helper/BasketProvider';
|
||||
|
||||
type ShippingDetails = {
|
||||
firstName: string;
|
||||
@@ -34,7 +35,7 @@ function getDiscountedPrice(item: Item): number {
|
||||
return (item.price100 / 100 * (100-item.discount100)/100);
|
||||
}
|
||||
|
||||
function generateBasket(t: any, basket: any[]) {
|
||||
function generateBasket(t: TFunction<"translation", undefined>, basket: BasketItem[]) {
|
||||
return basket.length === 0 ? (
|
||||
<Typography color="error" sx={{ my: 2 }}>
|
||||
{t('basketEmpty')}
|
||||
@@ -58,7 +59,7 @@ function generateBasket(t: any, basket: any[]) {
|
||||
)
|
||||
}
|
||||
|
||||
function generateTotal(t: any, basket: any[]) {
|
||||
function generateTotal(t: TFunction<"translation", undefined>, basket: BasketItem[]) {
|
||||
return basket.length === 0 ? "" :
|
||||
<div className='rightBound'>
|
||||
{t('total') + ": " + basket.map((item) => item.quantity * getDiscountedPrice(item.item))
|
||||
|
||||
Reference in New Issue
Block a user