mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-21 12:53:56 +01:00
optimize html, css, svg's, and webp delivery
This commit is contained in:
75 files changed
+452
-331
No files matched your search
@@ -1,6 +1,4 @@
|
|||||||
import react from "@astrojs/react";
|
import react from "@astrojs/react";
|
||||||
import strings from "@blitzkit/i18n/strings/en.json";
|
|
||||||
import favicons from "astro-favicons";
|
|
||||||
import { defineConfig } from "astro/config";
|
import { defineConfig } from "astro/config";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@@ -9,6 +7,16 @@ export default defineConfig({
|
|||||||
vite: {
|
vite: {
|
||||||
server: { allowedHosts: [] },
|
server: { allowedHosts: [] },
|
||||||
esbuild: { target: "es2022" },
|
esbuild: { target: "es2022" },
|
||||||
|
build: { cssCodeSplit: false },
|
||||||
|
css: {
|
||||||
|
modules: {
|
||||||
|
// Short hashed class names in production to shrink HTML; the leading _ keeps names that start with a digit valid
|
||||||
|
generateScopedName:
|
||||||
|
process.env.NODE_ENV === "production"
|
||||||
|
? "_[hash:base64:6]"
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
output: "static",
|
output: "static",
|
||||||
@@ -18,21 +26,5 @@ export default defineConfig({
|
|||||||
|
|
||||||
build: { concurrency: 8, inlineStylesheets: "never" },
|
build: { concurrency: 8, inlineStylesheets: "never" },
|
||||||
|
|
||||||
integrations: [
|
integrations: [react()],
|
||||||
favicons({
|
|
||||||
name: strings.common.name,
|
|
||||||
short_name: strings.common.name,
|
|
||||||
|
|
||||||
icons: {
|
|
||||||
windows: true,
|
|
||||||
android: true,
|
|
||||||
appleIcon: true,
|
|
||||||
appleStartup: true,
|
|
||||||
favicons: true,
|
|
||||||
yandex: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
|
|
||||||
react(),
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
"@types/three": "^0.180.0",
|
"@types/three": "^0.180.0",
|
||||||
"@vite-pwa/astro": "^1.1.0",
|
"@vite-pwa/astro": "^1.1.0",
|
||||||
"astro": "^5.14.4",
|
"astro": "^5.14.4",
|
||||||
"astro-favicons": "^3.1.5",
|
|
||||||
"cheerio": "^1.1.2",
|
"cheerio": "^1.1.2",
|
||||||
"compare-versions": "^6.1.1",
|
"compare-versions": "^6.1.1",
|
||||||
"fuzzysort": "^3.1.0",
|
"fuzzysort": "^3.1.0",
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import * as colors from "@radix-ui/colors";
|
||||||
|
import { range } from "lodash-es";
|
||||||
|
import {
|
||||||
|
COLORS_ALPHA_ONLY,
|
||||||
|
COLOR_SCALE_LENGTH,
|
||||||
|
type AlphaOnlyColor,
|
||||||
|
type ColorAlias,
|
||||||
|
} from "../config/styles";
|
||||||
|
import type { Color } from "../ui/color";
|
||||||
|
|
||||||
|
type RadixScale = Record<string, string>;
|
||||||
|
|
||||||
|
const SOLID_STEPS = range(1, COLOR_SCALE_LENGTH + 1).map(String);
|
||||||
|
const ALPHA_STEPS = SOLID_STEPS.map((step) => `a${step}`);
|
||||||
|
const ALL_STEPS = [...SOLID_STEPS, ...ALPHA_STEPS];
|
||||||
|
|
||||||
|
function isAlphaOnly(color: string) {
|
||||||
|
return COLORS_ALPHA_ONLY.includes(color as AlphaOnlyColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only names with a dark scale, which also drops module keys like default and __esModule
|
||||||
|
export const COLORS = Object.keys(colors).filter(
|
||||||
|
(name) => `${name}Dark` in colors && !isAlphaOnly(name),
|
||||||
|
) as Color[];
|
||||||
|
|
||||||
|
// Black and white have no solid scale, so spreading them adds nothing
|
||||||
|
function scale(name: string) {
|
||||||
|
return colors[name as keyof typeof colors] as RadixScale | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function variables(
|
||||||
|
name: string,
|
||||||
|
steps: string[],
|
||||||
|
value: (step: string) => string,
|
||||||
|
) {
|
||||||
|
return steps.map((step) => `--${name}-${step}:${value(step)};`).join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
function reference(name: string) {
|
||||||
|
return (step: string) => `var(--${name}-${step})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorScaleStyles(color: Color | AlphaOnlyColor) {
|
||||||
|
const steps = isAlphaOnly(color) ? ALPHA_STEPS : ALL_STEPS;
|
||||||
|
const light = { ...scale(color), ...scale(`${color}A`) };
|
||||||
|
const dark = isAlphaOnly(color)
|
||||||
|
? light
|
||||||
|
: { ...scale(`${color}Dark`), ...scale(`${color}DarkA`) };
|
||||||
|
|
||||||
|
// Radix keys are the color then the step, like blue1 or blueA1
|
||||||
|
function radix(theme: RadixScale) {
|
||||||
|
return (step: string) => theme[`${color}${step.toUpperCase()}`];
|
||||||
|
}
|
||||||
|
|
||||||
|
const accent = variables("accent", steps, reference(color));
|
||||||
|
|
||||||
|
return [
|
||||||
|
`:root.dark{${variables(color, steps, radix(dark))}}`,
|
||||||
|
`:root.light{${variables(color, steps, radix(light))}}`,
|
||||||
|
`*[data-accent="${color}"]{${accent}}`,
|
||||||
|
].join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function colorAliasStyles(color: Color, alias: ColorAlias) {
|
||||||
|
const accent = variables("accent", ALL_STEPS, reference(alias));
|
||||||
|
|
||||||
|
return [
|
||||||
|
`:root{${variables(alias, ALL_STEPS, reference(color))}}`,
|
||||||
|
`*[data-accent="${alias}"]{${accent}}`,
|
||||||
|
].join("");
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Var } from "../../core/radix/var";
|
import { Var } from "../../core/radix/var";
|
||||||
import { Heading } from "../Heading";
|
import { Heading } from "../Heading";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Link } from "../Link";
|
import { Link } from "../Link";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
@@ -20,7 +21,7 @@ export function AesonPlug() {
|
|||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
src="/assets/images/third-party/wotb-news.png"
|
src="/assets/images/third-party/wotb-news.png"
|
||||||
style={{ width: "6rem", height: "6rem", objectFit: "cover" }}
|
style={{ width: "6rem", height: "6rem", objectFit: "cover" }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { useRef } from "react";
|
|||||||
import { useIntersection } from "../hooks/useIntersection";
|
import { useIntersection } from "../hooks/useIntersection";
|
||||||
import { useLocale } from "../hooks/useLocale";
|
import { useLocale } from "../hooks/useLocale";
|
||||||
import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps";
|
||||||
|
import { LazyImage } from "./LazyImage";
|
||||||
import { Skeleton } from "./Skeleton";
|
import { Skeleton } from "./Skeleton";
|
||||||
import { Text } from "./Text";
|
import { Text } from "./Text";
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ export function AvatarCard(props: GalleryCardProps) {
|
|||||||
|
|
||||||
{!props.skeleton && (
|
{!props.skeleton && (
|
||||||
<>
|
<>
|
||||||
<img
|
<LazyImage
|
||||||
style={{
|
style={{
|
||||||
width: "4rem",
|
width: "4rem",
|
||||||
height: "4.57rem",
|
height: "4.57rem",
|
||||||
@@ -105,7 +106,7 @@ export function AvatarCard(props: GalleryCardProps) {
|
|||||||
marginTop: "var(--space-3)",
|
marginTop: "var(--space-3)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img src={src} alt={unwrap(props.avatar.name!)} />
|
<LazyImage src={src} alt={unwrap(props.avatar.name!)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
Whitespace-only changes.
@@ -1,7 +1,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0" /> -->
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta
|
|
||||||
name="viewport"
|
|
||||||
content="initial-scale=1, maximum-scale=1, user-scalable=no"
|
|
||||||
/>
|
|
||||||
<link rel="sitemap" href="/sitemap-index.xml" />
|
<link rel="sitemap" href="/sitemap-index.xml" />
|
||||||
|
|
||||||
|
<link rel="icon" href="/favicon.png" sizes="32x32" />
|
||||||
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||||
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { HeartFilledIcon } from "@radix-ui/react-icons";
|
import { HeartFilledIcon } from "@radix-ui/react-icons";
|
||||||
import { Button, Em, Flex, Strong, Text } from "@radix-ui/themes";
|
import { Button, Em, Flex, Strong, Text } from "@radix-ui/themes";
|
||||||
import { donationTiers } from "../../config/donations";
|
import { donationTiers } from "../../config/donations";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
export function Beg() {
|
export function Beg() {
|
||||||
@@ -8,7 +9,7 @@ export function Beg() {
|
|||||||
<Flex align="center" gap="4" direction="column" className={styles.outer}>
|
<Flex align="center" gap="4" direction="column" className={styles.outer}>
|
||||||
<Text size="3" className={styles.important}>
|
<Text size="3" className={styles.important}>
|
||||||
<Flex gap="2" align="center">
|
<Flex gap="2" align="center">
|
||||||
<img src="https://github.com/tresabhi.png" />
|
<LazyImage src="https://github.com/tresabhi.png" />
|
||||||
<Em>We need your attention</Em>
|
<Em>We need your attention</Em>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
--content-size: calc(0.85 * var(--font-size-regular));
|
--content-size: calc(0.85 * var(--font-size-regular));
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-size="regular"] {
|
&:not([data-size]) {
|
||||||
--padding: var(--space-3);
|
--padding: var(--space-3);
|
||||||
--content-size: calc(1 * var(--font-size-regular));
|
--content-size: calc(1 * var(--font-size-regular));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export function Button({
|
|||||||
style,
|
style,
|
||||||
radius = "max",
|
radius = "max",
|
||||||
size = "regular",
|
size = "regular",
|
||||||
evenPadding = false,
|
evenPadding,
|
||||||
|
|
||||||
listChild,
|
listChild,
|
||||||
parentListChild,
|
parentListChild,
|
||||||
@@ -49,13 +49,13 @@ export function Button({
|
|||||||
className={classNames("composable-radius", styles.button, className)}
|
className={classNames("composable-radius", styles.button, className)}
|
||||||
data-accent={color}
|
data-accent={color}
|
||||||
data-variant={variant}
|
data-variant={variant}
|
||||||
data-light-text={variant === "solid"}
|
data-light-text={variant === "solid" || undefined}
|
||||||
data-radius={radius}
|
data-radius={radius}
|
||||||
data-size={size}
|
data-size={size === "regular" ? undefined : size}
|
||||||
data-list-child={listChild}
|
data-list-child={listChild}
|
||||||
data-parent-list-child={parentListChild}
|
data-parent-list-child={parentListChild}
|
||||||
data-high-contrast={highContrast}
|
data-high-contrast={highContrast || undefined}
|
||||||
data-even-padding={evenPadding}
|
data-even-padding={evenPadding || undefined}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Whitespace-only changes.
@@ -1,10 +1,10 @@
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import styles from "./index.module.css";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: implement callout
|
||||||
export function Callout({ children }: Props) {
|
export function Callout({ children }: Props) {
|
||||||
return <div className={styles.callout}>{children}</div>;
|
return <div>{children}</div>;
|
||||||
}
|
}
|
||||||
@@ -1,33 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
import type { ColorAlias } from "../config/styles";
|
||||||
import type { Color } from "../ui/color";
|
import type { Color } from "../ui/color";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: Color;
|
color: Color;
|
||||||
alias: string;
|
alias: ColorAlias;
|
||||||
alpha?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { color, alias, alpha } = Astro.props;
|
const { color, alias } = Astro.props;
|
||||||
|
|
||||||
let styles = "";
|
|
||||||
|
|
||||||
styles += ":root{";
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
const n = i + 1;
|
|
||||||
styles += `--${alias}-${alpha ? "a" : ""}${n}:var(--${color}-${alpha ? "a" : ""}${n});`;
|
|
||||||
}
|
|
||||||
|
|
||||||
styles += "}";
|
|
||||||
|
|
||||||
styles += `*[data-accent='${alias}']{`;
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
const n = i + 1;
|
|
||||||
styles += `--accent-${alpha ? "a" : ""}${n}:var(--${alias}-${alpha ? "a" : ""}${n});`;
|
|
||||||
}
|
|
||||||
|
|
||||||
styles += "}";
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<style set:html={styles}></style>
|
<link rel="stylesheet" href={`/styles/scales/${color}-as-${alias}.css`} />
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
import { RANKING_COLORS } from "../config/rankings";
|
||||||
|
import ColorScale from "./ColorScale.astro";
|
||||||
|
---
|
||||||
|
|
||||||
|
{RANKING_COLORS.map((color) => (
|
||||||
|
<ColorScale {color} />
|
||||||
|
))}
|
||||||
|
<link rel="stylesheet" href="/styles/rankings.css" />
|
||||||
@@ -1,54 +1,12 @@
|
|||||||
---
|
---
|
||||||
import * as colors from "@radix-ui/colors";
|
import type { AlphaOnlyColor } from "../config/styles";
|
||||||
import type { Color } from "../ui/color";
|
import type { Color } from "../ui/color";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color: Color | AlphaOnlyColor;
|
color: Color | AlphaOnlyColor;
|
||||||
alpha?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ALPHA_ONLY_COLORS = ["black", "white"] as const;
|
const { color } = Astro.props;
|
||||||
type AlphaOnlyColor = (typeof ALPHA_ONLY_COLORS)[number];
|
|
||||||
|
|
||||||
const { color, alpha } = Astro.props;
|
|
||||||
const nameLight = `${color}${alpha ? "A" : ""}`;
|
|
||||||
const nameDark = `${color}${
|
|
||||||
ALPHA_ONLY_COLORS.includes(color as AlphaOnlyColor) ? "" : "Dark"
|
|
||||||
}${alpha ? "A" : ""}`;
|
|
||||||
const scaleLight = colors[nameLight as keyof typeof colors];
|
|
||||||
const scaleDark = colors[nameDark as keyof typeof colors];
|
|
||||||
|
|
||||||
let styles = "";
|
|
||||||
|
|
||||||
styles += ":root.dark{";
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
const n = i + 1;
|
|
||||||
const value =
|
|
||||||
scaleDark[`${color}${alpha ? "A" : ""}${n}` as keyof typeof scaleDark];
|
|
||||||
styles += `--${color}-${alpha ? "a" : ""}${n}:${value};`;
|
|
||||||
}
|
|
||||||
|
|
||||||
styles += "}";
|
|
||||||
styles += ":root.light{";
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
const n = i + 1;
|
|
||||||
const value =
|
|
||||||
scaleLight[`${color}${alpha ? "A" : ""}${n}` as keyof typeof scaleLight];
|
|
||||||
styles += `--${color}-${alpha ? "a" : ""}${n}:${value};`;
|
|
||||||
}
|
|
||||||
|
|
||||||
styles += "}";
|
|
||||||
|
|
||||||
styles += `*[data-accent='${color}']{`;
|
|
||||||
|
|
||||||
for (let i = 0; i < 12; i++) {
|
|
||||||
const n = i + 1;
|
|
||||||
styles += `--accent-${alpha ? "a" : ""}${n}:var(--${color}-${alpha ? "a" : ""}${n});`;
|
|
||||||
}
|
|
||||||
|
|
||||||
styles += "}";
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<style set:html={styles}></style>
|
<link rel="stylesheet" href={`/styles/scales/${color}.css`} />
|
||||||
@@ -10,6 +10,7 @@ import { resolveTankModules } from "../../tankopedia/resolveTankModules";
|
|||||||
import { selectModule } from "../../tankopedia/selectModule";
|
import { selectModule } from "../../tankopedia/selectModule";
|
||||||
import { Button, type ButtonProps } from "../Button";
|
import { Button, type ButtonProps } from "../Button";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutConsumables } from "../LoadoutConsumables";
|
import { LoadoutConsumables } from "../LoadoutConsumables";
|
||||||
import { LoadoutEquipment } from "../LoadoutEquipment";
|
import { LoadoutEquipment } from "../LoadoutEquipment";
|
||||||
import { LoadoutModules } from "../LoadoutModules";
|
import { LoadoutModules } from "../LoadoutModules";
|
||||||
@@ -111,7 +112,7 @@ function Camouflage({ index }: SectionProps) {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={strings.tanks.loadout.camouflage}
|
alt={strings.tanks.loadout.camouflage}
|
||||||
src={alias("api", "/icons/camo.webp")}
|
src={alias("api", "/icons/camo.webp")}
|
||||||
/>
|
/>
|
||||||
@@ -128,7 +129,7 @@ function ModulesSummary(props: SummaryProps) {
|
|||||||
<IconButton variant="ghost" size="major" {...props}>
|
<IconButton variant="ghost" size="major" {...props}>
|
||||||
<div className={styles["modules-summary"]}>
|
<div className={styles["modules-summary"]}>
|
||||||
{(["turret", "gun", "engine", "chassis"] as const).map((module) => (
|
{(["turret", "gun", "engine", "chassis"] as const).map((module) => (
|
||||||
<img
|
<LazyImage
|
||||||
key={module}
|
key={module}
|
||||||
alt={strings.tanks.loadout.module_types[module]}
|
alt={strings.tanks.loadout.module_types[module]}
|
||||||
className={styles["summary-module"]}
|
className={styles["summary-module"]}
|
||||||
@@ -153,7 +154,7 @@ function ItemsSummary({ index, kind, ...props }: ItemsSummaryProps) {
|
|||||||
<IconButton variant="ghost" {...props}>
|
<IconButton variant="ghost" {...props}>
|
||||||
<div className={styles["items-summary"]}>
|
<div className={styles["items-summary"]}>
|
||||||
{selected.map((id) => (
|
{selected.map((id) => (
|
||||||
<img
|
<LazyImage
|
||||||
key={id}
|
key={id}
|
||||||
alt={unwrap(
|
alt={unwrap(
|
||||||
kind === "provisions"
|
kind === "provisions"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import { CompareInsertionMarker } from "../CompareInsertionMarker";
|
|||||||
import { CompareLoadout } from "../CompareLoadout";
|
import { CompareLoadout } from "../CompareLoadout";
|
||||||
import { CompareTankCard } from "../CompareTankCard";
|
import { CompareTankCard } from "../CompareTankCard";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Table } from "../Table";
|
import { Table } from "../Table";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
@@ -160,7 +161,7 @@ function ShellSwitcher({ member, index }: ShellSwitcherProps) {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias("api", `/icons/shells/${candidate.icon}.webp`)}
|
src={alias("api", `/icons/shells/${candidate.icon}.webp`)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { CompareEphemeral } from "../../stores/compareEphemeral";
|
|||||||
import { CompareInsertionMarker } from "../CompareInsertionMarker";
|
import { CompareInsertionMarker } from "../CompareInsertionMarker";
|
||||||
import { insertionMarkers } from "../CompareInsertionMarker/constants";
|
import { insertionMarkers } from "../CompareInsertionMarker/constants";
|
||||||
import { CompareTankControl } from "../CompareTankControl";
|
import { CompareTankControl } from "../CompareTankControl";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Table } from "../Table";
|
import { Table } from "../Table";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
@@ -106,7 +107,7 @@ export function CompareTankCard({ index, tank }: TankCardProps) {
|
|||||||
<CompareTankControl index={index} key={tank.id} slug={tank.slug} />
|
<CompareTankControl index={index} key={tank.id} slug={tank.slug} />
|
||||||
|
|
||||||
<div ref={draggable} className={styles.draggable}>
|
<div ref={draggable} className={styles.draggable}>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(tank.name!)}
|
alt={unwrap(tank.name!)}
|
||||||
src={tankIcon(tank.id)}
|
src={tankIcon(tank.id)}
|
||||||
width={64}
|
width={64}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Code, Flex, Heading, Link, Text } from "@radix-ui/themes";
|
|||||||
import { useEffect, useState, type ReactNode } from "react";
|
import { useEffect, useState, type ReactNode } from "react";
|
||||||
import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponentProps";
|
||||||
import { InlineSkeleton } from "./InlineSkeleton";
|
import { InlineSkeleton } from "./InlineSkeleton";
|
||||||
|
import { LazyImage } from "./LazyImage";
|
||||||
|
|
||||||
const TIME = 1793898000 * 1000;
|
const TIME = 1793898000 * 1000;
|
||||||
const HREF = "https://preview.blitzkit.app/tanks";
|
const HREF = "https://preview.blitzkit.app/tanks";
|
||||||
@@ -66,7 +67,7 @@ export function Countdown({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
align="center"
|
align="center"
|
||||||
gap="5"
|
gap="5"
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
src="https://i.imgur.com/kXV3r3P.png"
|
src="https://i.imgur.com/kXV3r3P.png"
|
||||||
style={{
|
style={{
|
||||||
height: "min(15vw, 5rem)",
|
height: "min(15vw, 5rem)",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useStrings } from "../../hooks/useStrings";
|
|||||||
import { Tankopedia } from "../../stores/tankopedia";
|
import { Tankopedia } from "../../stores/tankopedia";
|
||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Popover } from "../Popover";
|
import { Popover } from "../Popover";
|
||||||
import { Select } from "../Select";
|
import { Select } from "../Select";
|
||||||
import { Slider } from "../Slider";
|
import { Slider } from "../Slider";
|
||||||
@@ -112,7 +113,7 @@ export function CustomShellButton() {
|
|||||||
highContrast={customShell !== undefined}
|
highContrast={customShell !== undefined}
|
||||||
size="major"
|
size="major"
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={strings.tanks.custom_shell.title}
|
alt={strings.tanks.custom_shell.title}
|
||||||
src="/assets/images/icons/custom-shell.png"
|
src="/assets/images/icons/custom-shell.png"
|
||||||
/>
|
/>
|
||||||
@@ -193,7 +194,7 @@ export function CustomShellButton() {
|
|||||||
<Select.ItemText className="TEST_CLASS">
|
<Select.ItemText className="TEST_CLASS">
|
||||||
{strings.common.shells[label]}
|
{strings.common.shells[label]}
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
alt={strings.common.shells[label]}
|
alt={strings.common.shells[label]}
|
||||||
src={alias(
|
src={alias(
|
||||||
"api",
|
"api",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Var } from '../../core/radix/var';
|
|||||||
import type { LocaleAcceptorProps } from '../../hooks/useLocale';
|
import type { LocaleAcceptorProps } from '../../hooks/useLocale';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../types/maybeSkeletonComponentProps';
|
||||||
import { InlineSkeleton } from '../InlineSkeleton';
|
import { InlineSkeleton } from '../InlineSkeleton';
|
||||||
|
import { LazyImage } from '../LazyImage';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
export interface DiscordWidget {
|
export interface DiscordWidget {
|
||||||
@@ -101,7 +102,7 @@ function Member({
|
|||||||
<Flex key={id} align="center" gap="2" flexShrink="0" width="8rem">
|
<Flex key={id} align="center" gap="2" flexShrink="0" width="8rem">
|
||||||
<Box width="1.5em" height="1.5em" flexShrink="0" position="relative">
|
<Box width="1.5em" height="1.5em" flexShrink="0" position="relative">
|
||||||
{!skeleton && (
|
{!skeleton && (
|
||||||
<img
|
<LazyImage
|
||||||
src={avatar_url}
|
src={avatar_url}
|
||||||
alt={`${username} profile picture`}
|
alt={`${username} profile picture`}
|
||||||
style={{ width: '100%', height: '100%', borderRadius: '50%' }}
|
style={{ width: '100%', height: '100%', borderRadius: '50%' }}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
import { localizedHTML as favicons } from "astro-favicons/middleware";
|
|
||||||
|
|
||||||
const { locale } = Astro.props;
|
|
||||||
---
|
|
||||||
|
|
||||||
<Fragment set:html={favicons(locale)} />
|
|
||||||
Whitespace-only changes.
@@ -26,6 +26,7 @@ import { Card } from "../Card";
|
|||||||
import { ClassIcon } from "../ClassIcon";
|
import { ClassIcon } from "../ClassIcon";
|
||||||
import { DropdownMenu } from "../DropdownMenu";
|
import { DropdownMenu } from "../DropdownMenu";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { TRANSITION_ANIMATION_TIME, transitionEvent } from "../Lighting";
|
import { TRANSITION_ANIMATION_TIME, transitionEvent } from "../Lighting";
|
||||||
import { SearchResults } from "../SearchResults";
|
import { SearchResults } from "../SearchResults";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
@@ -122,7 +123,7 @@ export function Guesser() {
|
|||||||
key={result.id}
|
key={result.id}
|
||||||
text={unwrap(result.name!)}
|
text={unwrap(result.name!)}
|
||||||
prefix={
|
prefix={
|
||||||
<img
|
<LazyImage
|
||||||
src={alias("api", `/flags/circle/${result.nation}.webp`)}
|
src={alias("api", `/flags/circle/${result.nation}.webp`)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import type { ComponentProps } from "react";
|
||||||
|
|
||||||
|
export function LazyImage(props: ComponentProps<"img">) {
|
||||||
|
return <img {...props} loading="lazy" />;
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ import { layoutAugmentTree } from "../../tankopedia/augmentTreeLayout";
|
|||||||
import { AUGMENT_GROUP_ID } from "../../tankopedia/augments";
|
import { AUGMENT_GROUP_ID } from "../../tankopedia/augments";
|
||||||
import { classNames } from "../../ui/classNames";
|
import { classNames } from "../../ui/classNames";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import shared from "../LoadoutTree/index.module.css";
|
import shared from "../LoadoutTree/index.module.css";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
@@ -31,7 +32,7 @@ interface AugmentIconProps {
|
|||||||
function AugmentIcon({ icon, isCommon }: AugmentIconProps) {
|
function AugmentIcon({ icon, isCommon }: AugmentIconProps) {
|
||||||
if (icon !== undefined) {
|
if (icon !== undefined) {
|
||||||
return (
|
return (
|
||||||
<img
|
<LazyImage
|
||||||
alt=""
|
alt=""
|
||||||
src={alias("api", `/icons/augments/${icon}.webp`)}
|
src={alias("api", `/icons/augments/${icon}.webp`)}
|
||||||
className={shared.icon}
|
className={shared.icon}
|
||||||
@@ -58,7 +59,7 @@ function Price({ xp }: PriceProps) {
|
|||||||
return (
|
return (
|
||||||
<div className={shared.price}>
|
<div className={shared.price}>
|
||||||
<Text size="minor">{formatCompact(locale, xp)}</Text>
|
<Text size="minor">{formatCompact(locale, xp)}</Text>
|
||||||
<img alt="xp" src={alias("api", "/icons/currencies/xp.webp")} />
|
<LazyImage alt="xp" src={alias("api", "/icons/currencies/xp.webp")} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { useTankCompatibility } from "../../hooks/useTankCompatibility";
|
|||||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
@@ -57,7 +58,7 @@ function Content({ tank, gun, selected, onToggle }: ContentProps) {
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={() => onToggle(consumable.id)}
|
onClick={() => onToggle(consumable.id)}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
src={alias("api", `/icons/consumables/${consumable.id}.webp`)}
|
src={alias("api", `/icons/consumables/${consumable.id}.webp`)}
|
||||||
/>
|
/>
|
||||||
<div className={styles.info}>
|
<div className={styles.info}>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useEquipmentPreset } from "../../hooks/useEquipmentPreset";
|
|||||||
import { useStrings } from "../../hooks/useStrings";
|
import { useStrings } from "../../hooks/useStrings";
|
||||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
@@ -70,7 +71,7 @@ function Slot({ slot, slotIndex, selected, onToggle }: SlotProps) {
|
|||||||
parentListChild="horizontal"
|
parentListChild="horizontal"
|
||||||
onClick={() => onToggle(slotIndex, optionIndex)}
|
onClick={() => onToggle(slotIndex, optionIndex)}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias("api", `/icons/equipment/${id}.webp`)}
|
src={alias("api", `/icons/equipment/${id}.webp`)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import type { TankState } from "../../tankopedia/tankState";
|
|||||||
import { classNames } from "../../ui/classNames";
|
import { classNames } from "../../ui/classNames";
|
||||||
import { Discriminator } from "../Discriminator";
|
import { Discriminator } from "../Discriminator";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LinkI18n } from "../LinkI18n";
|
import { LinkI18n } from "../LinkI18n";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import shared from "../LoadoutTree/index.module.css";
|
import shared from "../LoadoutTree/index.module.css";
|
||||||
@@ -220,7 +221,7 @@ function ModuleNode({
|
|||||||
if (!isTank) onSelect(unlock);
|
if (!isTank) onSelect(unlock);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={tooltip}
|
alt={tooltip}
|
||||||
src={
|
src={
|
||||||
isTank
|
isTank
|
||||||
@@ -237,7 +238,7 @@ function ModuleNode({
|
|||||||
{unlock.cost!.value > 0 && (
|
{unlock.cost!.value > 0 && (
|
||||||
<div className={shared.price}>
|
<div className={shared.price}>
|
||||||
<Text size="minor">{formatCompact(locale, unlock.cost!.value)}</Text>
|
<Text size="minor">{formatCompact(locale, unlock.cost!.value)}</Text>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unlock.cost!.type}
|
alt={unlock.cost!.type}
|
||||||
src={alias("api", `/icons/currencies/${unlock.cost!.type}.webp`)}
|
src={alias("api", `/icons/currencies/${unlock.cost!.type}.webp`)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { useStrings } from "../../hooks/useStrings";
|
|||||||
import { useTankCompatibility } from "../../hooks/useTankCompatibility";
|
import { useTankCompatibility } from "../../hooks/useTankCompatibility";
|
||||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
@@ -55,7 +56,7 @@ function Content({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onClick={() => onToggle(provision.id)}
|
onClick={() => onToggle(provision.id)}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
src={alias("api", `/icons/provisions/${provision.id}.webp`)}
|
src={alias("api", `/icons/provisions/${provision.id}.webp`)}
|
||||||
/>
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { GunDefinition } from "@blitzkit/protos";
|
|||||||
import { useStrings } from "../../hooks/useStrings";
|
import { useStrings } from "../../hooks/useStrings";
|
||||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
@@ -34,7 +35,7 @@ export function LoadoutShells({ gun, selected, onSelect }: LoadoutShellsProps) {
|
|||||||
parentListChild="horizontal"
|
parentListChild="horizontal"
|
||||||
onClick={() => onSelect(candidate.id)}
|
onClick={() => onSelect(candidate.id)}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias("api", `/icons/shells/${candidate.icon}.webp`)}
|
src={alias("api", `/icons/shells/${candidate.icon}.webp`)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { api } from "../../api/dynamic";
|
|||||||
import { useStrings } from "../../hooks/useStrings";
|
import { useStrings } from "../../hooks/useStrings";
|
||||||
import { Discriminator } from "../Discriminator";
|
import { Discriminator } from "../Discriminator";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ function Content({ selected, onChange }: ContentProps) {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img src={alias("api", `/icons/skills/${skill}.webp`)} />
|
<LazyImage src={alias("api", `/icons/skills/${skill}.webp`)} />
|
||||||
{level > 0 && (
|
{level > 0 && (
|
||||||
<Discriminator inset="small">{romanize(level)}</Discriminator>
|
<Discriminator inset="small">{romanize(level)}</Discriminator>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
type VehicleStatusKey,
|
type VehicleStatusKey,
|
||||||
} from "../../tankopedia/tankState";
|
} from "../../tankopedia/tankState";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LoadoutSection } from "../LoadoutSection";
|
import { LoadoutSection } from "../LoadoutSection";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ export function LoadoutStatus({
|
|||||||
variant={status[key] ? "surface" : "soft"}
|
variant={status[key] ? "surface" : "soft"}
|
||||||
onClick={() => onToggle(key)}
|
onClick={() => onToggle(key)}
|
||||||
>
|
>
|
||||||
<img src={`/media/status/${key}.png`} />
|
<LazyImage src={`/media/status/${key}.png`} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Link, Table } from '@radix-ui/themes';
|
|||||||
import MarkdownToJSX from 'markdown-to-jsx';
|
import MarkdownToJSX from 'markdown-to-jsx';
|
||||||
import type { ComponentProps } from 'react';
|
import type { ComponentProps } from 'react';
|
||||||
import { docImageUrl, isExternalImage } from '../core/blitzkit/docImages';
|
import { docImageUrl, isExternalImage } from '../core/blitzkit/docImages';
|
||||||
|
import { LazyImage } from './LazyImage';
|
||||||
|
|
||||||
interface MarkdownProps {
|
interface MarkdownProps {
|
||||||
children: string;
|
children: string;
|
||||||
@@ -9,7 +10,7 @@ interface MarkdownProps {
|
|||||||
|
|
||||||
function Image({ src, ...props }: ComponentProps<'img'>) {
|
function Image({ src, ...props }: ComponentProps<'img'>) {
|
||||||
return (
|
return (
|
||||||
<img
|
<LazyImage
|
||||||
style={{ maxWidth: '100%' }}
|
style={{ maxWidth: '100%' }}
|
||||||
src={src && isExternalImage(src) ? docImageUrl(src) : src}
|
src={src && isExternalImage(src) ? docImageUrl(src) : src}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { Button } from "../Button";
|
|||||||
import { Dialog } from "../Dialog";
|
import { Dialog } from "../Dialog";
|
||||||
import { Discriminator } from "../Discriminator";
|
import { Discriminator } from "../Discriminator";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Popover } from "../Popover";
|
import { Popover } from "../Popover";
|
||||||
import { Skeleton } from "../Skeleton";
|
import { Skeleton } from "../Skeleton";
|
||||||
import { TankSearch } from "../TankSearch";
|
import { TankSearch } from "../TankSearch";
|
||||||
@@ -130,7 +131,7 @@ export function MixerModuleChooser({
|
|||||||
onSelect?.(tankDefinition, turret);
|
onSelect?.(tankDefinition, turret);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt="turret"
|
alt="turret"
|
||||||
src={alias("api", "/icons/modules/turret.webp")}
|
src={alias("api", "/icons/modules/turret.webp")}
|
||||||
/>
|
/>
|
||||||
@@ -165,7 +166,7 @@ export function MixerModuleChooser({
|
|||||||
onSelect?.(tankDefinition, turretDefinition, gun);
|
onSelect?.(tankDefinition, turretDefinition, gun);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt="gun"
|
alt="gun"
|
||||||
src={alias("api", "/icons/modules/gun.webp")}
|
src={alias("api", "/icons/modules/gun.webp")}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { EmptyState } from "../EmptyState";
|
|||||||
import { ExperimentIcon } from "../ExperimentIcon";
|
import { ExperimentIcon } from "../ExperimentIcon";
|
||||||
import { IncrementalLoader } from "../IncrementalLoader";
|
import { IncrementalLoader } from "../IncrementalLoader";
|
||||||
import { InlineSkeleton } from "../InlineSkeleton";
|
import { InlineSkeleton } from "../InlineSkeleton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LinkI18n } from "../LinkI18n";
|
import { LinkI18n } from "../LinkI18n";
|
||||||
import { Skeleton } from "../Skeleton";
|
import { Skeleton } from "../Skeleton";
|
||||||
import { Table } from "../Table";
|
import { Table } from "../Table";
|
||||||
@@ -341,7 +342,7 @@ function TankLink({ tank }: TankLinkProps) {
|
|||||||
}
|
}
|
||||||
highContrast={tank.type === TankType.TANK_TYPE_RESEARCHABLE}
|
highContrast={tank.type === TankType.TANK_TYPE_RESEARCHABLE}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={tankIcon(tank.id)}
|
src={tankIcon(tank.id)}
|
||||||
draggable={false}
|
draggable={false}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { alias } from "@blitzkit/core";
|
import { alias } from "@blitzkit/core";
|
||||||
|
import { LazyImage } from "./LazyImage";
|
||||||
|
|
||||||
interface SmallTankIconProps {
|
interface SmallTankIconProps {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -17,7 +18,7 @@ export function SmallTankIcon({ id, size = HEIGHT }: SmallTankIconProps) {
|
|||||||
width: WIDTH * (size / HEIGHT),
|
width: WIDTH * (size / HEIGHT),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={`Tank ${id}`}
|
alt={`Tank ${id}`}
|
||||||
src={alias("api", `/tanks/${id}/icons/small.webp`)}
|
src={alias("api", `/tanks/${id}/icons/small.webp`)}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { useUnwrapper } from "../../hooks/useUnwrapper";
|
|||||||
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
||||||
import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../../types/maybeSkeletonComponentProps";
|
||||||
import { ClassIcon } from "../ClassIcon";
|
import { ClassIcon } from "../ClassIcon";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { LinkI18nWrapper } from "../LinkI18nWrapper";
|
import { LinkI18nWrapper } from "../LinkI18nWrapper";
|
||||||
import { TankCardSkeleton } from "../TankCardSkeleton";
|
import { TankCardSkeleton } from "../TankCardSkeleton";
|
||||||
import { MAX_RECENTLY_VIEWED } from "../TankSearch/constants";
|
import { MAX_RECENTLY_VIEWED } from "../TankSearch/constants";
|
||||||
@@ -71,7 +72,7 @@ export const TankCard = (props: MaybeSkeletonComponentProps<TankCardProps>) => {
|
|||||||
)})`,
|
)})`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias("api", `/tanks/${props.tank.id}/icons/big.webp`)}
|
src={alias("api", `/tanks/${props.tank.id}/icons/big.webp`)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Whitespace-only changes.
@@ -21,6 +21,7 @@ import { Button } from "../Button";
|
|||||||
import { ClassIcon } from "../ClassIcon";
|
import { ClassIcon } from "../ClassIcon";
|
||||||
import { DropdownMenu } from "../DropdownMenu";
|
import { DropdownMenu } from "../DropdownMenu";
|
||||||
import { GunTypeIcon } from "../GunTypeIcon";
|
import { GunTypeIcon } from "../GunTypeIcon";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { MissingShellIcon } from "../MissingShellIcon";
|
import { MissingShellIcon } from "../MissingShellIcon";
|
||||||
import { ResearchedIcon } from "../ResearchedIcon";
|
import { ResearchedIcon } from "../ResearchedIcon";
|
||||||
import { ScienceIcon } from "../ScienceIcon";
|
import { ScienceIcon } from "../ScienceIcon";
|
||||||
@@ -272,7 +273,7 @@ function NationsFilter() {
|
|||||||
<DropdownMenu.Trigger asChild>
|
<DropdownMenu.Trigger asChild>
|
||||||
<Button color="gray" variant="soft">
|
<Button color="gray" variant="soft">
|
||||||
{nations.map((nation) => (
|
{nations.map((nation) => (
|
||||||
<img
|
<LazyImage
|
||||||
className={styles.icon}
|
className={styles.icon}
|
||||||
key={nation}
|
key={nation}
|
||||||
src={alias("api", `/flags/circle/${nation}.webp`)}
|
src={alias("api", `/flags/circle/${nation}.webp`)}
|
||||||
@@ -605,7 +606,7 @@ function IndividualShellFilter({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{shells[index] !== null && (
|
{shells[index] !== null && (
|
||||||
<img
|
<LazyImage
|
||||||
src={alias(
|
src={alias(
|
||||||
"api",
|
"api",
|
||||||
`/icons/shells/${shellTypeIcons[shells[index]]}${premium ? "_premium" : ""}.webp`,
|
`/icons/shells/${shellTypeIcons[shells[index]]}${premium ? "_premium" : ""}.webp`,
|
||||||
@@ -651,7 +652,7 @@ function IndividualShellFilter({
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
src={alias(
|
src={alias(
|
||||||
"api",
|
"api",
|
||||||
`/icons/shells/${shellTypeIcons[shellType]}${
|
`/icons/shells/${shellTypeIcons[shellType]}${
|
||||||
@@ -799,7 +800,7 @@ function ConsumablesFilter() {
|
|||||||
<DropdownMenu.Trigger asChild>
|
<DropdownMenu.Trigger asChild>
|
||||||
<Button color="gray" variant="soft">
|
<Button color="gray" variant="soft">
|
||||||
{consumables.slice(0, MAX_ICONS).map((consumable) => (
|
{consumables.slice(0, MAX_ICONS).map((consumable) => (
|
||||||
<img
|
<LazyImage
|
||||||
key={consumable}
|
key={consumable}
|
||||||
className={styles.icon}
|
className={styles.icon}
|
||||||
src={alias("api", `/icons/consumables/${consumable}.webp`)}
|
src={alias("api", `/icons/consumables/${consumable}.webp`)}
|
||||||
@@ -846,7 +847,7 @@ function ConsumablesFilter() {
|
|||||||
|
|
||||||
{unwrap(consumableDefinition.name!)}
|
{unwrap(consumableDefinition.name!)}
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
src={alias("api", `/icons/consumables/${consumable}.webp`)}
|
src={alias("api", `/icons/consumables/${consumable}.webp`)}
|
||||||
/>
|
/>
|
||||||
</DropdownMenu.CheckboxItem>
|
</DropdownMenu.CheckboxItem>
|
||||||
@@ -886,7 +887,7 @@ function ProvisionsFilter() {
|
|||||||
<DropdownMenu.Trigger asChild>
|
<DropdownMenu.Trigger asChild>
|
||||||
<Button color="gray" variant="soft">
|
<Button color="gray" variant="soft">
|
||||||
{provisions.slice(0, MAX_ICONS).map((provision) => (
|
{provisions.slice(0, MAX_ICONS).map((provision) => (
|
||||||
<img
|
<LazyImage
|
||||||
key={provision}
|
key={provision}
|
||||||
className={styles.icon}
|
className={styles.icon}
|
||||||
src={alias("api", `/icons/provisions/${provision}.webp`)}
|
src={alias("api", `/icons/provisions/${provision}.webp`)}
|
||||||
@@ -933,7 +934,7 @@ function ProvisionsFilter() {
|
|||||||
|
|
||||||
{unwrap(provisionDefinition.name!)}
|
{unwrap(provisionDefinition.name!)}
|
||||||
|
|
||||||
<img src={alias("api", `/icons/provisions/${provision}.webp`)} />
|
<LazyImage src={alias("api", `/icons/provisions/${provision}.webp`)} />
|
||||||
</DropdownMenu.CheckboxItem>
|
</DropdownMenu.CheckboxItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -986,7 +987,7 @@ function GameModeAbilitiesFilter() {
|
|||||||
<DropdownMenu.Trigger asChild>
|
<DropdownMenu.Trigger asChild>
|
||||||
<Button color="gray" variant="soft">
|
<Button color="gray" variant="soft">
|
||||||
{icons.slice(0, MAX_ICONS).map((icon) => (
|
{icons.slice(0, MAX_ICONS).map((icon) => (
|
||||||
<img key={icon} className={styles.icon} src={icon} />
|
<LazyImage key={icon} className={styles.icon} src={icon} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{icons.length > MAX_ICONS && (
|
{icons.length > MAX_ICONS && (
|
||||||
@@ -1051,7 +1052,7 @@ function GameModeAbilitiesFilter() {
|
|||||||
|
|
||||||
{unwrap(abilityDefinition.name!)}
|
{unwrap(abilityDefinition.name!)}
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
src={alias(
|
src={alias(
|
||||||
"api",
|
"api",
|
||||||
`/icons/consumables/${consumable}.webp`,
|
`/icons/consumables/${consumable}.webp`,
|
||||||
@@ -1102,7 +1103,7 @@ function GameModeAbilitiesFilter() {
|
|||||||
|
|
||||||
{unwrap(powerDefinition.name!)}
|
{unwrap(powerDefinition.name!)}
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
src={alias(
|
src={alias(
|
||||||
"api",
|
"api",
|
||||||
`/icons/provisions/${provision}.webp`,
|
`/icons/provisions/${provision}.webp`,
|
||||||
|
|||||||
+2
-1
@@ -13,6 +13,7 @@ import { useLocale } from "../../../../../../hooks/useLocale";
|
|||||||
import { useTankModelDefinition } from "../../../../../../hooks/useTankModelDefinition";
|
import { useTankModelDefinition } from "../../../../../../hooks/useTankModelDefinition";
|
||||||
import { Duel } from "../../../../../../stores/duel";
|
import { Duel } from "../../../../../../stores/duel";
|
||||||
import type { MaybeSkeletonComponentProps } from "../../../../../../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../../../../../../types/maybeSkeletonComponentProps";
|
||||||
|
import { LazyImage } from "../../../../../LazyImage";
|
||||||
import { AssaultRangesVisualizer } from "./AssaultRangesVisualizer";
|
import { AssaultRangesVisualizer } from "./AssaultRangesVisualizer";
|
||||||
import { GunFlexibilityVisualizer } from "./GunFlexibilityVisualizer";
|
import { GunFlexibilityVisualizer } from "./GunFlexibilityVisualizer";
|
||||||
import { Info } from "./Info";
|
import { Info } from "./Info";
|
||||||
@@ -66,7 +67,7 @@ export function Firepower({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(thisShell.name!)}
|
alt={unwrap(thisShell.name!)}
|
||||||
width={16}
|
width={16}
|
||||||
height={16}
|
height={16}
|
||||||
|
|||||||
+2
-1
@@ -5,6 +5,7 @@ import { Quicklime, type QuicklimeCallback } from 'quicklime';
|
|||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { Var } from '../../../../../../../core/radix/var';
|
import { Var } from '../../../../../../../core/radix/var';
|
||||||
import { useLocale } from '../../../../../../../hooks/useLocale';
|
import { useLocale } from '../../../../../../../hooks/useLocale';
|
||||||
|
import { LazyImage } from '../../../../../../LazyImage';
|
||||||
import type { StatsAcceptorProps } from '../TraverseVisualizer';
|
import type { StatsAcceptorProps } from '../TraverseVisualizer';
|
||||||
import { VisualizerCard } from '../VisualizerCard';
|
import { VisualizerCard } from '../VisualizerCard';
|
||||||
import { Shell } from './components/Shell';
|
import { Shell } from './components/Shell';
|
||||||
@@ -236,7 +237,7 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
src="/assets/images/tankopedia/visualizers/reload/caret.png"
|
src="/assets/images/tankopedia/visualizers/reload/caret.png"
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ import { alias } from "@blitzkit/core";
|
|||||||
import { Flex, IconButton, Tooltip } from "@radix-ui/themes";
|
import { Flex, IconButton, Tooltip } from "@radix-ui/themes";
|
||||||
import { useLocale } from "../../../../../../../../hooks/useLocale";
|
import { useLocale } from "../../../../../../../../hooks/useLocale";
|
||||||
import { Duel } from "../../../../../../../../stores/duel";
|
import { Duel } from "../../../../../../../../stores/duel";
|
||||||
|
import { LazyImage } from "../../../../../../../LazyImage";
|
||||||
|
|
||||||
export function ShellSwitcher() {
|
export function ShellSwitcher() {
|
||||||
const gun = Duel.use((state) => state.protagonist.gun);
|
const gun = Duel.use((state) => state.protagonist.gun);
|
||||||
@@ -35,7 +36,7 @@ export function ShellSwitcher() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(thisShell.name!)}
|
alt={unwrap(thisShell.name!)}
|
||||||
style={{ width: "1.125rem", height: "1.125rem" }}
|
style={{ width: "1.125rem", height: "1.125rem" }}
|
||||||
src={alias("api", `/icons/shells/${thisShell.icon}.webp`)}
|
src={alias("api", `/icons/shells/${thisShell.icon}.webp`)}
|
||||||
|
|||||||
+2
-1
@@ -6,6 +6,7 @@ import { clamp, degToRad, radToDeg } from "three/src/math/MathUtils.js";
|
|||||||
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 { LazyImage } from "../../../../../../LazyImage";
|
||||||
import type { StatsAcceptorProps } from "../TraverseVisualizer";
|
import type { StatsAcceptorProps } from "../TraverseVisualizer";
|
||||||
import { VisualizerCard } from "../VisualizerCard";
|
import { VisualizerCard } from "../VisualizerCard";
|
||||||
import { VisualizerCornerStat } from "../VisualizerCornerStat";
|
import { VisualizerCornerStat } from "../VisualizerCornerStat";
|
||||||
@@ -123,7 +124,7 @@ export function RicochetVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
src={alias("api", `/icons/shells/${shell.icon}.webp`)}
|
src={alias("api", `/icons/shells/${shell.icon}.webp`)}
|
||||||
style={{
|
style={{
|
||||||
objectFit: "contain",
|
objectFit: "contain",
|
||||||
|
|||||||
+3
-2
@@ -3,6 +3,7 @@ import { Checkbox, Code, Flex, Tabs, Text } from "@radix-ui/themes";
|
|||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import type { TankCharacteristics } from "../../../../../../../core/blitzkit/tankCharacteristics";
|
import type { TankCharacteristics } from "../../../../../../../core/blitzkit/tankCharacteristics";
|
||||||
import { useLocale } from "../../../../../../../hooks/useLocale";
|
import { useLocale } from "../../../../../../../hooks/useLocale";
|
||||||
|
import { LazyImage } from "../../../../../../LazyImage";
|
||||||
import { VisualizerCard } from "../VisualizerCard";
|
import { VisualizerCard } from "../VisualizerCard";
|
||||||
|
|
||||||
export interface StatsAcceptorProps {
|
export interface StatsAcceptorProps {
|
||||||
@@ -72,7 +73,7 @@ export function TraverseVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
}s`,
|
}s`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
draggable="false"
|
draggable="false"
|
||||||
style={{
|
style={{
|
||||||
width: isTurretless ? "22rem" : "12rem",
|
width: isTurretless ? "22rem" : "12rem",
|
||||||
@@ -84,7 +85,7 @@ export function TraverseVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{!isTurretless && (
|
{!isTurretless && (
|
||||||
<img
|
<LazyImage
|
||||||
draggable="false"
|
draggable="false"
|
||||||
ref={turret}
|
ref={turret}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { CaretRightIcon } from "@radix-ui/react-icons";
|
|||||||
import { Box, Flex, Link, Text } from "@radix-ui/themes";
|
import { Box, Flex, Link, Text } from "@radix-ui/themes";
|
||||||
import { Var } from "../../../core/radix/var";
|
import { Var } from "../../../core/radix/var";
|
||||||
import type { TankGuide } from "../../../types/tankGuide";
|
import type { TankGuide } from "../../../types/tankGuide";
|
||||||
|
import { LazyImage } from "../../LazyImage";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
guide: TankGuide;
|
guide: TankGuide;
|
||||||
@@ -26,7 +27,7 @@ export function GuideSection({ guide }: Props) {
|
|||||||
<Flex direction="column" gap="4" position="relative">
|
<Flex direction="column" gap="4" position="relative">
|
||||||
<Text size="4" weight="medium">
|
<Text size="4" weight="medium">
|
||||||
<Flex width="100%" justify="start" align="center" gap="2">
|
<Flex width="100%" justify="start" align="center" gap="2">
|
||||||
<img
|
<LazyImage
|
||||||
style={{
|
style={{
|
||||||
width: "1.5em",
|
width: "1.5em",
|
||||||
height: "1.5em",
|
height: "1.5em",
|
||||||
@@ -39,7 +40,7 @@ export function GuideSection({ guide }: Props) {
|
|||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text size="2">{guide.description}</Text>
|
<Text size="2">{guide.description}</Text>
|
||||||
<img style={{ width: "100%" }} src={guide.image} />
|
<LazyImage style={{ width: "100%" }} src={guide.image} />
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
position="absolute"
|
position="absolute"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { App } from "../../../stores/app";
|
|||||||
import { Duel } from "../../../stores/duel";
|
import { Duel } from "../../../stores/duel";
|
||||||
import { classIcons } from "../../ClassIcon";
|
import { classIcons } from "../../ClassIcon";
|
||||||
import { CopyableCode } from "../../CopyableCode";
|
import { CopyableCode } from "../../CopyableCode";
|
||||||
|
import { LazyImage } from "../../LazyImage";
|
||||||
import { Listing } from "./components/Listing";
|
import { Listing } from "./components/Listing";
|
||||||
|
|
||||||
const NATIONAL_BANNER_POSITION_OVERRIDES: Record<string, string> = {
|
const NATIONAL_BANNER_POSITION_OVERRIDES: Record<string, string> = {
|
||||||
@@ -58,7 +59,7 @@ export function MetaSection() {
|
|||||||
<Flex direction="column" width="100%" gap="2">
|
<Flex direction="column" width="100%" gap="2">
|
||||||
<Listing label={strings.website.tools.tankopedia.meta.nation}>
|
<Listing label={strings.website.tools.tankopedia.meta.nation}>
|
||||||
<Flex align="center" gap="1">
|
<Flex align="center" gap="1">
|
||||||
<img
|
<LazyImage
|
||||||
style={{ width: "1em", height: "1em" }}
|
style={{ width: "1em", height: "1em" }}
|
||||||
alt={protagonist.nation}
|
alt={protagonist.nation}
|
||||||
src={alias(
|
src={alias(
|
||||||
@@ -131,7 +132,7 @@ export function MetaSection() {
|
|||||||
>
|
>
|
||||||
<Flex align="center" gap="1">
|
<Flex align="center" gap="1">
|
||||||
{protagonist.price!.value / 400}
|
{protagonist.price!.value / 400}
|
||||||
<img
|
<LazyImage
|
||||||
style={{ width: "1em", height: "1em" }}
|
style={{ width: "1em", height: "1em" }}
|
||||||
alt="gold"
|
alt="gold"
|
||||||
src={alias("api", "/icons/currencies/gold.webp")}
|
src={alias("api", "/icons/currencies/gold.webp")}
|
||||||
@@ -148,7 +149,7 @@ export function MetaSection() {
|
|||||||
>
|
>
|
||||||
<Flex align="center" gap="1">
|
<Flex align="center" gap="1">
|
||||||
{protagonist.price!.value.toLocaleString(locale)}
|
{protagonist.price!.value.toLocaleString(locale)}
|
||||||
<img
|
<LazyImage
|
||||||
style={{ width: "1em", height: "1em" }}
|
style={{ width: "1em", height: "1em" }}
|
||||||
alt={TankPriceType[protagonist.price!.type]}
|
alt={TankPriceType[protagonist.price!.type]}
|
||||||
src={alias(
|
src={alias(
|
||||||
@@ -166,7 +167,7 @@ export function MetaSection() {
|
|||||||
<Listing label={strings.website.tools.tankopedia.meta.sale}>
|
<Listing label={strings.website.tools.tankopedia.meta.sale}>
|
||||||
<Flex align="center" gap="1">
|
<Flex align="center" gap="1">
|
||||||
{(protagonist.price!.value / 2).toLocaleString(locale)}
|
{(protagonist.price!.value / 2).toLocaleString(locale)}
|
||||||
<img
|
<LazyImage
|
||||||
style={{ width: "1em", height: "1em" }}
|
style={{ width: "1em", height: "1em" }}
|
||||||
alt={TankPriceType[protagonist.price!.type]}
|
alt={TankPriceType[protagonist.price!.type]}
|
||||||
src={alias(
|
src={alias(
|
||||||
@@ -190,7 +191,7 @@ export function MetaSection() {
|
|||||||
protagonist.research_cost.research_cost_type!
|
protagonist.research_cost.research_cost_type!
|
||||||
.value as number
|
.value as number
|
||||||
).toLocaleString(locale)}
|
).toLocaleString(locale)}
|
||||||
<img
|
<LazyImage
|
||||||
style={{ width: "1em", height: "1em" }}
|
style={{ width: "1em", height: "1em" }}
|
||||||
alt="xp"
|
alt="xp"
|
||||||
src={alias("api", "/icons/currencies/xp.webp")}
|
src={alias("api", "/icons/currencies/xp.webp")}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { awaitableAverageDefinitions } from "../../../../core/awaitables/average
|
|||||||
import { useLocale } from "../../../../hooks/useLocale";
|
import { useLocale } from "../../../../hooks/useLocale";
|
||||||
import { Tankopedia } from "../../../../stores/tankopedia";
|
import { Tankopedia } from "../../../../stores/tankopedia";
|
||||||
import type { MaybeSkeletonComponentProps } from "../../../../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../../../../types/maybeSkeletonComponentProps";
|
||||||
|
import { LazyImage } from "../../../LazyImage";
|
||||||
import { LinkI18n } from "../../../LinkI18n";
|
import { LinkI18n } from "../../../LinkI18n";
|
||||||
|
|
||||||
type NodeProps = MaybeSkeletonComponentProps & {
|
type NodeProps = MaybeSkeletonComponentProps & {
|
||||||
@@ -77,7 +78,7 @@ export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
|||||||
WebkitBackdropFilter: highlight ? "brightness(0.25)" : undefined,
|
WebkitBackdropFilter: highlight ? "brightness(0.25)" : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(tank.name!)}
|
alt={unwrap(tank.name!)}
|
||||||
src={alias("api", `/tanks/${id}/icons/big.webp`)}
|
src={alias("api", `/tanks/${id}/icons/big.webp`)}
|
||||||
width={64}
|
width={64}
|
||||||
@@ -97,7 +98,7 @@ export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
|||||||
<Flex gap="2" align="center">
|
<Flex gap="2" align="center">
|
||||||
<Text color="gray" size="1" wrap="nowrap">
|
<Text color="gray" size="1" wrap="nowrap">
|
||||||
<Flex gap="1" align="center">
|
<Flex gap="1" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
alt="XP"
|
alt="XP"
|
||||||
src={alias("api", "/icons/currencies/xp.webp")}
|
src={alias("api", "/icons/currencies/xp.webp")}
|
||||||
style={{
|
style={{
|
||||||
@@ -112,7 +113,7 @@ export function Node({ id, highlight, nextIds, skeleton }: NodeProps) {
|
|||||||
</Text>
|
</Text>
|
||||||
<Text color="gray" size="1" wrap="nowrap">
|
<Text color="gray" size="1" wrap="nowrap">
|
||||||
<Flex gap="1" align="center">
|
<Flex gap="1" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
alt="Silver"
|
alt="Silver"
|
||||||
src={alias("api", "/icons/currencies/silver.webp")}
|
src={alias("api", "/icons/currencies/silver.webp")}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useLocale } from "../../../hooks/useLocale";
|
|||||||
import { Duel } from "../../../stores/duel";
|
import { Duel } from "../../../stores/duel";
|
||||||
import { Tankopedia } from "../../../stores/tankopedia";
|
import { Tankopedia } from "../../../stores/tankopedia";
|
||||||
import type { MaybeSkeletonComponentProps } from "../../../types/maybeSkeletonComponentProps";
|
import type { MaybeSkeletonComponentProps } from "../../../types/maybeSkeletonComponentProps";
|
||||||
|
import { LazyImage } from "../../LazyImage";
|
||||||
import { Arrow } from "./components/Arrow";
|
import { Arrow } from "./components/Arrow";
|
||||||
import { Node } from "./components/Node";
|
import { Node } from "./components/Node";
|
||||||
|
|
||||||
@@ -104,7 +105,7 @@ export function TechTreeSection({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
<Flex gap="4" align="center">
|
<Flex gap="4" align="center">
|
||||||
<Text color="gray" wrap="nowrap">
|
<Text color="gray" wrap="nowrap">
|
||||||
<Flex gap="1" align="center">
|
<Flex gap="1" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
alt="XP"
|
alt="XP"
|
||||||
src={alias("api", "/icons/currencies/xp.webp")}
|
src={alias("api", "/icons/currencies/xp.webp")}
|
||||||
style={{
|
style={{
|
||||||
@@ -120,7 +121,7 @@ export function TechTreeSection({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
|
|
||||||
<Text color="gray" wrap="nowrap">
|
<Text color="gray" wrap="nowrap">
|
||||||
<Flex gap="1" align="center">
|
<Flex gap="1" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
alt="Silver"
|
alt="Silver"
|
||||||
src={alias("api", "/icons/currencies/silver.webp")}
|
src={alias("api", "/icons/currencies/silver.webp")}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { EqualIcon } from "../EqualIcon";
|
|||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
|
||||||
import { Discriminator } from "../Discriminator";
|
import { Discriminator } from "../Discriminator";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
@@ -84,7 +85,7 @@ export function TankopediaAntagonistControl({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias("api", "/icons/modules/gun.webp")}
|
src={alias("api", "/icons/modules/gun.webp")}
|
||||||
/>
|
/>
|
||||||
@@ -119,7 +120,7 @@ export function TankopediaAntagonistControl({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias("api", `/icons/shells/${thisShell.icon}.webp`)}
|
src={alias("api", `/icons/shells/${thisShell.icon}.webp`)}
|
||||||
/>
|
/>
|
||||||
@@ -154,7 +155,7 @@ export function TankopediaAntagonistControl({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={strings.tanks.antagonist_control.calibrated_shells}
|
alt={strings.tanks.antagonist_control.calibrated_shells}
|
||||||
src={alias("api", "/icons/equipment/103.webp")}
|
src={alias("api", "/icons/equipment/103.webp")}
|
||||||
/>
|
/>
|
||||||
@@ -183,7 +184,7 @@ export function TankopediaAntagonistControl({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={strings.tanks.antagonist_control.enhanced_armor}
|
alt={strings.tanks.antagonist_control.enhanced_armor}
|
||||||
src={alias("api", "/icons/equipment/110.webp")}
|
src={alias("api", "/icons/equipment/110.webp")}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -102,7 +102,10 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.bar {
|
.bar {
|
||||||
|
width: var(--ranking-progress);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
background-color: var(--ranking-color);
|
||||||
transition-duration: var(--duration-brief);
|
transition-duration: var(--duration-brief);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { romanize } from "@blitzkit/core";
|
|||||||
import { literals } from "@blitzkit/i18n/src/literals";
|
import { literals } from "@blitzkit/i18n/src/literals";
|
||||||
import { Fragment, useRef } from "react";
|
import { Fragment, useRef } from "react";
|
||||||
import { characteristicsGroups } from "../../config/characteristicsGroups";
|
import { characteristicsGroups } from "../../config/characteristicsGroups";
|
||||||
|
import { RANKING_STEPS } from "../../config/rankings";
|
||||||
import { toys } from "../../config/toys";
|
import { toys } from "../../config/toys";
|
||||||
import { useDuelModules } from "../../hooks/useDuelModules";
|
import { useDuelModules } from "../../hooks/useDuelModules";
|
||||||
import { useRankings } from "../../hooks/useRankings";
|
import { useRankings } from "../../hooks/useRankings";
|
||||||
@@ -249,40 +250,19 @@ function CompareOptions() {
|
|||||||
|
|
||||||
// Unranked items get a full neutral bar
|
// Unranked items get a full neutral bar
|
||||||
function BarStub() {
|
function BarStub() {
|
||||||
return (
|
return <div className={styles["bar-wrapper"]} />;
|
||||||
<div className={styles["bar-wrapper"]}>
|
|
||||||
<div
|
|
||||||
className={styles.bar}
|
|
||||||
style={{ backgroundColor: "var(--gray-3)", width: "100%" }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BarProps {
|
interface BarProps {
|
||||||
value: number;
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const barColors = ["red", "orange", "amber", "jade"];
|
|
||||||
|
|
||||||
function Bar({ value }: BarProps) {
|
function Bar({ value }: BarProps) {
|
||||||
const index = (barColors.length - 1) * value;
|
|
||||||
const iA = Math.floor(index);
|
|
||||||
const iB = Math.ceil(index);
|
|
||||||
const A = barColors[iA];
|
|
||||||
const B = barColors[iB];
|
|
||||||
const x = index % 1;
|
|
||||||
const p = (1 - x) * 100;
|
|
||||||
const v = 7;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles["bar-wrapper"]}>
|
<div className={styles["bar-wrapper"]}>
|
||||||
<div
|
<div
|
||||||
className={styles.bar}
|
className={styles.bar}
|
||||||
style={{
|
data-ranking={Math.round(value * RANKING_STEPS)}
|
||||||
backgroundColor: `color-mix(in srgb, var(--${A}-${v}) ${p}%, var(--${B}-${v}))`,
|
|
||||||
width: `${value * 100}%`,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useDuelModules } from "../../hooks/useDuelModules";
|
|||||||
import { useStrings } from "../../hooks/useStrings";
|
import { useStrings } from "../../hooks/useStrings";
|
||||||
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
import { useUnwrapper } from "../../hooks/useUnwrapper";
|
||||||
import { Heading } from "../Heading";
|
import { Heading } from "../Heading";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ export function TankopediaGameModeAbilities() {
|
|||||||
function Ability({ icon, name }: { icon: string; name: string }) {
|
function Ability({ icon, name }: { icon: string; name: string }) {
|
||||||
return (
|
return (
|
||||||
<Text lowContrast className={styles.ability}>
|
<Text lowContrast className={styles.ability}>
|
||||||
<img src={icon} alt={name} />
|
<LazyImage src={icon} alt={name} />
|
||||||
{name}
|
{name}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-1
@@ -3,6 +3,7 @@ import { IconButton } from "@radix-ui/themes";
|
|||||||
import { Duel } from "../../../../../../stores/duel";
|
import { Duel } from "../../../../../../stores/duel";
|
||||||
import { useArmor } from "../../../hooks/useArmor";
|
import { useArmor } from "../../../hooks/useArmor";
|
||||||
import { Tankopedia } from "../../../stores/tankopedia";
|
import { Tankopedia } from "../../../stores/tankopedia";
|
||||||
|
import { LazyImage } from "../../LazyImage";
|
||||||
|
|
||||||
export function DynamicArmorSwitcher() {
|
export function DynamicArmorSwitcher() {
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
@@ -36,7 +37,7 @@ export function DynamicArmorSwitcher() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt="Dynamic Armor"
|
alt="Dynamic Armor"
|
||||||
src={alias("api", "/icons/consumables/73.webp")}
|
src={alias("api", "/icons/consumables/73.webp")}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Duel } from "../../../../../../stores/duel";
|
|||||||
import { SPALL_LINER_PROVISION_ID } from "../../../core/blitzkit/spallLiner";
|
import { SPALL_LINER_PROVISION_ID } from "../../../core/blitzkit/spallLiner";
|
||||||
import { useLocale } from "../../../hooks/useLocale";
|
import { useLocale } from "../../../hooks/useLocale";
|
||||||
import { Tankopedia } from "../../../stores/tankopedia";
|
import { Tankopedia } from "../../../stores/tankopedia";
|
||||||
|
import { LazyImage } from "../../LazyImage";
|
||||||
|
|
||||||
const provisionDefinitions = await api.provisionDefinitions();
|
const provisionDefinitions = await api.provisionDefinitions();
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ export function SpallLinerSwitcher() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(
|
alt={unwrap(
|
||||||
provisionDefinitions.provisions[SPALL_LINER_PROVISION_ID].name!,
|
provisionDefinitions.provisions[SPALL_LINER_PROVISION_ID].name!,
|
||||||
)}
|
)}
|
||||||
@@ -83,7 +84,7 @@ export function SpallLinerSwitcher() {
|
|||||||
|
|
||||||
<Popover.Content>
|
<Popover.Content>
|
||||||
<Flex gap="2" align="center">
|
<Flex gap="2" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(
|
alt={unwrap(
|
||||||
provisionDefinitions.provisions[SPALL_LINER_PROVISION_ID].name!,
|
provisionDefinitions.provisions[SPALL_LINER_PROVISION_ID].name!,
|
||||||
)}
|
)}
|
||||||
@@ -109,7 +110,7 @@ export function SpallLinerSwitcher() {
|
|||||||
radius="medium"
|
radius="medium"
|
||||||
onClick={() => equip(id)}
|
onClick={() => equip(id)}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
alt={unwrap(provisionDefinitions.provisions[id].name!)}
|
alt={unwrap(provisionDefinitions.provisions[id].name!)}
|
||||||
src={alias("api", `/icons/provisions/${id}.webp`)}
|
src={alias("api", `/icons/provisions/${id}.webp`)}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Tankopedia } from "../../stores/tankopedia";
|
import { Tankopedia } from "../../stores/tankopedia";
|
||||||
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { SegmentedControl } from "../SegmentedControl";
|
import { SegmentedControl } from "../SegmentedControl";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -119,18 +120,18 @@ export function TankopediaOptions() {
|
|||||||
value={`${requestedDisplay}`}
|
value={`${requestedDisplay}`}
|
||||||
options={[
|
options={[
|
||||||
{
|
{
|
||||||
label: <img src="/assets/images/icons/tankopedia-model.png" />,
|
label: <LazyImage src="/assets/images/icons/tankopedia-model.png" />,
|
||||||
value: `${TankopediaDisplay.Model}`,
|
value: `${TankopediaDisplay.Model}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: (
|
label: (
|
||||||
<img src="/assets/images/icons/tankopedia-dynamic-armor.png" />
|
<LazyImage src="/assets/images/icons/tankopedia-dynamic-armor.png" />
|
||||||
),
|
),
|
||||||
value: `${TankopediaDisplay.DynamicArmor}`,
|
value: `${TankopediaDisplay.DynamicArmor}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: (
|
label: (
|
||||||
<img src="/assets/images/icons/tankopedia-static-armor.png" />
|
<LazyImage src="/assets/images/icons/tankopedia-static-armor.png" />
|
||||||
),
|
),
|
||||||
value: `${TankopediaDisplay.StaticArmor}`,
|
value: `${TankopediaDisplay.StaticArmor}`,
|
||||||
},
|
},
|
||||||
@@ -155,7 +156,7 @@ export function TankopediaOptions() {
|
|||||||
<SegmentedControl.Item value={`${TankopediaDisplay.DynamicArmor}`}>
|
<SegmentedControl.Item value={`${TankopediaDisplay.DynamicArmor}`}>
|
||||||
<Tooltip tooltip={strings.tanks.tabs.dynamic_armor}>
|
<Tooltip tooltip={strings.tanks.tabs.dynamic_armor}>
|
||||||
<div height="100%" align="center">
|
<div height="100%" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
src="/assets/images/icons/tankopedia-dynamic-armor.png"
|
src="/assets/images/icons/tankopedia-dynamic-armor.png"
|
||||||
style={{ height: "1.25em" }}
|
style={{ height: "1.25em" }}
|
||||||
/>
|
/>
|
||||||
@@ -165,7 +166,7 @@ export function TankopediaOptions() {
|
|||||||
<SegmentedControl.Item value={`${TankopediaDisplay.StaticArmor}`}>
|
<SegmentedControl.Item value={`${TankopediaDisplay.StaticArmor}`}>
|
||||||
<Tooltip tooltip={strings.tanks.tabs.model}>
|
<Tooltip tooltip={strings.tanks.tabs.model}>
|
||||||
<div height="100%" align="center">
|
<div height="100%" align="center">
|
||||||
<img
|
<LazyImage
|
||||||
src="/assets/images/icons/tankopedia-static-armor.png"
|
src="/assets/images/icons/tankopedia-static-armor.png"
|
||||||
style={{ height: "1.25em" }}
|
style={{ height: "1.25em" }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { ComponentProps } from "react";
|
|||||||
import { classNames } from "../../ui/classNames";
|
import { classNames } from "../../ui/classNames";
|
||||||
import type { ButtonProps } from "../Button";
|
import type { ButtonProps } from "../Button";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
type SidebarIconButtonProps = ButtonProps & {
|
type SidebarIconButtonProps = ButtonProps & {
|
||||||
@@ -37,7 +38,7 @@ export function SidebarIconButton({
|
|||||||
size="major"
|
size="major"
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<img alt={alt} src={src} />
|
<LazyImage alt={alt} src={src} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import { useUnwrapper } from "../../hooks/useUnwrapper";
|
|||||||
import { Tankopedia } from "../../stores/tankopedia";
|
import { Tankopedia } from "../../stores/tankopedia";
|
||||||
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
|
||||||
import { IconButton } from "../IconButton";
|
import { IconButton } from "../IconButton";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { Tooltip } from "../Tooltip";
|
import { Tooltip } from "../Tooltip";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ export function TankopediaSkinSwitcher() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img
|
<LazyImage
|
||||||
className={styles["camouflage-icon"]}
|
className={styles["camouflage-icon"]}
|
||||||
alt={name}
|
alt={name}
|
||||||
src={alias(
|
src={alias(
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import type { ComputedCharacteristics } from "../../types/characteristics";
|
|||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
import { Checkbox } from "../Checkbox";
|
import { Checkbox } from "../Checkbox";
|
||||||
import { Code } from "../Code";
|
import { Code } from "../Code";
|
||||||
|
import { LazyImage } from "../LazyImage";
|
||||||
import { SegmentedControl } from "../SegmentedControl";
|
import { SegmentedControl } from "../SegmentedControl";
|
||||||
import { Slider } from "../Slider";
|
import { Slider } from "../Slider";
|
||||||
import { ShellBorder } from "../Tankopedia/CharacteristicsSection/components/Characteristics/components/ReloadVisualizer/components/ShellBorder";
|
import { ShellBorder } from "../Tankopedia/CharacteristicsSection/components/Characteristics/components/ReloadVisualizer/components/ShellBorder";
|
||||||
@@ -101,7 +102,7 @@ export function RicochetToy({ characteristics }: ToyProps) {
|
|||||||
>
|
>
|
||||||
<div className={styles.extension} />
|
<div className={styles.extension} />
|
||||||
<div className={styles.line} />
|
<div className={styles.line} />
|
||||||
<img
|
<LazyImage
|
||||||
className={styles.shell}
|
className={styles.shell}
|
||||||
src={alias("api", `/icons/shells/${protagonist.shell.icon}.webp`)}
|
src={alias("api", `/icons/shells/${protagonist.shell.icon}.webp`)}
|
||||||
/>
|
/>
|
||||||
@@ -269,14 +270,14 @@ export function TraverseToy({ characteristics }: TraverseToyProps) {
|
|||||||
return (
|
return (
|
||||||
<div className={styles.traverse}>
|
<div className={styles.traverse}>
|
||||||
<div ref={hull} className={styles.hull} data-turretless={isTurretless}>
|
<div ref={hull} className={styles.hull} data-turretless={isTurretless}>
|
||||||
<img
|
<LazyImage
|
||||||
draggable="false"
|
draggable="false"
|
||||||
className={styles.image}
|
className={styles.image}
|
||||||
src={`/media/toys/hull${isTurretless ? "-only" : ""}.png`}
|
src={`/media/toys/hull${isTurretless ? "-only" : ""}.png`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{!isTurretless && (
|
{!isTurretless && (
|
||||||
<img
|
<LazyImage
|
||||||
draggable="false"
|
draggable="false"
|
||||||
ref={turret}
|
ref={turret}
|
||||||
className={styles.turret}
|
className={styles.turret}
|
||||||
@@ -520,7 +521,7 @@ export function ReloadToy({ characteristics }: ToyProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<img
|
<LazyImage
|
||||||
className={styles.caret}
|
className={styles.caret}
|
||||||
src="/assets/images/tankopedia/visualizers/reload/caret.png"
|
src="/assets/images/tankopedia/visualizers/reload/caret.png"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.text {
|
.text {
|
||||||
&[data-size="regular"] {
|
&:not([data-size]) {
|
||||||
font-size: var(--font-size-regular);
|
font-size: var(--font-size-regular);
|
||||||
}
|
}
|
||||||
&[data-size="minor"] {
|
&[data-size="minor"] {
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ export function Text({
|
|||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
className={classNames(styles.text, className)}
|
className={classNames(styles.text, className)}
|
||||||
data-low-contrast={lowContrast}
|
data-low-contrast={lowContrast || undefined}
|
||||||
data-size={size}
|
data-size={size === "regular" ? undefined : size}
|
||||||
data-weight={weight}
|
data-weight={weight}
|
||||||
data-align={align === "left" ? undefined : align}
|
data-align={align === "left" ? undefined : align}
|
||||||
style={{ color: `var(--${scale}-${power})` }}
|
style={{ color: `var(--${scale}-${power})` }}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-controlled="false"]:hover .text,
|
&:not([data-controlled]):hover .text,
|
||||||
.text[data-open="true"] {
|
.text[data-open="true"] {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export function Tooltip({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.tooltip, className)}
|
className={classNames(styles.tooltip, className)}
|
||||||
data-controlled={open !== undefined}
|
data-controlled={open !== undefined || undefined}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<div className={styles.text} data-side={side} data-open={open}>
|
<div className={styles.text} data-side={side} data-open={open}>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export const RANKING_STEPS = 2 ** 4;
|
||||||
|
|
||||||
|
// Worst to best, blended across the steps
|
||||||
|
export const RANKING_COLORS = ["red", "orange", "amber", "jade"] as const;
|
||||||
@@ -19,3 +19,11 @@ export const weights = {
|
|||||||
bold: 700,
|
bold: 700,
|
||||||
black: 900,
|
black: 900,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const COLOR_SCALE_LENGTH = 12;
|
||||||
|
|
||||||
|
export const COLORS_ALPHA_ONLY = ["black", "white"] as const;
|
||||||
|
export type AlphaOnlyColor = (typeof COLORS_ALPHA_ONLY)[number];
|
||||||
|
|
||||||
|
export const COLOR_ALIASES = ["gray", "accent"] as const;
|
||||||
|
export type ColorAlias = (typeof COLOR_ALIASES)[number];
|
||||||
@@ -26,17 +26,13 @@ const tool = tools.tanks;
|
|||||||
<SystemTheme />
|
<SystemTheme />
|
||||||
|
|
||||||
<ColorScale color="mauve" />
|
<ColorScale color="mauve" />
|
||||||
<ColorScale color="mauve" alpha />
|
|
||||||
<ColorAlias color="mauve" alias="gray" />
|
<ColorAlias color="mauve" alias="gray" />
|
||||||
<ColorAlias color="mauve" alpha alias="gray" />
|
|
||||||
|
|
||||||
<ColorScale color="black" alpha />
|
<ColorScale color="black" />
|
||||||
<ColorScale color="white" alpha />
|
<ColorScale color="white" />
|
||||||
|
|
||||||
<ColorScale color={accent} />
|
<ColorScale color={accent} />
|
||||||
<ColorScale color={accent} alpha />
|
|
||||||
<ColorAlias color={accent} alias="accent" />
|
<ColorAlias color={accent} alias="accent" />
|
||||||
<ColorAlias color={accent} alpha alias="accent" />
|
|
||||||
|
|
||||||
<BaseStyles />
|
<BaseStyles />
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,13 @@ const { locale } = Astro.props;
|
|||||||
<BaseMeta />
|
<BaseMeta />
|
||||||
|
|
||||||
<ColorScale color="mauve" />
|
<ColorScale color="mauve" />
|
||||||
<ColorScale color="mauve" alpha />
|
|
||||||
<ColorAlias color="mauve" alias="gray" />
|
<ColorAlias color="mauve" alias="gray" />
|
||||||
<ColorAlias color="mauve" alpha alias="gray" />
|
|
||||||
|
|
||||||
<ColorScale color="black" alpha />
|
<ColorScale color="black" />
|
||||||
<ColorScale color="white" alpha />
|
<ColorScale color="white" />
|
||||||
|
|
||||||
<ColorScale color="indigo" />
|
<ColorScale color="indigo" />
|
||||||
<ColorScale color="indigo" alpha />
|
|
||||||
<ColorAlias color="indigo" alias="accent" />
|
<ColorAlias color="indigo" alias="accent" />
|
||||||
<ColorAlias color="indigo" alpha alias="accent" />
|
|
||||||
|
|
||||||
<BaseStyles />
|
<BaseStyles />
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -10,10 +10,8 @@ const { locale } = Astro.props;
|
|||||||
|
|
||||||
<BaseLayout accent="pink" {locale}>
|
<BaseLayout accent="pink" {locale}>
|
||||||
<ColorScale color="red" />
|
<ColorScale color="red" />
|
||||||
<ColorScale color="red" alpha />
|
|
||||||
<ColorScale color="jade" />
|
<ColorScale color="jade" />
|
||||||
<ColorScale color="amber" />
|
<ColorScale color="amber" />
|
||||||
<ColorScale color="amber" alpha />
|
|
||||||
<ColorScale color="blue" />
|
<ColorScale color="blue" />
|
||||||
|
|
||||||
<Page {locale} client:load />
|
<Page {locale} client:load />
|
||||||
|
|||||||
@@ -17,106 +17,97 @@ const extraColors = ["red", "amber", "green"] satisfies Color[];
|
|||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout accent="blue" {locale}>
|
<BaseLayout accent="blue" {locale}>
|
||||||
{
|
{extraColors.map((color) => (
|
||||||
extraColors.map((color) => (
|
<ColorScale {color} />
|
||||||
<>
|
))}
|
||||||
<ColorScale {color} />
|
|
||||||
<ColorScale {color} alpha />
|
|
||||||
</>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<h1>Badge</h1>
|
<h1>Badge</h1>
|
||||||
|
|
||||||
{
|
{sizes.map((size) => (
|
||||||
sizes.map((size) => (
|
<section>
|
||||||
<section>
|
<h2>size="{size}"</h2>
|
||||||
<h2>size="{size}"</h2>
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th />
|
<th />
|
||||||
{variants.map((variant) => (
|
|
||||||
<th>{variant}</th>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
{colors.map((color) => (
|
|
||||||
<tr>
|
|
||||||
<th>{color ?? "accent"}</th>
|
|
||||||
{variants.map((variant) => (
|
|
||||||
<td>
|
|
||||||
<Badge {color} {variant} {size}>
|
|
||||||
Badge
|
|
||||||
</Badge>
|
|
||||||
</td>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</section>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
sizes.map((size) => (
|
|
||||||
<section>
|
|
||||||
<h2>size="{size}" with icons</h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th />
|
|
||||||
{iconLayouts.map((layout) => (
|
|
||||||
<th>{layout}</th>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
{variants.map((variant) => (
|
{variants.map((variant) => (
|
||||||
<tr>
|
<th>{variant}</th>
|
||||||
<th>{variant}</th>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<Badge {variant} {size}>
|
|
||||||
<StarFilledIcon />
|
|
||||||
Badge
|
|
||||||
</Badge>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<Badge {variant} {size}>
|
|
||||||
Badge
|
|
||||||
<CheckIcon />
|
|
||||||
</Badge>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<Badge {variant} {size}>
|
|
||||||
<StarFilledIcon />
|
|
||||||
Badge
|
|
||||||
<CheckIcon />
|
|
||||||
</Badge>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<Badge {variant} {size}>
|
|
||||||
<StarFilledIcon />
|
|
||||||
</Badge>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</thead>
|
||||||
</section>
|
|
||||||
))
|
<tbody>
|
||||||
}
|
{colors.map((color) => (
|
||||||
|
<tr>
|
||||||
|
<th>{color ?? "accent"}</th>
|
||||||
|
{variants.map((variant) => (
|
||||||
|
<td>
|
||||||
|
<Badge {color} {variant} {size}>
|
||||||
|
Badge
|
||||||
|
</Badge>
|
||||||
|
</td>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{sizes.map((size) => (
|
||||||
|
<section>
|
||||||
|
<h2>size="{size}" with icons</h2>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th />
|
||||||
|
{iconLayouts.map((layout) => (
|
||||||
|
<th>{layout}</th>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{variants.map((variant) => (
|
||||||
|
<tr>
|
||||||
|
<th>{variant}</th>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Badge {variant} {size}>
|
||||||
|
<StarFilledIcon />
|
||||||
|
Badge
|
||||||
|
</Badge>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Badge {variant} {size}>
|
||||||
|
Badge
|
||||||
|
<CheckIcon />
|
||||||
|
</Badge>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Badge {variant} {size}>
|
||||||
|
<StarFilledIcon />
|
||||||
|
Badge
|
||||||
|
<CheckIcon />
|
||||||
|
</Badge>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Badge {variant} {size}>
|
||||||
|
<StarFilledIcon />
|
||||||
|
</Badge>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
import "@radix-ui/colors/violet-dark.css";
|
|
||||||
import { api } from "../../../../../api/dynamic";
|
import { api } from "../../../../../api/dynamic";
|
||||||
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
|
import { mixStaticPaths } from "../../../../../astro/mixStaticPaths";
|
||||||
import ColorScale from "../../../../../components/ColorScale.astro";
|
import ColorScale from "../../../../../components/ColorScale.astro";
|
||||||
|
import ColorRanks from "../../../../../components/ColorRanks.astro";
|
||||||
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
import BaseLayout from "../../../../../layouts/BaseLayout.astro";
|
||||||
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
import { getStaticPaths as _getStaticPaths } from "../index.astro";
|
||||||
import { Page } from "./_index";
|
import { Page } from "./_index";
|
||||||
@@ -20,15 +20,10 @@ const { id, locale } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout {locale} accent="violet">
|
<BaseLayout {locale} accent="violet">
|
||||||
<ColorScale color="amber" alpha />
|
<ColorScale color="ruby" />
|
||||||
<ColorScale color="red" />
|
<ColorScale color="cyan" />
|
||||||
<ColorScale color="ruby" alpha />
|
|
||||||
<ColorScale color="orange" />
|
|
||||||
<ColorScale color="amber" />
|
|
||||||
<ColorScale color="jade" />
|
|
||||||
<ColorScale color="jade" alpha />
|
|
||||||
<ColorScale color="cyan" alpha />
|
|
||||||
<ColorScale color="green" />
|
<ColorScale color="green" />
|
||||||
|
<ColorRanks />
|
||||||
|
|
||||||
<Page {id} {locale} client:load />
|
<Page {id} {locale} client:load />
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
@@ -19,6 +19,7 @@ const { locale } = Astro.props;
|
|||||||
<ToolBanner {locale} tool={tools.tanks} />
|
<ToolBanner {locale} tool={tools.tanks} />
|
||||||
|
|
||||||
<Section>
|
<Section>
|
||||||
|
<!-- TODO: eliminate all client:only's -->
|
||||||
<Page {locale} client:only="react">
|
<Page {locale} client:only="react">
|
||||||
<Page {locale} skeleton slot="fallback" />
|
<Page {locale} skeleton slot="fallback" />
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import type { APIContext } from "astro";
|
||||||
|
import sharp from "sharp";
|
||||||
|
import { mixStaticPaths } from "../../astro/mixStaticPaths";
|
||||||
|
import { getStaticPaths as _getStaticPaths } from "./_index";
|
||||||
|
|
||||||
|
interface IconProps {
|
||||||
|
size: number;
|
||||||
|
background?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => [
|
||||||
|
{
|
||||||
|
params: { icon: "favicon" },
|
||||||
|
props: { size: 32 } satisfies IconProps,
|
||||||
|
},
|
||||||
|
|
||||||
|
// iOS fills transparency with black, so flatten onto white
|
||||||
|
{
|
||||||
|
params: { icon: "apple-touch-icon" },
|
||||||
|
props: { size: 180, background: "#fff" } satisfies IconProps,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
export async function GET({ props }: APIContext<IconProps>) {
|
||||||
|
let image = sharp("src/media/favicon.png").resize(props.size, props.size);
|
||||||
|
|
||||||
|
if (props.background) {
|
||||||
|
image = image.flatten({ background: props.background });
|
||||||
|
}
|
||||||
|
|
||||||
|
const buffer = await image.png().toBuffer();
|
||||||
|
const bytes = new Uint8Array(buffer);
|
||||||
|
|
||||||
|
return new Response(bytes);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { RANKING_COLORS, RANKING_STEPS } from "../../../config/rankings";
|
||||||
|
|
||||||
|
export { getStaticPaths } from "../_index";
|
||||||
|
|
||||||
|
const SEGMENTS = RANKING_COLORS.length - 1;
|
||||||
|
|
||||||
|
// Exposes the progress and blended color of each step to anything ranked
|
||||||
|
function stepStyles(step: number) {
|
||||||
|
const progress = step / RANKING_STEPS;
|
||||||
|
const position = progress * SEGMENTS;
|
||||||
|
const segment = Math.min(Math.floor(position), SEGMENTS);
|
||||||
|
const from = RANKING_COLORS[segment];
|
||||||
|
const to = RANKING_COLORS[Math.min(segment + 1, SEGMENTS)];
|
||||||
|
const weight = (1 - (position - segment)) * 100;
|
||||||
|
|
||||||
|
return `[data-ranking="${step}"]{--ranking-progress:${
|
||||||
|
progress * 100
|
||||||
|
}%;--ranking-color:color-mix(in srgb,var(--${from}-7) ${weight}%,var(--${to}-7));}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function GET() {
|
||||||
|
let styles = "";
|
||||||
|
|
||||||
|
for (let step = 0; step <= RANKING_STEPS; step++) {
|
||||||
|
styles += stepStyles(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response(styles);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import type { APIContext } from "astro";
|
||||||
|
import {
|
||||||
|
COLORS,
|
||||||
|
colorAliasStyles,
|
||||||
|
colorScaleStyles,
|
||||||
|
} from "../../../../astro/colorStyles";
|
||||||
|
import { mixStaticPaths } from "../../../../astro/mixStaticPaths";
|
||||||
|
import { COLORS_ALPHA_ONLY, COLOR_ALIASES } from "../../../../config/styles";
|
||||||
|
import { getStaticPaths as _getStaticPaths } from "../../_index";
|
||||||
|
|
||||||
|
interface ColorStylesProps {
|
||||||
|
styles: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function path(name: string, styles: string) {
|
||||||
|
return {
|
||||||
|
params: { name },
|
||||||
|
props: { styles } satisfies ColorStylesProps,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => [
|
||||||
|
...COLORS_ALPHA_ONLY.map((color) => path(color, colorScaleStyles(color))),
|
||||||
|
|
||||||
|
...COLORS.flatMap((color) => [
|
||||||
|
path(color, colorScaleStyles(color)),
|
||||||
|
|
||||||
|
...COLOR_ALIASES.map((alias) =>
|
||||||
|
path(`${color}-as-${alias}`, colorAliasStyles(color, alias)),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
export function GET({ props }: APIContext<ColorStylesProps>) {
|
||||||
|
return new Response(props.styles);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user