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 { AnimeTable } from "../_components/AnimeTable.tsx"; import { AnimeData } from "../_utils/anime.ts"; export const layout = "base.tsx"; export default function (data: GlobalData, helpers: Lume.Helpers) { const intro_section = data.content ? (
{data.children}
) : null; const games: GameData[] = data.search.pages("game"); const active_games = games .filter((game) => game.active) .sort(compareDate as any); const active_games_section = (

Now playing

); const top_games = games .sort((a, b) => ((b.rating ?? 0) - (a.rating ?? 0))) .slice(0, 10); const top_games_section = (

Top games

); const played_games = games .sort((a, b) => ((b.hours_played ?? 0) - (a.hours_played ?? 0))) .slice(0, 10); const played_games_section = (

Most played games

); const progress_games = games .sort((a, b) => -compareGameProgress(a, b)) .slice(0, 10); const progress_games_section = (

Most progressed games

); const latest_games = games .sort((a, b) => -compareDate(a, b)) .slice(0, 10); const latest_games_section = (

Latest updates

); const games_cols = ( games.length > 0 ) ? (

Videogames {" "} View all

{active_games.length > 0 && (
{active_games_section}
)}
{top_games_section} {progress_games_section}
{played_games_section} {latest_games_section}
) : null; const anime: AnimeData[] = data.search.pages("anime"); const active_anime = anime .filter((ani) => ani.active) .sort(compareDate as any); const active_anime_section = (

Now playing

); const top_anime = anime .sort((a, b) => ((b.rating ?? 0) - (a.rating ?? 0))) .slice(0, 10); const top_anime_section = (

Top anime

); const latest_anime = anime .sort((a, b) => -compareDate(a, b)) .slice(0, 10); const latest_anime_section = (

Latest updates

); const anime_cols = ( anime.length > 0 ) ? (

Anime {" "} View all

{active_anime.length > 0 && (
{active_anime_section}
)}
{top_anime_section} {latest_anime_section}
) : null; return (
{intro_section} {games_cols} {anime_cols}
); }