mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-19 20:03:51 +01:00
feat: safe sort
This commit is contained in:
1 parent
4d99e61bfb
commit
f0fc23712a
13 files changed
+73
-65
No files matched your search
@@ -6,14 +6,15 @@ import {
|
||||
CaretUpIcon,
|
||||
} from '@radix-ui/react-icons';
|
||||
import { Flex, IconButton, Table } from '@radix-ui/themes';
|
||||
import * as TankPerformanceSort from '../../../../stores/tankPerformanceSort';
|
||||
import {
|
||||
tankPerformanceSortTypeNames,
|
||||
tankPerformanceSortTypeNamesArray,
|
||||
useTankPerformanceSort,
|
||||
} from '../../../../stores/tankPerformanceSort';
|
||||
} from '../../../../stores/tankPerformanceSort/constants';
|
||||
|
||||
export function Header() {
|
||||
const sort = useTankPerformanceSort();
|
||||
const sort = TankPerformanceSort.use();
|
||||
const store = TankPerformanceSort.useStore();
|
||||
|
||||
return (
|
||||
<Table.Header>
|
||||
@@ -40,11 +41,9 @@ export function Header() {
|
||||
highContrast={!isSelected}
|
||||
onClick={() => {
|
||||
if (isSelected) {
|
||||
useTankPerformanceSort.setState({
|
||||
direction: -sort.direction as 1 | -1,
|
||||
});
|
||||
store.setState({ direction: -sort.direction as 1 | -1 });
|
||||
} else {
|
||||
useTankPerformanceSort.setState({ type, direction: -1 });
|
||||
store.setState({ type, direction: -1 });
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user