mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-29 21:49:50 +01:00
fix: object review videos
This commit is contained in:
1 parent
22faa6d294
commit
4ff8d77460
2 files changed
+30
-25
No files matched your search
@@ -5,6 +5,7 @@ import {
|
|||||||
Video,
|
Video,
|
||||||
youtubers,
|
youtubers,
|
||||||
} from "@blitzkit/core";
|
} from "@blitzkit/core";
|
||||||
|
import locales from "@blitzkit/i18n/locales.json";
|
||||||
import { google } from "googleapis";
|
import { google } from "googleapis";
|
||||||
import { cloneDeep, uniqBy } from "lodash-es";
|
import { cloneDeep, uniqBy } from "lodash-es";
|
||||||
import { AssetUploader } from "./core/github/assetUploader";
|
import { AssetUploader } from "./core/github/assetUploader";
|
||||||
@@ -42,9 +43,11 @@ for (const tank of tanksSanitized) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const q = `World of Tanks Blitz ${tank.name.locales[locales.default]}`;
|
||||||
|
|
||||||
const results = await youtube.search.list({
|
const results = await youtube.search.list({
|
||||||
part: ["snippet"],
|
part: ["snippet"],
|
||||||
q: `World of Tanks Blitz ${tank.name}`,
|
q,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!results.data.items || results.data.items.length === 0) continue;
|
if (!results.data.items || results.data.items.length === 0) continue;
|
||||||
@@ -54,9 +57,9 @@ for (const tank of tanksSanitized) {
|
|||||||
(item) =>
|
(item) =>
|
||||||
item.snippet?.channelId &&
|
item.snippet?.channelId &&
|
||||||
item.id?.videoId &&
|
item.id?.videoId &&
|
||||||
youtubers.some(({ id }) => id === item.snippet?.channelId)
|
youtubers.some(({ id }) => id === item.snippet?.channelId),
|
||||||
),
|
),
|
||||||
(item) => item.snippet!.channelId
|
(item) => item.snippet!.channelId,
|
||||||
);
|
);
|
||||||
|
|
||||||
reviews.reviews[tank.id] = {
|
reviews.reviews[tank.id] = {
|
||||||
@@ -66,11 +69,13 @@ for (const tank of tanksSanitized) {
|
|||||||
({
|
({
|
||||||
id: item.id!.videoId!,
|
id: item.id!.videoId!,
|
||||||
author: item.snippet!.channelId!,
|
author: item.snippet!.channelId!,
|
||||||
} satisfies Video)
|
}) satisfies Video,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(`${++done} done; found ${items.length} for ${tank.name.locales.en}`);
|
console.log(
|
||||||
|
`${++done} done; found ${items.length} for ${tank.name.locales.en}`,
|
||||||
|
);
|
||||||
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000 / 5));
|
await new Promise((resolve) => setTimeout(resolve, 1000 / 5));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { youtubers } from '@blitzkit/core';
|
import { youtubers } from "@blitzkit/core";
|
||||||
import { Box, Flex, Heading, Link, Skeleton, Text } from '@radix-ui/themes';
|
import { Box, Flex, Heading, Link, Skeleton, Text } from "@radix-ui/themes";
|
||||||
import { awaitableReviews } from '../../core/awaitables/reviews';
|
import { awaitableReviews } from "../../core/awaitables/reviews";
|
||||||
import { Var } from '../../core/radix/var';
|
import { Var } from "../../core/radix/var";
|
||||||
import { useLocale } from '../../hooks/useLocale';
|
import { useLocale } from "../../hooks/useLocale";
|
||||||
import { Duel } from '../../stores/duel';
|
import { Duel } from "../../stores/duel";
|
||||||
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
|
||||||
import { PageWrapper } from '../PageWrapper';
|
import { PageWrapper } from "../PageWrapper";
|
||||||
import { VerifiedIcon } from '../VerifiedIcon';
|
import { VerifiedIcon } from "../VerifiedIcon";
|
||||||
|
|
||||||
const reviews = await awaitableReviews;
|
const reviews = await awaitableReviews;
|
||||||
|
|
||||||
@@ -47,22 +47,22 @@ export function VideoSection({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
<Flex
|
<Flex
|
||||||
direction="column"
|
direction="column"
|
||||||
style={{
|
style={{
|
||||||
borderRadius: 'var(--radius-3)',
|
borderRadius: "var(--radius-3)",
|
||||||
overflow: 'hidden',
|
overflow: "hidden",
|
||||||
background: skeleton
|
background: skeleton
|
||||||
? Var('color-panel-solid')
|
? Var("color-panel-solid")
|
||||||
: `url(${image})`,
|
: `url(${image})`,
|
||||||
backgroundPosition: '0 18px',
|
backgroundPosition: "0 18px",
|
||||||
backgroundSize: 'cover',
|
backgroundSize: "cover",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
style={{
|
style={{
|
||||||
background: skeleton ? 'transparent' : `url(${image})`,
|
background: skeleton ? "transparent" : `url(${image})`,
|
||||||
backgroundSize: 'cover',
|
backgroundSize: "cover",
|
||||||
backgroundPosition: 'center',
|
backgroundPosition: "center",
|
||||||
height: 128,
|
height: 128,
|
||||||
aspectRatio: '16 / 9',
|
aspectRatio: "16 / 9",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Flex
|
<Flex
|
||||||
@@ -70,8 +70,8 @@ export function VideoSection({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
width="100%"
|
width="100%"
|
||||||
justify="center"
|
justify="center"
|
||||||
style={{
|
style={{
|
||||||
backdropFilter: 'blur(4rem)',
|
backdropFilter: "blur(4rem)",
|
||||||
WebkitBackdropFilter: 'blur(4rem)',
|
WebkitBackdropFilter: "blur(4rem)",
|
||||||
}}
|
}}
|
||||||
align="center"
|
align="center"
|
||||||
gap="1"
|
gap="1"
|
||||||
|
|||||||
Reference in new issue
Block a user