mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-02 07:20:36 +01:00
feat: optimize info lines
This commit is contained in:
1 parent
94cba0c9ba
commit
525b9377cc
1 file changed
+14
-11
+14
-11
@@ -1,7 +1,7 @@
|
|||||||
import { createDefaultSkills } from '@blitzkit/core';
|
import { createDefaultSkills } from '@blitzkit/core';
|
||||||
import { Flex, Progress, Text } from '@radix-ui/themes';
|
import { Flex, Progress, Text } from '@radix-ui/themes';
|
||||||
import { clamp } from 'lodash-es';
|
import { clamp } from 'lodash-es';
|
||||||
import { useMemo, type ComponentProps, type ReactNode } from 'react';
|
import { memo, useMemo, type ComponentProps, type ReactNode } from 'react';
|
||||||
import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions';
|
import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions';
|
||||||
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
||||||
import { awaitableProvisionDefinitions } from '../../../../../../core/awaitables/provisionDefinitions';
|
import { awaitableProvisionDefinitions } from '../../../../../../core/awaitables/provisionDefinitions';
|
||||||
@@ -48,13 +48,8 @@ const [
|
|||||||
awaitableSkillDefinitions,
|
awaitableSkillDefinitions,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function InfoWithDelta({
|
export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||||
stats,
|
({ stats, indent, noRanking, deltaType, ...props }) => {
|
||||||
indent,
|
|
||||||
noRanking,
|
|
||||||
deltaType,
|
|
||||||
...props
|
|
||||||
}: InfoWithDeltaProps) {
|
|
||||||
const { strings } = useLocale();
|
const { strings } = useLocale();
|
||||||
const relativeAgainst = TankopediaEphemeral.use(
|
const relativeAgainst = TankopediaEphemeral.use(
|
||||||
(state) => state.relativeAgainst,
|
(state) => state.relativeAgainst,
|
||||||
@@ -94,7 +89,9 @@ export function InfoWithDelta({
|
|||||||
provisionDefinitions,
|
provisionDefinitions,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (member.gun.gun_type!.value.base.shells[shellIndex] === undefined) {
|
if (
|
||||||
|
member.gun.gun_type!.value.base.shells[shellIndex] === undefined
|
||||||
|
) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,10 +183,16 @@ export function InfoWithDelta({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Text color="gray" size="1">
|
<Text color="gray" size="1">
|
||||||
{clamp(betterTanks.length + 1, 1, others.length)} / {others.length}
|
{clamp(betterTanks.length + 1, 1, others.length)} /{' '}
|
||||||
|
{others.length}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
(a, b) =>
|
||||||
|
(typeof a.value === 'function' ? a.value(a.stats) : a.stats[a.value]) ===
|
||||||
|
(typeof b.value === 'function' ? b.value(b.stats) : b.stats[b.value]),
|
||||||
|
);
|
||||||
Reference in new issue
Block a user