mirror of
https://github.com/StepanovPlaton/torrent_frontend.git
synced 2026-04-04 04:40:50 +04:00
Init game page
This commit is contained in:
48
src/app/games/[game_id]/page.tsx
Normal file
48
src/app/games/[game_id]/page.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
import { GameService } from "@/entities/game";
|
||||
import { GameCard } from "@/features/gameCard";
|
||||
import { Section } from "@/widgets/section";
|
||||
import Image from "next/image";
|
||||
|
||||
export default async function Games({
|
||||
params: { game_id },
|
||||
}: {
|
||||
params: { game_id: number };
|
||||
}) {
|
||||
const gameCards = await GameService.getGameCards();
|
||||
const game = await GameService.getGame(game_id);
|
||||
return (
|
||||
<>
|
||||
{game && (
|
||||
<div className="p-4 flex flex-col lp:flex-row">
|
||||
{game.cover && (
|
||||
<Image
|
||||
src={game.cover}
|
||||
className="rounded-lg w-[60%] aspect-video object-cover"
|
||||
alt=""
|
||||
width={1280}
|
||||
height={720}
|
||||
/>
|
||||
)}
|
||||
<div className="pt-2 max-w-[40%]">
|
||||
<h1 className="text-4xl">{game.title}</h1>
|
||||
<p className="text-md text-justify text-fg4 pt-2">
|
||||
{game.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{gameCards && (
|
||||
<Section
|
||||
name="Другие популярные игры"
|
||||
link="/games"
|
||||
invite_text={'Перейти в раздел "Игры"'}
|
||||
>
|
||||
{gameCards.map((card) => (
|
||||
<GameCard key={card.id} card={card} />
|
||||
))}
|
||||
</Section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -9,10 +9,10 @@ export const metadata: Metadata = {
|
||||
".Torrent: Игры - каталог .torrent файлов для обмена видеоиграми",
|
||||
};
|
||||
|
||||
export default async function Home() {
|
||||
export default async function Games() {
|
||||
const gameCards = await GameService.getGameCards();
|
||||
return (
|
||||
<div className="w-full h-full max-w-[var(--app-width)] m-auto overflow-y-auto">
|
||||
<>
|
||||
{gameCards && (
|
||||
<Section>
|
||||
{gameCards.map((card) => (
|
||||
@@ -20,6 +20,6 @@ export default async function Home() {
|
||||
))}
|
||||
</Section>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@ export default function RootLayout({
|
||||
<body className={inter.className}>
|
||||
<ThemeProvider enableSystem={false} defaultTheme="light">
|
||||
<Header />
|
||||
{children}
|
||||
<div className="w-full h-full max-w-[var(--app-width)] m-auto overflow-y-auto">
|
||||
{children}
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Section } from "@/widgets/section";
|
||||
export default async function Home() {
|
||||
const gameCards = await GameService.getGameCards();
|
||||
return (
|
||||
<div className="w-full h-full max-w-[var(--app-width)] m-auto overflow-y-auto">
|
||||
<>
|
||||
{gameCards && (
|
||||
<Section
|
||||
name="Игры"
|
||||
@@ -17,6 +17,6 @@ export default async function Home() {
|
||||
))}
|
||||
</Section>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user