update playlist

This commit is contained in:
tresabhi committed 2026-08-04 20:31:49 -05:00
1 parent 7630cc52d3
commit 36e8a20cd5
5 files changed
+23 -23

No files matched your search

@@ -12,7 +12,7 @@ import {
} from "@radix-ui/themes";
import { useMemo, useState } from "react";
import usePromise from "react-promise-suspense";
import { awaitableTankDefinitions } from "../core/awaitables/tankDefinitions";
import { api } from "../core/blitzkit/api";
import { filterTanks } from "../core/blitzkit/filterTanks";
import { generatePlaylist } from "../core/blitzkit/generatePlaylist";
import { useLocale } from "../hooks/useLocale";
@@ -22,7 +22,7 @@ import type { MaybeSkeletonComponentProps } from "../types/maybeSkeletonComponen
import { LinkI18n } from "./LinkI18n";
import { FilterControl } from "./TankSearch/components/FilterControl";
const tankDefinitions = await awaitableTankDefinitions;
const tankDefinitions = await api.tankDefinitions();
const POOL_HEIGHT = "16rem";
@@ -33,12 +33,12 @@ export function PlaylistGenerator({ skeleton }: MaybeSkeletonComponentProps) {
const filters = TankFilters.use();
const randomTankList = useMemo(
() => fisherYates(Object.values(tankDefinitions.tanks)),
[filters]
[filters],
);
const tanks = usePromise(
() => filterTanks(filters, randomTankList, wargaming?.id),
// react-promise-suspense has awful type annotations
[filters] as any
[filters] as any,
);
const tanksTrimmed = useMemo(() => tanks.slice(0, 65), [filters]);
@@ -58,7 +58,7 @@ export function PlaylistGenerator({ skeleton }: MaybeSkeletonComponentProps) {
{
count: tanks.length,
time: Math.round(tanks.length * ((2 * 4) / 60)),
}
},
)}
</AlertDialog.Description>
@@ -145,7 +145,7 @@ export function PlaylistGenerator({ skeleton }: MaybeSkeletonComponentProps) {
backgroundRepeat: "no-repeat",
}}
/>
)
),
)}
<Box
@@ -5,7 +5,7 @@ import {
} from "@radix-ui/react-icons";
import { Checkbox, Flex, IconButton, Table, Text } from "@radix-ui/themes";
import { memo } from "react";
import { awaitableTankDefinitions } from "../core/awaitables/tankDefinitions";
import { api } from "../core/blitzkit/api";
import { useLocale } from "../hooks/useLocale";
import { Playlist, type PlaylistEntry } from "../stores/playlist";
import { TankRowHeaderCell } from "./TankRowHeaderCell";
@@ -14,7 +14,7 @@ interface Props extends PlaylistEntry {
index: number;
}
const tankDefinitions = await awaitableTankDefinitions;
const tankDefinitions = await api.tankDefinitions();
export const PlaylistTankEntry = memo<Props>(
({ id, checked, then, now, index }) => {
@@ -93,7 +93,7 @@ export const PlaylistTankEntry = memo<Props>(
{now && now.last !== 0
? rtf.format(
Math.ceil((now.last - dateNow / 1000) / (60 * 60 * 24)),
"day"
"day",
)
: strings.website.tools.playlist.table.unrecorded}
</Table.Cell>
@@ -103,5 +103,5 @@ export const PlaylistTankEntry = memo<Props>(
(a, b) =>
a.checked === b.checked &&
a.then?.battles === b.then?.battles &&
a.index === b.index
a.index === b.index,
);