From ef52a0978774c5f54d6fa5fb242e04b1aac3f35d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Nov 2024 13:11:03 +0100 Subject: [PATCH] Move progress to being game-specific --- _components/GameRow.tsx | 10 +-- _includes/game.tsx | 18 +++--- _includes/index.tsx | 4 +- _scripts/importSteam.ts | 4 +- _utils/game.ts | 133 ++++++++++++++++++++++++++++++++++------ _utils/progress.ts | 101 ------------------------------ 6 files changed, 133 insertions(+), 137 deletions(-) delete mode 100644 _utils/progress.ts diff --git a/_components/GameRow.tsx b/_components/GameRow.tsx index 23578c6..9303f1f 100644 --- a/_components/GameRow.tsx +++ b/_components/GameRow.tsx @@ -1,6 +1,6 @@ import {formatDateIso} from "../_utils/date.ts" import {GameData} from "../_utils/game.ts" -import {Progress, progressToClassName, progressToIconDef, progressToTitle} from "../_utils/progress.ts" +import {GameProgress, gameProgressToClassName, gameProgressToIconDef, gameProgressToTitle} from "../_utils/game.ts" import {ratingToClassName} from "../_utils/rating.ts" @@ -25,9 +25,9 @@ export function GameRow({game, columns = gameRowColumnKindDefault, priority}: Ga const ratingClass: string = ratingToClassName(game.rating) - const progressClass: string = progressToClassName(game.progress) - const progressIcon: string = progressToIconDef(game.progress) - const progressTitle: string = progressToTitle(game.progress) + const progressClass: string = gameProgressToClassName(game.progress) + const progressIcon: string = gameProgressToIconDef(game.progress) + const progressTitle: string = gameProgressToTitle(game.progress) const priorityClass: string = priority ? `priority-${priority}` : "" @@ -45,7 +45,7 @@ export function GameRow({game, columns = gameRowColumnKindDefault, priority}: Ga case "progress": { return ( - + {progressIcon && } diff --git a/_includes/game.tsx b/_includes/game.tsx index 62edb29..ca59a91 100644 --- a/_includes/game.tsx +++ b/_includes/game.tsx @@ -1,6 +1,6 @@ import {formatDateIso} from "../_utils/date.ts" import {GameData, GameIdentifier} from "../_utils/game.ts" -import {Progress, progressToClassName, progressToIconDef, progressToTitle} from "../_utils/progress.ts" +import {GameProgress, gameProgressToClassName, gameProgressToIconDef, gameProgressToTitle} from "../_utils/game.ts" import {ReviewInfo} from "../_components/ReviewInfo.tsx" @@ -20,12 +20,12 @@ export default function(data: GameData, helpers: Lume.Helpers) { const progressRow = data.progress ? ( } + icon={} > - {progressToTitle(data.progress)} + {gameProgressToTitle(data.progress)} {data.active && <> @@ -56,7 +56,7 @@ export default function(data: GameData, helpers: Lume.Helpers) { } + icon={} >