feat: shells

This commit is contained in:
TrèsAbhi committed 2025-12-18 16:45:02 -06:00
1 parent 4f1c4421e5
commit c6b7918525
5 files changed
+69 -27

No files matched your search

@@ -35,6 +35,8 @@ function Content({ id }: { id: string }) {
return (
<>
<h1>{id}</h1>
<div style={{ display: "flex", flexWrap: "wrap" }}>
{times(tank.upgrade_stages.length, (index) => (
<button
@@ -50,9 +52,27 @@ function Content({ id }: { id: string }) {
))}
</div>
<br />
<div style={{ display: "flex", flexWrap: "wrap" }}>
{parameters.shells_upgrades.map((shell) => (
<button
key={shell.shell_id}
onClick={() => {
Tankopedia.mutate((draft) => {
draft.protagonist.shell = shell.shell_id;
});
}}
>
Shell {shell.shell_id}{" "}
{shell.shell_id === protagonist.shell && "(selected)"}
</button>
))}
</div>
{characteristicsGroups.map(({ group, order }) => (
<>
<h2>{group}</h2>
<h2 key={group}>{group}</h2>
{order.map((entry) => {
if ("toy" in entry) {
@@ -64,12 +84,17 @@ function Content({ id }: { id: string }) {
let rendered: string | number = characteristic;
if (typeof rendered === "number") {
if (entry.decimals !== undefined)
rendered = rendered.toFixed(entry.decimals);
if (rendered === Infinity) {
rendered = "∞";
} else {
if (entry.decimals !== undefined) {
rendered = rendered.toFixed(entry.decimals);
}
}
}
return (
<p>
<p key={entry.name}>
{entry.name}: {rendered}
</p>
);
@@ -1,6 +1,7 @@
---
import type { GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
import BaseLayout from "../../../layouts/BaseLayout.astro";
import { Page } from "./_index";
export const getStaticPaths = (async () => {
@@ -15,4 +16,6 @@ export const getStaticPaths = (async () => {
const { id } = Astro.props;
---
<Page {id} client:load />
<BaseLayout>
<Page {id} client:load />
</BaseLayout>