feat: refine public gear cards
Validate and deploy staging / validate (push) Successful in 21s
Validate and deploy production / validate (push) Successful in 25s
Validate and deploy staging / deploy (push) Successful in 42s
Validate and deploy production / deploy (push) Successful in 30s

This commit is contained in:
jb
2026-08-01 02:01:10 -04:00
parent 1998e87309
commit b47e2588e9
5 changed files with 19 additions and 9 deletions
+11 -7
View File
@@ -1,7 +1,7 @@
import { databaseCategory } from '$lib/database/categories';
import type { DatabaseFact, DatabaseItem } from '$lib/database/items';
import type { GameIconName } from '$lib/game-icons';
import { weaponBaseRange } from '$lib/builder/loadout';
import { gearBaseStatRange, weaponBaseRange } from '$lib/builder/loadout';
import { gameDataIconUrl, type GameDataIconType } from '$lib/server/game-data-icons';
import { managedImageUrl } from '$lib/server/managed-images';
import { getDatabase } from '$lib/server/database';
@@ -454,6 +454,8 @@ export const load: PageServerLoad = async ({ params, url }) => {
case 'gear':
{
const relations = gearRelations.filter((relation) => relation.gear_id === row.id);
const level50Health = gearBaseStatRange(row.base_health_min, row.base_health_max, 50);
const level50Armor = row.base_armor_min === null ? null : gearBaseStatRange(row.base_armor_min, row.base_armor_max, 50);
const relatedItems = (kind: 'brand' | 'talent', type: GameDataIconType) => relations
.filter((relation) => relation.kind === kind)
.map((relation) => {
@@ -484,14 +486,16 @@ export const load: PageServerLoad = async ({ params, url }) => {
? [{ label: 'AVAILABLE TALENTS', items: relatedItems('talent', 'talent'), emptyLabel: 'NO TALENTS ASSIGNED' }]
: [])
];
return {
id: String(row.id), name: String(row.name), kicker: `${row.slot} // T${row.tier}`,
renderUrl: row.render_id ? managedImageUrl(String(row.render_id), row.render_updated_at) : '',
return {
id: String(row.id), name: String(row.name), kicker: `${row.slot} // T${row.tier}`,
renderUrl: row.render_id ? managedImageUrl(String(row.render_id), row.render_updated_at) : '',
gameIcon: gearIcon(row.slot),
badges: [{ label: `T${row.tier}` }, { label: `${Number(row.tier) === 0 ? 1 : 2} MOD SLOT${Number(row.tier) === 0 ? '' : 'S'}` }],
headerBadges: [`${Number(row.tier) === 0 ? 1 : 2} MOD SLOT${Number(row.tier) === 0 ? '' : 'S'}`],
headerBadge: `T${row.tier}`,
factLayout: 'stack' as const,
facts: [
{ label: 'BASE HEALTH', value: range(row.base_health_min,row.base_health_max) },
...(row.base_armor_min === null ? [] : [{ label: 'BASE ARMOR', value: range(row.base_armor_min,row.base_armor_max) }])
{ label: 'BASE HEALTH', value: `${level50Health.min.toLocaleString('en-US')}–${level50Health.max.toLocaleString('en-US')}`, emphasis: 'primary' as const, note: 'AT LEVEL 50' },
...(level50Armor === null ? [] : [{ label: 'BASE ARMOR', value: `${level50Armor.min.toLocaleString('en-US')}–${level50Armor.max.toLocaleString('en-US')}`, emphasis: 'primary' as const, note: 'AT LEVEL 50' }])
],
iconGroups
};