mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: some linting for new proto 2
This commit is contained in:
1 parent
94f67e30f1
commit
79bc259565
22 files changed
+183
-163
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { type TankDefinition, tankIcon } from '@blitzkit/core';
|
||||
import { type TankDefinition, tankIcon, TankType } from '@blitzkit/core';
|
||||
import { Link } from '@radix-ui/themes';
|
||||
import { classIcons } from './ClassIcon';
|
||||
import { ExperimentIcon } from './ExperimentIcon';
|
||||
@@ -32,13 +32,13 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
|
||||
|
||||
<Link
|
||||
color={
|
||||
tank.treeType === 'collector'
|
||||
tank.type === TankType.COLLECTOR
|
||||
? 'blue'
|
||||
: tank.treeType === 'premium'
|
||||
: tank.type === TankType.PREMIUM
|
||||
? 'amber'
|
||||
: 'gray'
|
||||
}
|
||||
highContrast={tank.treeType === 'researchable'}
|
||||
highContrast={tank.type === TankType.RESEARCHABLE}
|
||||
underline="hover"
|
||||
wrap="nowrap"
|
||||
href={`/tools/tankopedia/${tank.id}`}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
asset,
|
||||
gameDefinitions,
|
||||
fetchGameDefinitions,
|
||||
TANK_CLASSES,
|
||||
TIER_ROMAN_NUMERALS,
|
||||
type Tier,
|
||||
@@ -10,7 +10,6 @@ import { useStore } from '@nanostores/react';
|
||||
import { ReloadIcon } from '@radix-ui/react-icons';
|
||||
import { Box, Flex, IconButton, Text, Tooltip } from '@radix-ui/themes';
|
||||
import { times } from 'lodash-es';
|
||||
import { useAwait } from '../../../hooks/useAwait';
|
||||
import { $tankFilters, initialTankFilters } from '../../../stores/tankFilters';
|
||||
import { classIcons } from '../../ClassIcon';
|
||||
import { ExperimentIcon } from '../../ExperimentIcon';
|
||||
@@ -22,8 +21,9 @@ interface FilterControlProps {
|
||||
compact?: boolean;
|
||||
}
|
||||
|
||||
const gameDefinitions = await fetchGameDefinitions();
|
||||
|
||||
export function FilterControl({ compact }: FilterControlProps) {
|
||||
const awaitedGameDefinitions = useAwait(gameDefinitions);
|
||||
const tankFilters = useStore($tankFilters);
|
||||
|
||||
return (
|
||||
@@ -126,8 +126,8 @@ export function FilterControl({ compact }: FilterControlProps) {
|
||||
style={{ borderRadius: 'var(--radius-5)' }}
|
||||
>
|
||||
<Flex direction={compact ? 'column' : { sm: 'row', initial: 'column' }}>
|
||||
{awaitedGameDefinitions.nations
|
||||
.slice(0, Math.ceil(awaitedGameDefinitions.nations.length / 2))
|
||||
{gameDefinitions.nations
|
||||
.slice(0, Math.ceil(gameDefinitions.nations.length / 2))
|
||||
.map((nation) => {
|
||||
const selected = tankFilters.nations?.includes(nation);
|
||||
|
||||
@@ -180,8 +180,8 @@ export function FilterControl({ compact }: FilterControlProps) {
|
||||
})}
|
||||
</Flex>
|
||||
<Flex direction={compact ? 'column' : { sm: 'row', initial: 'column' }}>
|
||||
{awaitedGameDefinitions.nations
|
||||
.slice(Math.ceil(awaitedGameDefinitions.nations.length / 2))
|
||||
{gameDefinitions.nations
|
||||
.slice(Math.ceil(gameDefinitions.nations.length / 2))
|
||||
.map((nation) => {
|
||||
const selected = tankFilters.nations?.includes(nation);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { TreeType } from '@blitzkit/core';
|
||||
import { TankType } from '@blitzkit/core';
|
||||
|
||||
export const treeTypeOrder: TreeType[] = [
|
||||
'researchable',
|
||||
'premium',
|
||||
'collector',
|
||||
export const treeTypeOrder = [
|
||||
TankType.RESEARCHABLE,
|
||||
TankType.PREMIUM,
|
||||
TankType.COLLECTOR,
|
||||
];
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
normalizeBoundingBox,
|
||||
resolveDpm,
|
||||
resolveGun,
|
||||
resolveNearPenetration,
|
||||
unionBoundingBox,
|
||||
type TankDefinition,
|
||||
} from '@blitzkit/core';
|
||||
@@ -96,7 +95,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'survivability.viewRange':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.view_range - b.turrets.at(-1)!.view_range,
|
||||
a.turrets.at(-1)!.viewRange - b.turrets.at(-1)!.viewRange,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -153,8 +152,8 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
|
||||
case 'survivability.length':
|
||||
sorted = filtered.sort((a, b) => {
|
||||
const aTankModelDefinition = modelDefinitions[a.id];
|
||||
const bTankModelDefinition = modelDefinitions[b.id];
|
||||
const aTankModelDefinition = modelDefinitions.models[a.id];
|
||||
const bTankModelDefinition = modelDefinitions.models[b.id];
|
||||
const aTurretModelDefinition =
|
||||
aTankModelDefinition.turrets[a.turrets.at(-1)!.id];
|
||||
const bTurretModelDefinition =
|
||||
@@ -183,11 +182,11 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
(a, b) =>
|
||||
resolveDpm(
|
||||
a.turrets.at(-1)!.guns.at(-1)!,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0],
|
||||
) -
|
||||
resolveDpm(
|
||||
b.turrets.at(-1)!.guns.at(-1)!,
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0],
|
||||
),
|
||||
);
|
||||
break;
|
||||
@@ -195,16 +194,18 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.dpmPremium':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[1]
|
||||
? resolveDpm(
|
||||
a.turrets.at(-1)!.guns.at(-1)!,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[1],
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun
|
||||
.shells[1],
|
||||
)
|
||||
: 0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[1]
|
||||
? resolveDpm(
|
||||
b.turrets.at(-1)!.guns.at(-1)!,
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[1],
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun
|
||||
.shells[1],
|
||||
)
|
||||
: 0),
|
||||
);
|
||||
@@ -221,112 +222,118 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
case 'fire.caliber':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.caliber -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.caliber,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.standardPenetration':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
resolveNearPenetration(
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration,
|
||||
) -
|
||||
resolveNearPenetration(
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration,
|
||||
),
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.penetration.near -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.penetration.near,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.premiumPenetration':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
resolveNearPenetration(
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration ?? 0,
|
||||
) -
|
||||
resolveNearPenetration(
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration ?? 0,
|
||||
),
|
||||
(a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[1]
|
||||
?.penetration.near ?? 0) -
|
||||
(b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[1]
|
||||
?.penetration.near ?? 0),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.damage':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].damage.armor -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].damage.armor,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.armorDamage -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.armorDamage,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.shellVelocity':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.shells[0].speed -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.shells[0].speed,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.velocity -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.shells[0]
|
||||
.velocity,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.aimTime':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.aimTime -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.aimTime,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.aimTime -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.aimTime,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.dispersionStill':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.turrets.at(-1)!.guns.at(-1)!.dispersion.base -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.dispersion.base,
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun
|
||||
.dispersionBase -
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun
|
||||
.dispersionBase,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.dispersionMoving':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
a.tracks.at(-1)!.dispersion.move -
|
||||
b.tracks.at(-1)!.dispersion.move,
|
||||
a.tracks.at(-1)!.dispersionMove -
|
||||
b.tracks.at(-1)!.dispersionMove,
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.gunDepression':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
modelDefinitions[a.id].turrets[a.turrets.at(-1)!.id].guns[
|
||||
a.turrets.at(-1)!.guns.at(-1)!.id
|
||||
].pitch.max +
|
||||
(modelDefinitions[a.id].turretRotation?.pitch ?? 0) -
|
||||
modelDefinitions[b.id].turrets[b.turrets.at(-1)!.id].guns[
|
||||
b.turrets.at(-1)!.guns.at(-1)!.id
|
||||
].pitch.max -
|
||||
(modelDefinitions[b.id].turretRotation?.pitch ?? 0),
|
||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.id]
|
||||
.pitch.max +
|
||||
(modelDefinitions.models[a.id].initialTurretRotation?.pitch ??
|
||||
0) -
|
||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.id]
|
||||
.pitch.max -
|
||||
(modelDefinitions.models[b.id].initialTurretRotation?.pitch ??
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'fire.gunElevation':
|
||||
sorted = filtered.sort(
|
||||
(a, b) =>
|
||||
modelDefinitions[b.id].turrets[b.turrets.at(-1)!.id].guns[
|
||||
b.turrets.at(-1)!.guns.at(-1)!.id
|
||||
].pitch.min +
|
||||
(modelDefinitions[b.id].turretRotation?.pitch ?? 0) -
|
||||
modelDefinitions[a.id].turrets[a.turrets.at(-1)!.id].guns[
|
||||
a.turrets.at(-1)!.guns.at(-1)!.id
|
||||
].pitch.min -
|
||||
(modelDefinitions[a.id].turretRotation?.pitch ?? 0),
|
||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.id]
|
||||
.pitch.min +
|
||||
(modelDefinitions.models[b.id].initialTurretRotation?.pitch ??
|
||||
0) -
|
||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.id]
|
||||
.pitch.min -
|
||||
(modelDefinitions.models[a.id].initialTurretRotation?.pitch ??
|
||||
0),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'maneuverability.forwardsSpeed':
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.speed.forwards - b.speed.forwards,
|
||||
);
|
||||
sorted = filtered.sort((a, b) => a.speedForwards - b.speedForwards);
|
||||
break;
|
||||
|
||||
case 'maneuverability.backwardsSpeed':
|
||||
sorted = filtered.sort(
|
||||
(a, b) => a.speed.backwards - b.speed.backwards,
|
||||
(a, b) => a.speedBackwards - b.speedBackwards,
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -344,13 +351,13 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
a.engines.at(-1)!.weight +
|
||||
a.tracks.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.guns.at(-1)!.weight) -
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.weight) -
|
||||
b.engines.at(-1)!.power /
|
||||
(b.weight +
|
||||
b.engines.at(-1)!.weight +
|
||||
b.tracks.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.guns.at(-1)!.weight),
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.weight),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -361,12 +368,12 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
a.engines.at(-1)!.weight +
|
||||
a.tracks.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.weight +
|
||||
a.turrets.at(-1)!.guns.at(-1)!.weight -
|
||||
a.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.weight -
|
||||
(b.weight +
|
||||
b.engines.at(-1)!.weight +
|
||||
b.tracks.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.weight +
|
||||
b.turrets.at(-1)!.guns.at(-1)!.weight),
|
||||
b.turrets.at(-1)!.guns.at(-1)!.gunType!.value.gun.weight),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -386,7 +393,7 @@ export const TankSearch = memo<TankSearchProps>(
|
||||
keys: ['searchableName', 'searchableNameDeburr', 'camouflages'],
|
||||
});
|
||||
const searchedTanks = searchedRaw.map(
|
||||
(result) => tankDefinitions[result.obj.id],
|
||||
(result) => tankDefinitions.tanks[result.obj.id],
|
||||
);
|
||||
return searchedTanks;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import { CompositeStatsKey } from '@blitzkit/core';
|
||||
import type { CompositeStatsKey } from '@blitzkit/core';
|
||||
import { grayA, grayDark, grayDarkA } from '@radix-ui/colors';
|
||||
import { ReactNode } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import {
|
||||
BreakdownPreview,
|
||||
compositeStatsKeysOptions,
|
||||
} from '../../../website-legacy/src/app/tools/embed/configurations/breakdown';
|
||||
import { EmbedConfig, ExtractEmbedConfigTypes } from '../../../website-legacy/src/stores/embedState';
|
||||
import { EmbedItemType } from '../../../website-legacy/src/stores/embedState/constants';
|
||||
import type {
|
||||
EmbedConfig,
|
||||
ExtractEmbedConfigTypes,
|
||||
} from '../stores/embedState';
|
||||
import { EmbedItemType } from '../stores/embedState/constants';
|
||||
|
||||
export const breakdownConfig = {
|
||||
width: { type: EmbedItemType.Slider, default: 320, min: 128, max: 640 },
|
||||
|
||||
@@ -6,7 +6,7 @@ export function filterTank(filters: TankFilters, tank: TankDefinition) {
|
||||
(filters.tiers.length === 0 || filters.tiers.includes(tank.tier)) &&
|
||||
(filters.nations.length === 0 || filters.nations.includes(tank.nation)) &&
|
||||
(filters.classes.length === 0 || filters.classes.includes(tank.class)) &&
|
||||
(filters.types.length === 0 || filters.types.includes(tank.treeType)) &&
|
||||
(filters.types.length === 0 || filters.types.includes(tank.type)) &&
|
||||
(filters.testing === 'include' ||
|
||||
(filters.testing === 'only' && tank.testing) ||
|
||||
(filters.testing === 'exclude' && !tank.testing))
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
import type { GunDefinition } from '@blitzkit/core';
|
||||
|
||||
export function resolveReload(gun: GunDefinition) {
|
||||
if (gun.type === 'regular') {
|
||||
return gun.reload;
|
||||
} else if (gun.type === 'autoLoader') {
|
||||
return gun.reload + (gun.count - 1) * gun.intraClip;
|
||||
if (gun.gunType!.$case === 'regular') {
|
||||
return gun.gunType!.value.regular.reload;
|
||||
} else if (gun.gunType!.$case === 'autoLoader') {
|
||||
return (
|
||||
gun.gunType!.value.autoLoader.clipReload +
|
||||
(gun.gunType!.value.autoLoader.shellCount - 1) *
|
||||
gun.gunType!.value.autoLoader.intraClip
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
gun.reload.reduce((a, b) => a + b, 0) + (gun.count - 1) * gun.intraClip
|
||||
gun.gunType!.value.autoReloader.shellReloads.reduce((a, b) => a + b, 0) +
|
||||
(gun.gunType!.value.autoReloader.shellCount - 1) *
|
||||
gun.gunType!.value.autoReloader.intraClip
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ModelArmor } from '@blitzkit/core';
|
||||
import type { Armor } from '@blitzkit/core';
|
||||
|
||||
export function resolveArmor(armor: ModelArmor, index: number) {
|
||||
export function resolveArmor(armor: Armor, index: number) {
|
||||
const spaced = armor.spaced?.includes(index) ?? false;
|
||||
const thickness = index === -1 ? 0 : (armor.thickness[index] ?? 0);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { EquipmentPreset } from '@blitzkit/core';
|
||||
import { EquipmentMatrix } from '../stores/duel';
|
||||
import type { EquipmentMatrix } from '../stores/duel';
|
||||
|
||||
export function useAppliedEquipments(
|
||||
matrix: EquipmentMatrix,
|
||||
preset: EquipmentPreset,
|
||||
) {
|
||||
const flatMatrix = matrix.flat();
|
||||
return preset
|
||||
.flat()
|
||||
.map((options, index) => options[flatMatrix[index] == 1 ? 1 : 0]);
|
||||
return preset.slots.map(
|
||||
(options, index) => options[flatMatrix[index] == 1 ? 'right' : 'left'],
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
import { averageDefinitions, discoveredIdsDefinitions } from '@blitzkit/core';
|
||||
import {
|
||||
fetchAverageDefinitions,
|
||||
fetchDiscoveredIdsDefinitions,
|
||||
} from '@blitzkit/core';
|
||||
|
||||
const awaitedDiscoveredIdsDefinitions = await discoveredIdsDefinitions;
|
||||
const awaitedAverageDefinitions = await averageDefinitions;
|
||||
const awaitedDiscoveredIdsDefinitions = await fetchDiscoveredIdsDefinitions();
|
||||
const awaitedAverageDefinitions = await fetchAverageDefinitions();
|
||||
|
||||
export function useAveragesExclusionRatio() {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { equipmentDefinitions } from '@blitzkit/core';
|
||||
import { fetchEquipmentDefinitions } from '@blitzkit/core';
|
||||
import { useAwait } from './useAwait';
|
||||
|
||||
const equipmentDefinitions = useAwait(fetchEquipmentDefinitions());
|
||||
|
||||
export function useEquipmentPreset(preset: string) {
|
||||
const awaitedEquipmentDefinitions = useAwait(equipmentDefinitions);
|
||||
return awaitedEquipmentDefinitions.presets[preset];
|
||||
return equipmentDefinitions.presets[preset];
|
||||
}
|
||||
Reference in new issue
Block a user