= {
- "Main Story": "main_story",
- "Main + Sides": "main_plus_sides",
- Completionist: "completionist",
- "All Styles": "all_styles",
-};
+import { vars } from "@renderer/theme.css";
+import * as styles from "./game-details.css";
const durationTranslation: Record
= {
Hours: "hours",
@@ -17,49 +11,59 @@ const durationTranslation: Record = {
export interface HowLongToBeatSectionProps {
howLongToBeatData: HowLongToBeatCategory[] | null;
+ isLoading: boolean;
}
export function HowLongToBeatSection({
howLongToBeatData,
+ isLoading,
}: HowLongToBeatSectionProps) {
const { t } = useTranslation("game_details");
- if (!howLongToBeatData) return null;
-
const getDuration = (duration: string) => {
const [value, unit] = duration.split(" ");
return `${value} ${t(durationTranslation[unit])}`;
};
+ if (!howLongToBeatData && !isLoading) return null;
+
return (
- <>
+
HowLongToBeat
- {howLongToBeatData.map((category) => (
- -
-
- {titleTranslation[category.title]
- ? t(titleTranslation[category.title])
- : category.title}
-
-
- {getDuration(category.duration)}
-
-
- ))}
+ {howLongToBeatData
+ ? howLongToBeatData.map((category) => (
+ -
+
+ {category.title}
+
+
+
+ {getDuration(category.duration)}
+
+
+ {category.accuracy !== "00" && (
+
+ {t("accuracy", { accuracy: category.accuracy })}
+
+ )}
+
+ ))
+ : Array.from({ length: 4 }).map((_, index) => (
+
+ ))}
- >
+
);
}
diff --git a/src/renderer/pages/game-details/repacks-modal.tsx b/src/renderer/pages/game-details/repacks-modal.tsx
index fcefe674..421163d1 100644
--- a/src/renderer/pages/game-details/repacks-modal.tsx
+++ b/src/renderer/pages/game-details/repacks-modal.tsx
@@ -56,8 +56,8 @@ export function RepacksModal({
gameDetails.repacks.filter((repack) =>
repack.title
.toLowerCase()
- .includes(event.target.value.toLocaleLowerCase())
- )
+ .includes(event.target.value.toLocaleLowerCase()),
+ ),
);
};
diff --git a/src/types/index.ts b/src/types/index.ts
index 580994ca..2ab27f9a 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -106,5 +106,5 @@ export interface UserPreferences {
export interface HowLongToBeatCategory {
title: string;
duration: string;
- color: string;
+ accuracy: string;
}