feat: named sorting

This commit is contained in:
TrèsAbhi committed 2024-02-10 00:04:43 -06:00
1 parent a8a50ac948
commit 7877eaa89b
2 files changed
+37 -29

No files matched your search

+30 -27
View File
@@ -15,33 +15,7 @@ import {
TurretDefinition,
} from '../core/blitzkrieg/tankDefinitions';
export type TankopediaSortBy =
| 'meta.tier'
| 'meta.name'
| 'survivability.health'
| 'survivability.viewRange'
| 'survivability.camouflageStill'
| 'survivability.camouflageMoving'
| 'survivability.camouflageShooting'
| 'survivability.size'
| 'fire.dpm'
| 'fire.reload'
| 'fire.caliber'
| 'fire.standardPenetration'
| 'fire.premiumPenetration'
| 'fire.damage'
| 'fire.shellVelocity'
| 'fire.aimTime'
| 'fire.dispersionStill'
| 'fire.dispersionMoving'
| 'fire.gunDepression'
| 'fire.gunElevation'
| 'maneuverability.forwardsSpeed'
| 'maneuverability.backwardsSpeed'
| 'maneuverability.power'
| 'maneuverability.powerToWeight'
| 'maneuverability.weight'
| 'maneuverability.traverseSpeed';
export type TankopediaSortBy = keyof typeof SORT_NAMES;
export type TankopediaSortDirection = 'ascending' | 'descending';
export type TankopediaTestTankDisplay = 'include' | 'exclude' | 'only';
export type TankopediaMode = 'model' | 'armor';
@@ -125,6 +99,35 @@ export type ArmorPiercingLayer =
gap: number;
};
export const SORT_NAMES = {
'meta.tier': 'tier',
'meta.name': 'name',
'survivability.health': 'health',
'survivability.viewRange': 'view range',
'survivability.camouflageStill': 'camouflage still',
'survivability.camouflageMoving': 'camouflage moving',
'survivability.camouflageShooting': 'camouflage shooting',
'survivability.size': 'size',
'fire.dpm': 'DPM',
'fire.reload': 'reload',
'fire.caliber': 'caliber',
'fire.standardPenetration': 'standard penetration',
'fire.premiumPenetration': 'premium penetration',
'fire.damage': 'damage',
'fire.shellVelocity': 'shell velocity',
'fire.aimTime': 'aim time',
'fire.dispersionStill': 'dispersion still',
'fire.dispersionMoving': 'dispersion moving',
'fire.gunDepression': 'gun depression',
'fire.gunElevation': 'gun elevation',
'maneuverability.forwardsSpeed': 'forwards speed',
'maneuverability.backwardsSpeed': 'backwards speed',
'maneuverability.power': 'power',
'maneuverability.powerToWeight': 'power to weight',
'maneuverability.weight': 'weight',
'maneuverability.traverseSpeed': 'traverse speed',
} as const;
export const useTankopediaPersistent = create<TankopediaPersistent>()(
persist(
subscribeWithSelector<TankopediaPersistent>(() => ({