From ee9ea9b6ae9a324fadcdd42e9e8a2af01f4d691a Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Nov 2024 13:46:02 +0100 Subject: [PATCH] Reformat file --- _includes/index.tsx | 134 ++++++++++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 55 deletions(-) diff --git a/_includes/index.tsx b/_includes/index.tsx index 0fa3bc5..92c5b96 100644 --- a/_includes/index.tsx +++ b/_includes/index.tsx @@ -1,24 +1,25 @@ -import {compareDate} from "../_utils/date.ts" +import { compareDate } from "../_utils/date.ts"; import { GameData } from "../_utils/game.ts"; -import {GameTable} from "../_components/GameTable.tsx" -import {compareGameProgress} from "../_utils/game.ts" -import {GlobalData} from "../_utils/site.ts" +import { GameTable } from "../_components/GameTable.tsx"; +import { compareGameProgress } from "../_utils/game.ts"; +import { GlobalData } from "../_utils/site.ts"; +export const layout = "base.tsx"; -export const layout = "base.tsx" +export default function (data: GlobalData, helpers: Lume.Helpers) { + const intro_section = data.content + ? ( +
+ {data.children} +
+ ) + : null; -export default function(data: GlobalData, helpers: Lume.Helpers) { - const intro_section = data.content ? ( -
- {data.children} -
- ) : null - - const games: GameData[] = data.search.pages("game") + const games: GameData[] = data.search.pages("game"); const active_games = games - .filter(game => game.active) - .sort(compareDate as any) + .filter((game) => game.active) + .sort(compareDate as any); const active_games_section = (
@@ -26,14 +27,18 @@ export default function(data: GlobalData, helpers: Lume.Helpers) { Now playing
- +
- ) + ); const top_games = games .sort((a, b) => ((b.rating ?? 0) - (a.rating ?? 0))) - .slice(0, 10) + .slice(0, 10); const top_games_section = (
@@ -41,14 +46,18 @@ export default function(data: GlobalData, helpers: Lume.Helpers) { Top games
- +
- ) + ); const played_games = games .sort((a, b) => ((b.hours_played ?? 0) - (a.hours_played ?? 0))) - .slice(0, 10) + .slice(0, 10); const played_games_section = (
@@ -56,14 +65,17 @@ export default function(data: GlobalData, helpers: Lume.Helpers) { Most played games
- +
- ) + ); const progress_games = games .sort((a, b) => -compareGameProgress(a, b)) - .slice(0, 10) + .slice(0, 10); const progress_games_section = (
@@ -71,14 +83,18 @@ export default function(data: GlobalData, helpers: Lume.Helpers) { Most progressed games
- +
- ) + ); const latest_games = games .sort((a, b) => -compareDate(a, b)) - .slice(0, 10) + .slice(0, 10); const latest_games_section = (
@@ -86,43 +102,51 @@ export default function(data: GlobalData, helpers: Lume.Helpers) { Latest updates
- +
- ) + ); const games_cols = ( - games.length > 0 - ) ? ( -
-

- Videogames - - - View all - - -

- {active_games.length > 0 && ( -
- {active_games_section} + games.length > 0 + ) + ? ( +
+

+ Videogames + + + {" "} + View all + + +

+ {active_games.length > 0 && ( +
+ {active_games_section} +
+ )} +
+ {top_games_section} + {progress_games_section}
- )} -
- {top_games_section} - {progress_games_section} -
-
- {played_games_section} - {latest_games_section} -
-
- ) : null +
+ {played_games_section} + {latest_games_section} +
+
+ ) + : null; return (
{intro_section} {games_cols}
- ) + ); }