diff --git a/packages/website/src/components/TankSearchDialog/index.module.css b/packages/website/src/components/TankSearchDialog/index.module.css
new file mode 100644
index 000000000..f70848c0a
--- /dev/null
+++ b/packages/website/src/components/TankSearchDialog/index.module.css
@@ -0,0 +1,3 @@
+.filters {
+ overflow-x: auto;
+}
diff --git a/packages/website/src/components/TankSearchDialog/index.tsx b/packages/website/src/components/TankSearchDialog/index.tsx
new file mode 100644
index 000000000..4bcb6bb5f
--- /dev/null
+++ b/packages/website/src/components/TankSearchDialog/index.tsx
@@ -0,0 +1,84 @@
+import type { TankDefinition } from "@blitzkit/protos";
+import { useCallback, useState, type ReactNode } from "react";
+import { useLocale } from "../../hooks/useLocale";
+import { useStrings } from "../../hooks/useStrings";
+import { Dialog } from "../Dialog";
+import { ScrollerCurtains } from "../ScrollerCurtains";
+import { TankSearchBar } from "../TankSearchBar";
+import { TankSearchFilters } from "../TankSearchFilters";
+import { TankSearchResults } from "../TankSearchResults";
+import styles from "./index.module.css";
+
+interface TankSearchDialogProps {
+ // the trigger, passed to Dialog.Trigger with asChild
+ children: ReactNode;
+ title?: string;
+ description?: string;
+ onSelect: (tank: TankDefinition) => void;
+ onSelectAll?: (tanks: TankDefinition[]) => void;
+}
+
+export function TankSearchDialog({
+ children,
+ title,
+ description,
+ onSelect,
+ onSelectAll,
+}: TankSearchDialogProps) {
+ const locale = useLocale();
+ const strings = useStrings();
+ const [open, setOpen] = useState(false);
+
+ const handleSelect = useCallback(
+ (tank: TankDefinition) => {
+ onSelect(tank);
+ setOpen(false);
+ },
+ [onSelect],
+ );
+
+ const handleSelectAll = useCallback(
+ (tanks: TankDefinition[]) => {
+ onSelectAll!(tanks);
+ setOpen(false);
+ },
+ [onSelectAll],
+ );
+
+ return (
+
+ {children}
+
+
+
+
+
+
+ {title ?? strings.website.common.tank_search.select_dialog_title}
+
+
+ {description && (
+ {description}
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/packages/website/src/components/TankopediaAntagonistControl/index.tsx b/packages/website/src/components/TankopediaAntagonistControl/index.tsx
index 52df011bc..5a7ab5525 100644
--- a/packages/website/src/components/TankopediaAntagonistControl/index.tsx
+++ b/packages/website/src/components/TankopediaAntagonistControl/index.tsx
@@ -1,6 +1,7 @@
import { alias, romanize, uniqueGuns } from "@blitzkit/core";
import { literals } from "@blitzkit/i18n";
-import { useMemo } from "react";
+import type { TankDefinition } from "@blitzkit/protos";
+import { useCallback, useMemo } from "react";
import { useAbsoluteDisplay } from "../../hooks/useAbsoluteDisplay";
import { useDuelModules } from "../../hooks/useDuelModules";
import { useEquipment } from "../../hooks/useEquipment";
@@ -8,12 +9,13 @@ import { useStrings } from "../../hooks/useStrings";
import { useUnwrapper } from "../../hooks/useUnwrapper";
import { Tankopedia } from "../../stores/tankopedia";
import { TankopediaDisplay } from "../../stores/tankopediaPersistent/constants";
+import { createTankState } from "../../tankopedia/createTankState";
import { CustomShellButton } from "../CustomShellButton";
import { EqualIcon } from "../EqualIcon";
import { IconButton } from "../IconButton";
-
import { Discriminator } from "../Discriminator";
import { LazyImage } from "../LazyImage";
+import { TankSearchDialog } from "../TankSearchDialog";
import { Text } from "../Text";
import { Tooltip } from "../Tooltip";
import styles from "./index.module.css";
@@ -49,6 +51,14 @@ export function TankopediaAntagonistControl({
const isVisible = showControls && isDynamicArmorDisplay;
+ const handleTankSelect = useCallback((tank: TankDefinition) => {
+ Tankopedia.mutate((draft) => {
+ draft.antagonist = createTankState(tank);
+ draft.shot = undefined;
+ draft.customShell = undefined;
+ });
+ }, []);
+
return (
@@ -57,6 +67,15 @@ export function TankopediaAntagonistControl({
})}
+
+
+
+
+
+
{antagonistUniqueGuns.length > 1 && (
{[...antagonistUniqueGuns].reverse().map((entry) => {
diff --git a/packages/website/src/components/TankopediaFullscreen/index.module.css b/packages/website/src/components/TankopediaFullscreen/index.module.css
index 2cfb2582a..64067467b 100644
--- a/packages/website/src/components/TankopediaFullscreen/index.module.css
+++ b/packages/website/src/components/TankopediaFullscreen/index.module.css
@@ -1,5 +1,4 @@
.fullscreen {
- position: absolute;
- right: var(--space-4);
- bottom: var(--space-4);
+ /* set before hydration by FullscreenSupport.astro */
+ display: var(--fullscreen-display, none);
}
diff --git a/packages/website/src/components/TankopediaFullscreen/index.tsx b/packages/website/src/components/TankopediaFullscreen/index.tsx
index d1d7df8ae..5af5e8c6d 100644
--- a/packages/website/src/components/TankopediaFullscreen/index.tsx
+++ b/packages/website/src/components/TankopediaFullscreen/index.tsx
@@ -8,7 +8,6 @@ interface TankopediaFullscreenProps {
}
export function TankopediaFullscreen({ target }: TankopediaFullscreenProps) {
- const [available, setAvailable] = useState(false);
const [isFullscreen, setIsFullscreen] = useState(false);
useEffect(() => {
@@ -16,7 +15,6 @@ export function TankopediaFullscreen({ target }: TankopediaFullscreenProps) {
setIsFullscreen(document.fullscreenElement === target.current);
}
- setAvailable(document.fullscreenEnabled);
document.addEventListener("fullscreenchange", handleFullscreenChange);
return () => {
@@ -32,8 +30,6 @@ export function TankopediaFullscreen({ target }: TankopediaFullscreenProps) {
}
}, [isFullscreen]);
- if (!available) return null;
-
return (
protagonistTank, import.meta.env.SSR);
const equalize = Tankopedia.use((state) => state.environment.equalize);
+ const showControls = Tankopedia.use((state) => state.showControls);
const mounted = useMounted();
const wrapper = useRef(null);
+ const canvas = useRef(null!);
const hasImprovedVerticalStabilizer = useEquipment("protagonist", 122);
const hasDownImprovedVerticalStabilizer = useEquipment("protagonist", 124);
@@ -191,6 +194,7 @@ function Sandbox({ id }: TankopediaSandboxProps) {
);
diff --git a/packages/website/src/layouts/BaseLayout.astro b/packages/website/src/layouts/BaseLayout.astro
index 703bfb2b1..84bc58f78 100644
--- a/packages/website/src/layouts/BaseLayout.astro
+++ b/packages/website/src/layouts/BaseLayout.astro
@@ -2,6 +2,7 @@
import AutoFocus from "../components/AutoFocus.astro";
import BaseMeta from "../components/BaseMeta.astro";
import BaseStyles from "../components/BaseStyles.astro";
+import FullscreenSupport from "../components/FullscreenSupport.astro";
import ColorAlias from "../components/ColorAlias.astro";
import ColorScale from "../components/ColorScale.astro";
import NavbarSmall from "../components/NavbarSmall.astro";
@@ -35,6 +36,7 @@ const { locale, accent, solidNavbar = false, tool } = Astro.props;
+