2024-07-12 13:53:11 -05:00
|
|
|
import { Flex, Select, Text } from '@radix-ui/themes';
|
2025-01-07 12:47:55 -06:00
|
|
|
import { useLocale } from '../../hooks/useLocale';
|
2024-10-21 21:03:49 -05:00
|
|
|
import {
|
|
|
|
|
TankPerformanceEphemeral,
|
2024-10-22 15:08:23 -05:00
|
|
|
type PlayerCountPeriod,
|
2024-10-21 21:03:49 -05:00
|
|
|
} from '../../stores/tankPerformanceEphemeral';
|
2024-07-12 13:53:11 -05:00
|
|
|
|
|
|
|
|
export function PlayerCountControl() {
|
2024-10-21 21:03:49 -05:00
|
|
|
const playerCountPeriod = TankPerformanceEphemeral.use(
|
2024-07-12 13:53:11 -05:00
|
|
|
(state) => state.playerCountPeriod,
|
|
|
|
|
);
|
2024-10-21 21:03:49 -05:00
|
|
|
const mutateTankPerformanceSort = TankPerformanceEphemeral.useMutation();
|
2025-01-07 12:47:55 -06:00
|
|
|
const { strings } = useLocale();
|
2024-07-12 13:53:11 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Flex justify="center" align="center" gap="2">
|
2025-01-07 12:47:55 -06:00
|
|
|
<Text>{strings.website.tools.performance.player_count.label}</Text>
|
2024-07-12 13:53:11 -05:00
|
|
|
<Select.Root
|
|
|
|
|
value={playerCountPeriod}
|
|
|
|
|
onValueChange={(period) => {
|
|
|
|
|
mutateTankPerformanceSort((draft) => {
|
|
|
|
|
draft.playerCountPeriod = period as PlayerCountPeriod;
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Select.Trigger />
|
|
|
|
|
<Select.Content>
|
2025-01-07 12:47:55 -06:00
|
|
|
<Select.Item value="total">
|
|
|
|
|
{strings.common.player_count_period.total}
|
|
|
|
|
</Select.Item>
|
|
|
|
|
<Select.Item value="d_120">
|
|
|
|
|
{strings.common.player_count_period.d_120}
|
|
|
|
|
</Select.Item>
|
|
|
|
|
<Select.Item value="d_90">
|
|
|
|
|
{strings.common.player_count_period.d_90}
|
|
|
|
|
</Select.Item>
|
|
|
|
|
<Select.Item value="d_60">
|
|
|
|
|
{strings.common.player_count_period.d_60}
|
|
|
|
|
</Select.Item>
|
|
|
|
|
<Select.Item value="d_30">
|
|
|
|
|
{strings.common.player_count_period.d_30}
|
|
|
|
|
</Select.Item>
|
|
|
|
|
<Select.Item value="d_7">
|
|
|
|
|
{strings.common.player_count_period.d_7}
|
|
|
|
|
</Select.Item>
|
|
|
|
|
<Select.Item value="d_1">
|
|
|
|
|
{strings.common.player_count_period.d_1}
|
|
|
|
|
</Select.Item>
|
2024-07-12 13:53:11 -05:00
|
|
|
</Select.Content>
|
|
|
|
|
</Select.Root>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|