chore: Duplicate RARITY_COLORS constants with different values #36

Closed
opened 2026-05-18 15:59:26 +02:00 by Anexim · 3 comments
Owner

Severity: Major

Files:

  • src/lib/game/constants/core.ts (lines 11-19) — RARITY_COLORS with legendary: '#F97316'
  • src/lib/game/data/loot-drops.ts (lines 155-163) — RARITY_COLORS with legendary: '#F59E0B' and extra glow property

Problem: Two different RARITY_COLORS constants with different structures and values exist. The loot-drops version has an extra glow field and a different color for legendary items. These serve different purposes but the naming collision is confusing.

Impact: Inconsistent rarity colors across the UI. Developers may import from the wrong file.

Fix: Rename one of them (e.g., RARITY_COLORS in loot-drops.ts → LOOT_RARITY_COLORS) or consolidate into a single shared constant.

**Severity:** Major **Files:** - `src/lib/game/constants/core.ts` (lines 11-19) — `RARITY_COLORS` with `legendary: '#F97316'` - `src/lib/game/data/loot-drops.ts` (lines 155-163) — `RARITY_COLORS` with `legendary: '#F59E0B'` and extra `glow` property **Problem:** Two different `RARITY_COLORS` constants with different structures and values exist. The loot-drops version has an extra `glow` field and a different color for legendary items. These serve different purposes but the naming collision is confusing. **Impact:** Inconsistent rarity colors across the UI. Developers may import from the wrong file. **Fix:** Rename one of them (e.g., `RARITY_COLORS` in loot-drops.ts → `LOOT_RARITY_COLORS`) or consolidate into a single shared constant.
Anexim added the ai:todo label 2026-05-18 15:59:26 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 15:59:26 +02:00
Author
Owner

[priority: 3] DATA/LOGIC BUG — Duplicate RARITY_COLORS constants with different values.

[priority: 3] DATA/LOGIC BUG — Duplicate RARITY_COLORS constants with different values.
Author
Owner

Starting work on #36. Will rename duplicate RARITY_COLORS in loot-drops.ts to LOOT_RARITY_COLORS.

Starting work on #36. Will rename duplicate RARITY_COLORS in loot-drops.ts to LOOT_RARITY_COLORS.
Author
Owner

Fixed. Renamed RARITY_COLORS in loot-drops.ts to LOOT_RARITY_COLORS to avoid naming collision with the RARITY_COLORS in constants/core.ts. Updated all consumers (EquipmentCrafter.tsx, LootInventory/index.tsx, LootInventory/types.ts) to use the renamed export.

Fixed. Renamed RARITY_COLORS in loot-drops.ts to LOOT_RARITY_COLORS to avoid naming collision with the RARITY_COLORS in constants/core.ts. Updated all consumers (EquipmentCrafter.tsx, LootInventory/index.tsx, LootInventory/types.ts) to use the renamed export.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#36