Files
blitzkit/src/app/tools/tankopedia/[id]/components/VideoSection.tsx
T

104 lines
3.4 KiB
TypeScript
Raw Normal View History

2024-08-25 18:33:04 -05:00
import { PlusIcon } from '@radix-ui/react-icons';
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
2024-06-12 13:08:52 -05:00
import { use } from 'react';
2024-08-25 18:33:04 -05:00
import { Link } from '../../../../../components/Link';
2024-06-12 13:08:52 -05:00
import PageWrapper from '../../../../../components/PageWrapper';
2024-08-25 18:33:04 -05:00
import { VerifiedIcon } from '../../../../../components/VerifiedIcon';
import { youtubers } from '../../../../../constants/youtubers';
2024-08-25 18:10:56 -05:00
import { reviews } from '../../../../../core/blitzkit/reviews';
2024-08-25 18:33:04 -05:00
import { Var } from '../../../../../core/blitzkit/var';
2024-07-09 20:35:36 -05:00
import * as Duel from '../../../../../stores/duel';
2024-06-12 13:08:52 -05:00
export function VideoSection() {
2024-07-10 13:11:09 -05:00
const tank = Duel.use((state) => state.protagonist.tank);
2024-08-25 18:10:56 -05:00
const awaitedReviews = use(reviews);
const videos = awaitedReviews.reviews[tank.id]?.videos;
if (!videos) return null;
2024-06-12 13:08:52 -05:00
return (
<PageWrapper noFlex1>
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>
<Flex gap="3" wrap="wrap">
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',
background: `url(${image})`,
backgroundSize: 'cover',
}}
>
<Box
style={{
background: `url(${image})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
height: 128,
aspectRatio: '16 / 9',
}}
/>
<Flex
p="2"
justify="center"
style={{
backdropFilter: 'blur(4rem)',
WebkitBackdropFilter: 'blur(4rem)',
}}
align="center"
gap="1"
>
<Text>{youtuber.name}</Text>
<VerifiedIcon width="1em" height="1em" />
</Flex>
</Flex>
</Link>
);
})}
<Link href="discord.gg/nDt7AjGJQH" target="_blank" color="gray">
<Flex
align="center"
justify="center"
gap="2"
p="3"
direction="column"
height="100%"
style={{
backgroundColor: Var('color-panel-solid'),
borderRadius: Var('radius-3'),
width: '9rem',
}}
2024-06-12 13:08:52 -05:00
>
2024-08-25 18:33:04 -05:00
<PlusIcon />
<Text align="center">Apply to feature your video</Text>
</Flex>
</Link>
2024-06-12 13:08:52 -05:00
</Flex>
</Flex>
</PageWrapper>
);
}