mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: some cleanup
This commit is contained in:
1 parent
ea048da7a2
commit
ade238966b
7 files changed
+37
-32
No files matched your search
@@ -863,6 +863,7 @@
|
|||||||
"reset": "Reset",
|
"reset": "Reset",
|
||||||
"shuffle": "Shuffle",
|
"shuffle": "Shuffle",
|
||||||
"remove": "Remove played",
|
"remove": "Remove played",
|
||||||
|
"tracking": "BlitzKit is tracking your playlist",
|
||||||
|
|
||||||
"sort": {
|
"sort": {
|
||||||
"button": "Sort by",
|
"button": "Sort by",
|
||||||
@@ -879,6 +880,7 @@
|
|||||||
"unrecorded": "--",
|
"unrecorded": "--",
|
||||||
"wins": "Wins"
|
"wins": "Wins"
|
||||||
},
|
},
|
||||||
|
|
||||||
"no_login_warning": "You are not logged in. BlitzKit will not keep track of your played tanks.",
|
"no_login_warning": "You are not logged in. BlitzKit will not keep track of your played tanks.",
|
||||||
"generate": "Generate playlist",
|
"generate": "Generate playlist",
|
||||||
"name": "Playlist",
|
"name": "Playlist",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fisherYates } from "@blitzkit/core";
|
import { fisherYates } from "@blitzkit/core";
|
||||||
import { CaretDownIcon } from "@radix-ui/react-icons";
|
import { CaretDownIcon } from "@radix-ui/react-icons";
|
||||||
import { Button, DropdownMenu, Flex } from "@radix-ui/themes";
|
import { Button, DropdownMenu, Flex, Spinner } from "@radix-ui/themes";
|
||||||
import { useLocale } from "../hooks/useLocale";
|
import { useLocale } from "../hooks/useLocale";
|
||||||
import { App } from "../stores/app";
|
import { App } from "../stores/app";
|
||||||
import { Playlist } from "../stores/playlist";
|
import { Playlist } from "../stores/playlist";
|
||||||
@@ -10,8 +10,10 @@ export function PlaylistActions() {
|
|||||||
const wargaming = App.use((state) => state.logins.wargaming);
|
const wargaming = App.use((state) => state.logins.wargaming);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Flex gap="2">
|
<Flex gap="2">
|
||||||
<Button
|
<Button
|
||||||
|
size={{ initial: "1", xs: "2" }}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
color="red"
|
color="red"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -24,6 +26,7 @@ export function PlaylistActions() {
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
size={{ initial: "1", xs: "2" }}
|
||||||
variant={wargaming ? "outline" : undefined}
|
variant={wargaming ? "outline" : undefined}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Playlist.mutate((draft) => {
|
Playlist.mutate((draft) => {
|
||||||
@@ -37,6 +40,7 @@ export function PlaylistActions() {
|
|||||||
{wargaming && (
|
{wargaming && (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
|
size={{ initial: "1", xs: "2" }}
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Playlist.mutate((draft) => {
|
Playlist.mutate((draft) => {
|
||||||
@@ -54,7 +58,7 @@ export function PlaylistActions() {
|
|||||||
|
|
||||||
<DropdownMenu.Root>
|
<DropdownMenu.Root>
|
||||||
<DropdownMenu.Trigger>
|
<DropdownMenu.Trigger>
|
||||||
<Button>
|
<Button size={{ initial: "1", xs: "2" }}>
|
||||||
{strings.website.tools.playlist.sort.button}
|
{strings.website.tools.playlist.sort.button}
|
||||||
<CaretDownIcon />
|
<CaretDownIcon />
|
||||||
</Button>
|
</Button>
|
||||||
@@ -76,7 +80,8 @@ export function PlaylistActions() {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
Playlist.mutate((draft) => {
|
Playlist.mutate((draft) => {
|
||||||
draft.list = draft.list?.sort(
|
draft.list = draft.list?.sort(
|
||||||
(a, b) => (a.then?.battles ?? 0) - (b.then?.battles ?? 0)
|
(a, b) =>
|
||||||
|
(a.then?.battles ?? 0) - (b.then?.battles ?? 0)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
@@ -88,5 +93,13 @@ export function PlaylistActions() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
{wargaming && (
|
||||||
|
<Flex gap="2" align="center">
|
||||||
|
<Spinner />
|
||||||
|
{strings.website.tools.playlist.tracking}
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ export function PlaylistTable() {
|
|||||||
height: "100%",
|
height: "100%",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
}}
|
}}
|
||||||
variant="surface"
|
variant="surface"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export const PlaylistTankEntry = memo<Props>(
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
size="3"
|
||||||
variant="classic"
|
variant="classic"
|
||||||
checked={
|
checked={
|
||||||
(checked === undefined &&
|
(checked === undefined &&
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ export function StickyRowHeaderCell({ style, ...props }: RowHeaderCellProps) {
|
|||||||
return (
|
return (
|
||||||
<Table.RowHeaderCell
|
<Table.RowHeaderCell
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
|
||||||
position: "sticky",
|
position: "sticky",
|
||||||
left: 0,
|
left: 0,
|
||||||
backgroundColor: "var(--color-panel)",
|
backgroundColor: "var(--color-panel)",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { type TankDefinition, tankIcon, TankType } from "@blitzkit/core";
|
import { type TankDefinition, tankIcon, TankType } from "@blitzkit/core";
|
||||||
|
import { Box, Flex } from "@radix-ui/themes";
|
||||||
import { useLocale } from "../hooks/useLocale";
|
import { useLocale } from "../hooks/useLocale";
|
||||||
import { classIcons } from "./ClassIcon";
|
import { classIcons } from "./ClassIcon";
|
||||||
import { ExperimentIcon } from "./ExperimentIcon";
|
import { ExperimentIcon } from "./ExperimentIcon";
|
||||||
@@ -15,20 +16,6 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<StickyRowHeaderCell style={{ overflow: "hidden" }}>
|
<StickyRowHeaderCell style={{ overflow: "hidden" }}>
|
||||||
<LinkI18n locale={locale} href={`/tanks/${tank.slug}`} tabIndex={-1}>
|
|
||||||
<img
|
|
||||||
alt={unwrap(tank.name)}
|
|
||||||
draggable={false}
|
|
||||||
src={tankIcon(tank.id)}
|
|
||||||
style={{
|
|
||||||
margin: "calc(-1 * var(--table-cell-padding)) 0",
|
|
||||||
height: "calc(100% + 2 * var(--table-cell-padding))",
|
|
||||||
aspectRatio: "4 / 3",
|
|
||||||
objectFit: "cover",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</LinkI18n>
|
|
||||||
|
|
||||||
<LinkI18n
|
<LinkI18n
|
||||||
locale={locale}
|
locale={locale}
|
||||||
color={
|
color={
|
||||||
@@ -42,17 +29,22 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
|
|||||||
underline="hover"
|
underline="hover"
|
||||||
wrap="nowrap"
|
wrap="nowrap"
|
||||||
href={`/tanks/${tank.slug}`}
|
href={`/tanks/${tank.slug}`}
|
||||||
style={{
|
style={{ height: "100%" }}
|
||||||
paddingLeft: "var(--space-2)",
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
gap: "var(--space-1)",
|
|
||||||
whiteSpace: "nowrap",
|
|
||||||
overflow: "hidden",
|
|
||||||
textOverflow: "ellipsis",
|
|
||||||
}}
|
|
||||||
size={{ initial: "1", sm: "2" }}
|
size={{ initial: "1", sm: "2" }}
|
||||||
>
|
>
|
||||||
|
<Flex height="100%" align="center" gap="1">
|
||||||
|
<Box
|
||||||
|
draggable={false}
|
||||||
|
height="calc(100% + 2 * var(--table-cell-padding))"
|
||||||
|
style={{
|
||||||
|
aspectRatio: "4 / 3",
|
||||||
|
backgroundImage: `url(${tankIcon(tank.id)})`,
|
||||||
|
backgroundSize: "cover",
|
||||||
|
backgroundPosition: "center",
|
||||||
|
backgroundRepeat: "no-repeat",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<Icon
|
<Icon
|
||||||
width="1em"
|
width="1em"
|
||||||
height="1em"
|
height="1em"
|
||||||
@@ -64,6 +56,7 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{unwrap(tank.name)}
|
{unwrap(tank.name)}
|
||||||
|
</Flex>
|
||||||
</LinkI18n>
|
</LinkI18n>
|
||||||
</StickyRowHeaderCell>
|
</StickyRowHeaderCell>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
"jsxImportSource": "react",
|
"jsxImportSource": "react",
|
||||||
"types": [
|
"types": ["vite/client"]
|
||||||
"vite/client",
|
|
||||||
"vite-plugin-pwa/info.d.ts",
|
|
||||||
"vite-plugin-pwa/client.d.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user