mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 04:29:50 +01:00
feat: action buttons
This commit is contained in:
1 parent
e1a6e4e38d
commit
222b690fba
5 files changed
+55
-15
No files matched your search
@@ -860,12 +860,16 @@
|
|||||||
|
|
||||||
"tools": {
|
"tools": {
|
||||||
"playlist": {
|
"playlist": {
|
||||||
"clear": "Clear",
|
"reset": "Reset",
|
||||||
|
"shuffle": "Shuffle",
|
||||||
|
"sort": "Sort by",
|
||||||
|
|
||||||
"table": {
|
"table": {
|
||||||
"index": "#",
|
"index": "#",
|
||||||
"never": "Never",
|
"never": "Never",
|
||||||
"tank": "Tank",
|
"tank": "Tank",
|
||||||
"last_played": "Last played"
|
"last_played": "Last played",
|
||||||
|
"battles": "Battles"
|
||||||
},
|
},
|
||||||
"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",
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { CaretDownIcon } from "@radix-ui/react-icons";
|
||||||
|
import { Button, Flex } from "@radix-ui/themes";
|
||||||
|
import { useLocale } from "../hooks/useLocale";
|
||||||
|
import { Playlist } from "../stores/playlist";
|
||||||
|
|
||||||
|
export function PlaylistActions() {
|
||||||
|
const { strings } = useLocale();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Flex gap="2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
color="red"
|
||||||
|
onClick={() => {
|
||||||
|
Playlist.mutate((draft) => {
|
||||||
|
draft.list = undefined;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{strings.website.tools.playlist.reset}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button variant="outline">
|
||||||
|
{strings.website.tools.playlist.shuffle}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button>
|
||||||
|
{strings.website.tools.playlist.sort}
|
||||||
|
<CaretDownIcon />
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
import { Box, Button, Flex } from "@radix-ui/themes";
|
import { Box, Flex } from "@radix-ui/themes";
|
||||||
import { useLocale } from "../hooks/useLocale";
|
import { useLocale } from "../hooks/useLocale";
|
||||||
import { Playlist } from "../stores/playlist";
|
|
||||||
import { CurrentlyPlaying } from "./CurrentlyPlaying";
|
import { CurrentlyPlaying } from "./CurrentlyPlaying";
|
||||||
|
import { PlaylistActions } from "./PlaylistActions";
|
||||||
import { PlaylistTable } from "./PlaylistTable";
|
import { PlaylistTable } from "./PlaylistTable";
|
||||||
|
|
||||||
export function PlaylistOrder() {
|
export function PlaylistOrder() {
|
||||||
const { strings } = useLocale();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@@ -18,15 +17,7 @@ export function PlaylistOrder() {
|
|||||||
>
|
>
|
||||||
<CurrentlyPlaying />
|
<CurrentlyPlaying />
|
||||||
|
|
||||||
<Button
|
<PlaylistActions />
|
||||||
onClick={() => {
|
|
||||||
Playlist.mutate((draft) => {
|
|
||||||
draft.list = undefined;
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{strings.website.tools.playlist.clear}
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Box flexGrow="1" width="100%" position="relative">
|
<Box flexGrow="1" width="100%" position="relative">
|
||||||
<PlaylistTable />
|
<PlaylistTable />
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ export function PlaylistTable() {
|
|||||||
{strings.website.tools.playlist.table.last_played}
|
{strings.website.tools.playlist.table.last_played}
|
||||||
</StickyColumnHeaderCell>
|
</StickyColumnHeaderCell>
|
||||||
|
|
||||||
|
<StickyColumnHeaderCell width="1">
|
||||||
|
{strings.website.tools.playlist.table.battles}
|
||||||
|
</StickyColumnHeaderCell>
|
||||||
|
|
||||||
<StickyColumnHeaderCell width="0" />
|
<StickyColumnHeaderCell width="0" />
|
||||||
|
|
||||||
<StickyColumnHeaderCell width="0" />
|
<StickyColumnHeaderCell width="0" />
|
||||||
|
|||||||
@@ -8,7 +8,13 @@ interface Props extends PlaylistEntry {
|
|||||||
index: number;
|
index: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PlaylistTankEntry({ tank, checked, last, index }: Props) {
|
export function PlaylistTankEntry({
|
||||||
|
tank,
|
||||||
|
checked,
|
||||||
|
last,
|
||||||
|
battles,
|
||||||
|
index,
|
||||||
|
}: Props) {
|
||||||
const { locale, strings } = useLocale();
|
const { locale, strings } = useLocale();
|
||||||
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
|
||||||
const nowDays = Date.now() / (1000 * 60 * 60 * 24);
|
const nowDays = Date.now() / (1000 * 60 * 60 * 24);
|
||||||
@@ -26,6 +32,8 @@ export function PlaylistTankEntry({ tank, checked, last, index }: Props) {
|
|||||||
: strings.website.tools.playlist.table.never}
|
: strings.website.tools.playlist.table.never}
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
|
|
||||||
|
<Table.Cell>{battles}</Table.Cell>
|
||||||
|
|
||||||
<Table.Cell
|
<Table.Cell
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
Playlist.mutate((draft) => {
|
Playlist.mutate((draft) => {
|
||||||
|
|||||||
Reference in new issue
Block a user