From f610396bd6fa6200e3581c508bd5877262235f50 Mon Sep 17 00:00:00 2001 From: carmennt Date: Tue, 17 Nov 2026 21:52:36 +0100 Subject: [PATCH 1/7] feat: 00.0 -> "Free" on PassiveGameCard --- Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx | 4 ++-- Frontend/src/types/Game.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx b/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx index 7e65127..a2adb6d 100644 --- a/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx +++ b/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx @@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography' import CardActionArea from '@mui/material/CardActionArea' import { Link } from 'react-router-dom' import { useLayoutEffect, useRef, useState } from 'react' -import type { PassiveGameData } from '../../types/Game' +import { type PassiveGameData, FormatPrice } from '../../types/Game' type Props = { game: PassiveGameData @@ -73,7 +73,7 @@ export default function PassiveGameCard({ game, rank }: Props) { {isOnSale ? `-${game.salePercent}%` : ''} - {game.price.toFixed(2)} $ + {FormatPrice(game.price)} diff --git a/Frontend/src/types/Game.ts b/Frontend/src/types/Game.ts index 8a26eca..7cd468e 100644 --- a/Frontend/src/types/Game.ts +++ b/Frontend/src/types/Game.ts @@ -31,3 +31,7 @@ export type PageGame = { } export type PassiveGameData = Pick + +export const FormatPrice = (price: number): string => { + return price === 0 ? "Free" : `$${price.toFixed(2)}`; +}; From 4d2c34aa4529c6e3430f5b65f6272bd883914dcb Mon Sep 17 00:00:00 2001 From: carmennt Date: Tue, 17 Nov 2026 21:52:36 +0100 Subject: [PATCH 2/7] feat: 00.0 -> "Free" on PassiveGameCard --- Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx | 4 ++-- Frontend/src/types/Game.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx b/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx index be5e738..0e48e2d 100644 --- a/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx +++ b/Frontend/src/components/PassiveGameCard/PassiveGameCard.tsx @@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography' import CardActionArea from '@mui/material/CardActionArea' import { Link } from 'react-router-dom' import { useLayoutEffect, useRef, useState } from 'react' -import type { PassiveGameData } from '../../types/Game' +import { type PassiveGameData, FormatPrice } from '../../types/Game' type Props = { game: PassiveGameData @@ -73,7 +73,7 @@ export default function PassiveGameCard({ game, rank }: Props) { {isOnSale ? `-${game.salePercent}%` : ''} - {game.price.toFixed(2)} $ + {FormatPrice(game.price)} diff --git a/Frontend/src/types/Game.ts b/Frontend/src/types/Game.ts index 8a26eca..7cd468e 100644 --- a/Frontend/src/types/Game.ts +++ b/Frontend/src/types/Game.ts @@ -31,3 +31,7 @@ export type PageGame = { } export type PassiveGameData = Pick + +export const FormatPrice = (price: number): string => { + return price === 0 ? "Free" : `$${price.toFixed(2)}`; +}; From 2e63afaba9498afe69ffd32d066d6d4c9759ed26 Mon Sep 17 00:00:00 2001 From: carmennt Date: Tue, 17 Nov 2026 22:26:39 +0100 Subject: [PATCH 3/7] feat: 0.00 -> Free ActiveGameCard --- .../src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx index a87b53d..8e9c5aa 100644 --- a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx +++ b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx @@ -1,6 +1,6 @@ import { Box, Card, CardContent, Chip, Divider, Typography } from '@mui/material' import './ActiveGameCardInfo.css' -import type { GameData } from '../../types/Game' +import { type GameData, FormatPrice } from '../../types/Game' type ActiveGameInfoProps = { game: GameData @@ -31,7 +31,7 @@ export default function ActiveGameCardInfo({ game }: ActiveGameInfoProps) { className={`activeGamePrice${showOriginalPrice ? ' activeGameSalePrice' : ''}`} component="p" > - {game.price.toFixed(2)} $ + {FormatPrice(game.price)} $ {showOriginalPrice && ( From bb2ae7528c7151756d4513f4cf3e7fb2e6d38639 Mon Sep 17 00:00:00 2001 From: carmennt Date: Tue, 17 Nov 2026 22:28:23 +0100 Subject: [PATCH 4/7] fix: Remove $ from ActiveCard price --- .../src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx index 8e9c5aa..648d92d 100644 --- a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx +++ b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx @@ -31,7 +31,7 @@ export default function ActiveGameCardInfo({ game }: ActiveGameInfoProps) { className={`activeGamePrice${showOriginalPrice ? ' activeGameSalePrice' : ''}`} component="p" > - {FormatPrice(game.price)} $ + {FormatPrice(game.price)} {showOriginalPrice && ( From 525ced5e317d758545a43bd8de6a49ec99aff288 Mon Sep 17 00:00:00 2001 From: carmennt Date: Thu, 19 Nov 2026 16:00:42 +0100 Subject: [PATCH 5/7] fix: format price on wishlistCard --- Frontend/src/components/WishlistGameCard/WishlistGameCard.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Frontend/src/components/WishlistGameCard/WishlistGameCard.tsx b/Frontend/src/components/WishlistGameCard/WishlistGameCard.tsx index a0ed4e7..0f3db8f 100644 --- a/Frontend/src/components/WishlistGameCard/WishlistGameCard.tsx +++ b/Frontend/src/components/WishlistGameCard/WishlistGameCard.tsx @@ -5,6 +5,7 @@ import { RemoveFromWishlistFrontend } from '../../FrontendLogic/WishlistLogicFro import { GetSavedUser } from '../../FrontendLogic/UserLogicFrontend' import { useState } from 'react' import { Link } from 'react-router-dom' +import { FormatPrice } from '../../types/Game' type wishlistGamecardProps = { game: PassiveGameData @@ -66,7 +67,7 @@ export default function WishlistGameCard({ size="small" /> )} -

{game.price.toFixed(2)} $

+

{FormatPrice(game.price)}

{error && ( From 4f526aa034ec8465766e0f96e00c6cd728f87eb0 Mon Sep 17 00:00:00 2001 From: carmennt Date: Thu, 19 Nov 2026 16:06:13 +0100 Subject: [PATCH 6/7] fix: move $ --- Frontend/src/tests/ActiveGameCard.test.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Frontend/src/tests/ActiveGameCard.test.tsx b/Frontend/src/tests/ActiveGameCard.test.tsx index 20e5460..3568c1a 100644 --- a/Frontend/src/tests/ActiveGameCard.test.tsx +++ b/Frontend/src/tests/ActiveGameCard.test.tsx @@ -81,10 +81,10 @@ describe('ActiveGameCard', () => { }) await screen.findByText('-50%') - expect(screen.getByText('9.99 $').className).toContain('activeGameSalePrice') + expect(screen.getByText('$9.99').className).toContain('activeGameSalePrice') const originalPrice = container.querySelector('s.activeGameOriginalPrice')! - expect(originalPrice.textContent).toBe('Original price: 19.98 $') + expect(originalPrice.textContent).toBe('Original price: $19.98') }) it('only shows the price when the game is not on sale', async () => { @@ -94,8 +94,8 @@ describe('ActiveGameCard', () => { originalPrice: 9.99 }) - await screen.findByText('9.99 $') - expect(screen.getByText('9.99 $').className).not.toContain('activeGameSalePrice') + await screen.findByText('$9.99') + expect(screen.getByText('$9.99').className).not.toContain('activeGameSalePrice') expect(container.querySelector('.activeGameOriginalPrice')).toBeNull() expect(screen.queryByText('-0%')).toBeNull() }) From 831e99a594081f92284a6fa0e5937a2378193898 Mon Sep 17 00:00:00 2001 From: carmennt Date: Thu, 19 Nov 2026 16:11:13 +0100 Subject: [PATCH 7/7] fix: format orginal price --- .../src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx index 648d92d..9f17d0f 100644 --- a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx +++ b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx @@ -36,7 +36,7 @@ export default function ActiveGameCardInfo({ game }: ActiveGameInfoProps) { {showOriginalPrice && ( Original price: - {game.originalPrice!.toFixed(2)} $ + {FormatPrice(game.originalPrice!)} )}