Files
blitzkit/packages/website/src/components/Tankopedia/VideoSection.tsx
T

121 lines
3.9 KiB
TypeScript
Raw Normal View History

2024-11-29 13:20:27 -06:00
import { youtubers } from '@blitzkit/core';
2024-11-09 18:38:04 -06:00
import { Box, Flex, Heading, Link, Skeleton, Text } from '@radix-ui/themes';
2024-11-29 13:20:27 -06:00
import { awaitableReviews } from '../../core/awaitables/reviews';
2024-09-22 22:04:03 -05:00
import { Var } from '../../core/radix/var';
import { Duel } from '../../stores/duel';
2024-11-09 18:38:04 -06:00
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
2024-09-22 22:04:03 -05:00
import { PageWrapper } from '../PageWrapper';
import { VerifiedIcon } from '../VerifiedIcon';
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;
2024-08-25 18:10:56 -05:00
if (!videos) 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">
2024-06-12 13:08:52 -05:00
<Heading size="6">Review videos</Heading>
2024-08-16 21:17:50 -05:00
2024-08-25 18:33:04 -05:00
<Text color="gray">BlitzKit does not endorse any review videos.</Text>
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={{
borderRadius: 'var(--radius-3)',
overflow: 'hidden',
2024-11-09 18:38:04 -06:00
background: skeleton
? Var('color-panel-solid')
: `url(${image})`,
backgroundPosition: '0 18px',
2024-08-25 18:33:04 -05:00
backgroundSize: 'cover',
}}
>
<Box
style={{
2024-11-09 18:38:04 -06:00
background: skeleton ? 'transparent' : `url(${image})`,
2024-08-25 18:33:04 -05:00
backgroundSize: 'cover',
backgroundPosition: 'center',
height: 128,
aspectRatio: '16 / 9',
}}
/>
<Flex
p="2"
width="100%"
2024-08-25 18:33:04 -05:00
justify="center"
style={{
backdropFilter: 'blur(4rem)',
WebkitBackdropFilter: 'blur(4rem)',
}}
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-08-25 18:52:58 -05:00
<Link
href="https://discord.gg/nDt7AjGJQH"
target="_blank"
color="gray"
2024-08-26 21:20:45 -05:00
highContrast
2024-08-25 18:52:58 -05:00
>
2024-08-25 18:33:04 -05:00
<Flex
align="center"
justify="center"
gap="2"
p="3"
direction="column"
height="100%"
style={{
backgroundColor: Var('color-panel-solid'),
borderRadius: Var('radius-3'),
}}
2024-06-12 13:08:52 -05:00
>
2024-08-26 21:34:57 -05:00
<VerifiedIcon />
2024-08-26 21:20:45 -05:00
<Text
align="center"
style={{
width: '9rem',
}}
>
Apply to BlitzKit YouTuber program
</Text>
2024-08-25 18:33:04 -05:00
</Flex>
</Link>
2024-06-12 13:08:52 -05:00
</Flex>
</Flex>
</PageWrapper>
);
}