mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
fix: change blitzkit icons to big icons
This commit is contained in:
1 parent
b8c8528e1c
commit
d60551d30a
2 files changed
+18
-18
No files matched your search
@@ -1,11 +1,11 @@
|
|||||||
import { BLITZKIT_TANK_ICON_SIZE, fetchTankDefinitions } from '@blitzkit/core';
|
import { BLITZKIT_TANK_ICON_SIZE, fetchTankDefinitions } from "@blitzkit/core";
|
||||||
import { launch } from 'puppeteer';
|
import { launch } from "puppeteer";
|
||||||
import sharp from 'sharp';
|
import sharp from "sharp";
|
||||||
import { commitAssets } from '../core/github/commitAssets';
|
import { commitAssets } from "../core/github/commitAssets";
|
||||||
import { FileChange } from '../core/github/commitMultipleFiles';
|
import { FileChange } from "../core/github/commitMultipleFiles";
|
||||||
|
|
||||||
export async function blitzkitTankIcons() {
|
export async function blitzkitTankIcons() {
|
||||||
console.log('Building blitzkit tank icons...');
|
console.log("Building blitzkit tank icons...");
|
||||||
|
|
||||||
const browser = await launch();
|
const browser = await launch();
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
@@ -21,7 +21,7 @@ export async function blitzkitTankIcons() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await page.goto(`http://localhost:4321/api/tankopedia/tank-icon/${id}/`, {
|
await page.goto(`http://localhost:4321/api/tankopedia/tank-icon/${id}/`, {
|
||||||
waitUntil: 'networkidle0',
|
waitUntil: "networkidle0",
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`${id} ${name} time out`, error);
|
console.error(`${id} ${name} time out`, error);
|
||||||
@@ -29,21 +29,21 @@ export async function blitzkitTankIcons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const screenshot = await page.screenshot({
|
const screenshot = await page.screenshot({
|
||||||
type: 'webp',
|
type: "webp",
|
||||||
omitBackground: true,
|
omitBackground: true,
|
||||||
});
|
});
|
||||||
const content = await sharp(screenshot).trim({ threshold: 100 }).toBuffer();
|
const content = await sharp(screenshot).trim({ threshold: 100 }).toBuffer();
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
console.log(
|
console.log(
|
||||||
`Rendered ${id} (${name}) ${((index / tanks.length) * 100).toFixed(2)}%`,
|
`Rendered ${id} (${name}) ${((index / tanks.length) * 100).toFixed(2)}%`
|
||||||
);
|
);
|
||||||
|
|
||||||
files.push({ path: `icons/tanks/blitzkit/${id}.webp`, content });
|
files.push({ path: `icons/tanks/big/${id}.webp`, content });
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.close();
|
await page.close();
|
||||||
await browser.close();
|
await browser.close();
|
||||||
|
|
||||||
await commitAssets('tank icons', files);
|
await commitAssets("tank icons", files);
|
||||||
}
|
}
|
||||||
+7
-7
@@ -1,8 +1,8 @@
|
|||||||
import { asset } from '@blitzkit/core';
|
import { asset } from "@blitzkit/core";
|
||||||
import { Flex, type FlexProps, Progress } from '@radix-ui/themes';
|
import { Flex, type FlexProps, Progress } from "@radix-ui/themes";
|
||||||
import { useProgress } from '@react-three/drei';
|
import { useProgress } from "@react-three/drei";
|
||||||
|
|
||||||
type TankSandboxLoaderProps = Omit<FlexProps, 'id'> & {
|
type TankSandboxLoaderProps = Omit<FlexProps, "id"> & {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -12,13 +12,13 @@ export function TankSandboxLoader({ id, ...props }: TankSandboxLoaderProps) {
|
|||||||
return (
|
return (
|
||||||
<Flex width="100%" height="100%" align="center" justify="center" {...props}>
|
<Flex width="100%" height="100%" align="center" justify="center" {...props}>
|
||||||
<img
|
<img
|
||||||
src={asset(`icons/tanks/blitzkit/${id}.webp`)}
|
src={asset(`icons/tanks/big/${id}.webp`)}
|
||||||
style={{ height: '75%', filter: 'blur(1rem)' }}
|
style={{ height: "75%", filter: "blur(1rem)" }}
|
||||||
/>
|
/>
|
||||||
<Progress
|
<Progress
|
||||||
size="3"
|
size="3"
|
||||||
value={data.progress}
|
value={data.progress}
|
||||||
style={{ position: 'absolute', width: '16rem', maxWidth: '50vw' }}
|
style={{ position: "absolute", width: "16rem", maxWidth: "50vw" }}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user