2026-03-23 22:13:29 -05:00
|
|
|
import { youtubers } from "@blitzkit/core";
|
|
|
|
|
import { Box, Flex, Heading, Link, Skeleton, Text } from "@radix-ui/themes";
|
|
|
|
|
import { awaitableReviews } from "../../core/awaitables/reviews";
|
|
|
|
|
import { Var } from "../../core/radix/var";
|
|
|
|
|
import { useLocale } from "../../hooks/useLocale";
|
|
|
|
|
import { Duel } from "../../stores/duel";
|
|
|
|
|
import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
|
|
|
|
|
import { PageWrapper } from "../PageWrapper";
|
|
|
|
|
import { VerifiedIcon } from "../VerifiedIcon";
|
2024-09-22 22:04:03 -05:00
|
|
|
|
2024-11-29 13:20:27 -06:00
|
|
|
const reviews = await awaitableReviews;
|
2024-06-12 13:08:52 -05:00
|
|
|
|
2024-11-09 18:38:04 -06:00
|
|
|
export function VideoSection({ skeleton }: MaybeSkeletonComponentProps) {
|
2024-07-10 13:11:09 -05:00
|
|
|
const tank = Duel.use((state) => state.protagonist.tank);
|
2024-10-05 20:55:44 -05:00
|
|
|
const videos = reviews.reviews[tank.id]?.videos;
|
2025-01-14 19:28:14 -06:00
|
|
|
const { strings } = useLocale();
|
2024-08-25 18:10:56 -05:00
|
|
|
|
2025-04-17 13:00:53 -05:00
|
|
|
if (videos === undefined || videos.length === 0) return null;
|
2024-06-12 13:08:52 -05:00
|
|
|
|
|
|
|
|
return (
|
2024-10-13 20:10:08 -05:00
|
|
|
<PageWrapper noFlex1 noMinHeight>
|
2024-08-16 21:17:50 -05:00
|
|
|
<Flex direction="column" gap="6" align="center">
|
2024-08-25 18:33:04 -05:00
|
|
|
<Flex direction="column" align="center">
|
2025-01-14 19:28:14 -06:00
|
|
|
<Heading size="6">
|
|
|
|
|
{strings.website.tools.tankopedia.review.title}
|
|
|
|
|
</Heading>
|
2024-06-12 13:08:52 -05:00
|
|
|
</Flex>
|
|
|
|
|
|
2024-08-25 21:12:21 -05:00
|
|
|
<Flex gap="3" wrap="wrap" justify="center">
|
2024-08-25 18:33:04 -05:00
|
|
|
{videos.map((video) => {
|
|
|
|
|
const image = `https://i.ytimg.com/vi/${video.id}/hqdefault.jpg`;
|
|
|
|
|
const youtuber = youtubers.find(
|
|
|
|
|
(youtuber) => youtuber.id === video.author,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!youtuber) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Link
|
|
|
|
|
color="gray"
|
|
|
|
|
highContrast
|
|
|
|
|
underline="hover"
|
|
|
|
|
key={video.id}
|
|
|
|
|
href={`https://www.youtube.com/watch?v=${video.id}`}
|
|
|
|
|
target="_blank"
|
|
|
|
|
>
|
|
|
|
|
<Flex
|
|
|
|
|
direction="column"
|
|
|
|
|
style={{
|
2026-03-23 22:13:29 -05:00
|
|
|
borderRadius: "var(--radius-3)",
|
|
|
|
|
overflow: "hidden",
|
2024-11-09 18:38:04 -06:00
|
|
|
background: skeleton
|
2026-03-23 22:13:29 -05:00
|
|
|
? Var("color-panel-solid")
|
2024-11-09 18:38:04 -06:00
|
|
|
: `url(${image})`,
|
2026-03-23 22:13:29 -05:00
|
|
|
backgroundPosition: "0 18px",
|
|
|
|
|
backgroundSize: "cover",
|
2024-08-25 18:33:04 -05:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
style={{
|
2026-03-23 22:13:29 -05:00
|
|
|
background: skeleton ? "transparent" : `url(${image})`,
|
|
|
|
|
backgroundSize: "cover",
|
|
|
|
|
backgroundPosition: "center",
|
2024-08-25 18:33:04 -05:00
|
|
|
height: 128,
|
2026-03-23 22:13:29 -05:00
|
|
|
aspectRatio: "16 / 9",
|
2024-08-25 18:33:04 -05:00
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Flex
|
|
|
|
|
p="2"
|
2024-08-25 18:52:30 -05:00
|
|
|
width="100%"
|
2024-08-25 18:33:04 -05:00
|
|
|
justify="center"
|
|
|
|
|
style={{
|
2026-03-23 22:13:29 -05:00
|
|
|
backdropFilter: "blur(4rem)",
|
|
|
|
|
WebkitBackdropFilter: "blur(4rem)",
|
2024-08-25 18:33:04 -05:00
|
|
|
}}
|
|
|
|
|
align="center"
|
|
|
|
|
gap="1"
|
|
|
|
|
>
|
2024-11-09 18:38:04 -06:00
|
|
|
<Text>
|
|
|
|
|
{!skeleton && youtuber.name}
|
|
|
|
|
{skeleton && <Skeleton height="1em" width="7rem" />}
|
|
|
|
|
</Text>
|
|
|
|
|
{!skeleton && <VerifiedIcon width="1em" height="1em" />}
|
2024-08-25 18:33:04 -05:00
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
</Link>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2024-06-12 13:08:52 -05:00
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
</PageWrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|