From ab6eca4661ec9993c65432da934a689d171a46a8 Mon Sep 17 00:00:00 2001 From: StepanovPlaton Date: Sun, 12 May 2024 20:06:41 +0400 Subject: [PATCH] Complete game page and add how_to_download page --- .env.development | 1 + src/app/games/[game_id]/page.tsx | 154 +++++++++++++++++++------- src/app/games/page.tsx | 30 ++--- src/app/globals.css | 21 +++- src/app/how_to_download/page.tsx | 61 ++++++++++ src/app/layout.tsx | 36 +++--- src/app/page.tsx | 32 +++--- src/entities/game/schemas/game.ts | 56 ++++++---- src/entities/game/schemas/gameCard.ts | 53 +++++---- src/features/gameCard/gameCard.tsx | 52 ++++----- src/shared/ui/cover/cover.tsx | 19 ---- src/shared/ui/cover/index.ts | 3 - src/widgets/header/header.tsx | 98 ++++++++-------- tailwind.config.ts | 61 +++++----- 14 files changed, 410 insertions(+), 267 deletions(-) create mode 100644 src/app/how_to_download/page.tsx delete mode 100644 src/shared/ui/cover/cover.tsx delete mode 100644 src/shared/ui/cover/index.ts diff --git a/.env.development b/.env.development index 16f42a6..5b3b7ea 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,4 @@ NEXT_PUBLIC_BASE_URL=http://127.0.0.1:3000/api +NEXT_PUBLIC_CONTENT_URL=http://127.0.0.1:8000/content/torrent NEXT_PUBLIC_COVER_FULL_URL=http://127.0.0.1:8000/content/images/cover/full_size NEXT_PUBLIC_COVER_PREVIEW_URL=http://127.0.0.1:8000/content/images/cover/preview \ No newline at end of file diff --git a/src/app/games/[game_id]/page.tsx b/src/app/games/[game_id]/page.tsx index e8bba56..b94c7dd 100644 --- a/src/app/games/[game_id]/page.tsx +++ b/src/app/games/[game_id]/page.tsx @@ -1,48 +1,126 @@ import { GameService } from "@/entities/game"; import { GameCard } from "@/features/gameCard"; import { Section } from "@/widgets/section"; +import clsx from "clsx"; import Image from "next/image"; +import Link from "next/link"; export default async function Games({ - params: { game_id }, + params: { game_id }, }: { - params: { game_id: number }; + params: { game_id: number }; }) { - const gameCards = await GameService.getGameCards(); - const game = await GameService.getGame(game_id); - return ( - <> - {game && ( -
- {game.cover && ( - - )} -
-

{game.title}

-

- {game.description} -

-
-
- )} + const gameCards = await GameService.getGameCards(); + const game = await GameService.getGame(game_id); + return ( + <> + {game && ( +
+ {game.cover && ( +
+ +
+ )} + +

{game.title}

+ {game.description && ( +

+ {game.description} +

+ )} +
+
+ {[ + [ + { name: "Система", value: game.system }, + { name: "Процессор", value: game.processor }, + { name: "Оперативная память", value: game.memory }, + { name: "Видеокарта", value: game.graphics }, + { name: "Место на диске", value: game.storage }, + ], + [ + { + name: "Версия игры", + value: `${ + game.version + } (обновлена ${game.update_date.toLocaleDateString( + "ru-ru" + )})`, + }, + { name: "Язык", value: game.language }, + { name: "Разработчик", value: game.developer }, + { + name: "Год выхода", + value: game.release_date.toLocaleDateString("en-us", { + year: "numeric", + }), + }, + { name: "Объём загрузки", value: game.download_size }, + ], + ].map((section, i) => ( +
    + {section.map((req) => ( +
  • + {req.name + ": "} + + {req.value ?? "Не известно"} + +
  • + ))} +
+ ))} +
+ {game.trailer && ( +