From a4c7c7098148ae6ddce359ad1c4ea58f2a54f39e Mon Sep 17 00:00:00 2001 From: Kateryna Shylina Date: Mon, 31 Jul 2023 11:05:57 +0300 Subject: [PATCH] removed comments --- src/pages/PhoneDetailsPage/PhoneDetails.tsx | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/pages/PhoneDetailsPage/PhoneDetails.tsx b/src/pages/PhoneDetailsPage/PhoneDetails.tsx index 0a3d87a934..30fa64a887 100644 --- a/src/pages/PhoneDetailsPage/PhoneDetails.tsx +++ b/src/pages/PhoneDetailsPage/PhoneDetails.tsx @@ -15,7 +15,6 @@ import { BackButton } from '../../components/BackButton/BackButton'; import { FavouritesButton } from '../../components/FavouritesButton/FavouritesButton'; import { CartButton } from '../../components/CartButton/CartButton'; -// import { useMemo } from 'react'; const findProductById = (itemId = '', products: Phone[]) => { return products.find((product) => product.itemId === itemId); @@ -78,24 +77,7 @@ export const PhoneDetails: React.FC = ({ return ; } - // const shuffleArray = (array: Phone[]) => { - // const shuffledArray = [...array]; - - // // eslint-disable-next-line no-plusplus - // for (let i = shuffledArray.length - 1; i > 0; i--) { - // const randomIndex = Math.floor(Math.random() * (i + 1)); - - // [shuffledArray[i], shuffledArray[randomIndex]] = [ - // shuffledArray[randomIndex], shuffledArray[i], - // ]; - // } - - // return shuffledArray; - // }; - - // const mixedPhones = useMemo(() => shuffleArray([...phones]), [phones]); - - const mixedPhones = phones.sort((a: Phone, b:Phone) => b.year - a.year) + const mixedPhones = phones.sort((a: Phone, b:Phone) => b.year - a.year); const foundPhone = phones.find((phone) => phone.phoneId === product?.id);