Skip to content

Commit

Permalink
removed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
katerynashylina committed Jul 31, 2023
1 parent 2f8aca3 commit a4c7c70
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/pages/PhoneDetailsPage/PhoneDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -78,24 +77,7 @@ export const PhoneDetails: React.FC<Props> = ({
return <Loader />;
}

// 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);

Expand Down

0 comments on commit a4c7c70

Please sign in to comment.