feat(frontend): weapon OD rating filter, column, and detail row

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-07-15 08:22:54 +02:00
parent fb6b54f9bd
commit 1dd95819c7
4 changed files with 9 additions and 0 deletions

View file

@ -21,6 +21,7 @@ export function DetailPanel({ item, onClose }: { item: InvItem; onClose: () => v
<Row k="Workmanship" v={item.workmanship ?? '—'} />
{item.armor_level != null && item.armor_level > 0 && <Row k="Armor" v={item.armor_level} />}
{item.max_damage != null && item.max_damage > 0 && <Row k="Max damage" v={item.max_damage} />}
{item.od_rating != null && <Row k="Weapon OD" v={item.od_rating > 0 ? `+${item.od_rating.toFixed(2)}` : item.od_rating.toFixed(2)} />}
{item.condition_percent != null && <Row k="Condition" v={`${item.condition_percent}%`} />}
{item.item_set_name && <Row k="Set" v={item.item_set_name} />}
{(item.is_bonded || item.is_attuned) && <Row k="Binding" v={[item.is_bonded && 'Bonded', item.is_attuned && 'Attuned'].filter(Boolean).join(', ')} />}

View file

@ -23,6 +23,11 @@ function cell(item: InvItem, key: string): React.ReactNode {
return item.value != null ? item.value.toLocaleString() : '—';
case 'last_updated':
return item.last_updated ? item.last_updated.slice(0, 16).replace('T', ' ') : '—';
case 'od_rating': {
const v = item.od_rating;
if (v == null) return '—';
return v > 0 ? `+${v.toFixed(2)}` : v.toFixed(2);
}
default: {
const v = (item as any)[key];
return v == null || v === -1 ? '—' : String(v);

View file

@ -53,6 +53,7 @@ export const WEAPON_TYPES: Array<{ value: string; label: string }> = [
export interface RatingDef { param: string; label: string; common?: boolean; }
export const RATING_DEFS: RatingDef[] = [
{ param: 'min_od', label: 'Weapon OD', common: true },
{ param: 'min_damage_rating', label: 'Damage rating', common: true },
{ param: 'min_crit_damage_rating', label: 'Crit damage', common: true },
{ param: 'min_heal_boost_rating', label: 'Heal boost', common: true },
@ -89,6 +90,7 @@ export const COLUMNS: ColumnDef[] = [
{ key: 'spell_names', label: 'Spells / Cantrips', sortKey: 'spell_names', defaultVisible: true },
{ key: 'armor_level', label: 'Armor', sortKey: 'armor', defaultVisible: false },
{ key: 'max_damage', label: 'Max Dmg', sortKey: 'damage', defaultVisible: false },
{ key: 'od_rating', label: 'OD', sortKey: 'od', defaultVisible: false },
{ key: 'workmanship', label: 'Work', sortKey: 'workmanship', defaultVisible: false },
{ key: 'item_set_name', label: 'Set', sortKey: 'item_set', defaultVisible: false },
{ key: 'object_class_name', label: 'Type', sortKey: 'item_type_name', defaultVisible: false },

View file

@ -15,6 +15,7 @@ export interface InvItem {
item_set_name?: string;
armor_level: number | null;
max_damage: number | null;
od_rating?: number | null;
condition_percent: number | null;
object_class_name?: string;
material_name?: string;