fix(panel): transaction types showing wrong sign for trivia, trades, etc.
Some checks failed
Deploy to Production / test (push) Failing after 32s
Some checks failed
Deploy to Production / test (push) Failing after 32s
TYPE_CONFIG only had 6 of 14 transaction types. Missing types fell back to sign: null which rendered as negative. Added all TransactionType enum values and derived the filter dropdown from TYPE_CONFIG keys. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,24 +36,25 @@ interface TransactionsResponse {
|
|||||||
// Constants
|
// Constants
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const TRANSACTION_TYPES = [
|
const TYPE_CONFIG: Record<string, { label: string; color: string; sign: "+" | "-" }> = {
|
||||||
"DAILY_REWARD",
|
DAILY_REWARD: { label: "Daily Reward", color: "bg-green-500/20 text-green-400", sign: "+" },
|
||||||
"TRANSFER_IN",
|
TRANSFER_IN: { label: "Transfer In", color: "bg-blue-500/20 text-blue-400", sign: "+" },
|
||||||
"TRANSFER_OUT",
|
TRANSFER_OUT: { label: "Transfer Out", color: "bg-orange-500/20 text-orange-400", sign: "-" },
|
||||||
"LOOTDROP_CLAIM",
|
LOOTDROP_CLAIM: { label: "Lootdrop", color: "bg-purple-500/20 text-purple-400", sign: "+" },
|
||||||
"SHOP_BUY",
|
SHOP_BUY: { label: "Shop Purchase", color: "bg-amber-500/20 text-amber-400", sign: "-" },
|
||||||
"QUEST_REWARD",
|
QUEST_REWARD: { label: "Quest Reward", color: "bg-emerald-500/20 text-emerald-400",sign: "+" },
|
||||||
] as const;
|
TRIVIA_WIN: { label: "Trivia Win", color: "bg-teal-500/20 text-teal-400", sign: "+" },
|
||||||
|
TRIVIA_ENTRY: { label: "Trivia Entry", color: "bg-teal-500/20 text-teal-400", sign: "-" },
|
||||||
const TYPE_CONFIG: Record<string, { label: string; color: string; sign: "+" | "-" | null }> = {
|
TRADE_IN: { label: "Trade In", color: "bg-blue-500/20 text-blue-400", sign: "+" },
|
||||||
DAILY_REWARD: { label: "Daily Reward", color: "bg-green-500/20 text-green-400", sign: "+" },
|
TRADE_OUT: { label: "Trade Out", color: "bg-orange-500/20 text-orange-400", sign: "-" },
|
||||||
TRANSFER_IN: { label: "Transfer In", color: "bg-blue-500/20 text-blue-400", sign: "+" },
|
PURCHASE: { label: "Purchase", color: "bg-amber-500/20 text-amber-400", sign: "-" },
|
||||||
TRANSFER_OUT: { label: "Transfer Out", color: "bg-orange-500/20 text-orange-400", sign: "-" },
|
ITEM_USE: { label: "Item Use", color: "bg-gray-500/20 text-gray-400", sign: "-" },
|
||||||
LOOTDROP_CLAIM:{ label: "Lootdrop", color: "bg-purple-500/20 text-purple-400", sign: "+" },
|
LOOTBOX: { label: "Lootbox", color: "bg-purple-500/20 text-purple-400", sign: "-" },
|
||||||
SHOP_BUY: { label: "Shop Purchase", color: "bg-amber-500/20 text-amber-400", sign: "-" },
|
EXAM_REWARD: { label: "Exam Reward", color: "bg-emerald-500/20 text-emerald-400",sign: "+" },
|
||||||
QUEST_REWARD: { label: "Quest Reward", color: "bg-emerald-500/20 text-emerald-400", sign: "+" },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TRANSACTION_TYPES = Object.keys(TYPE_CONFIG);
|
||||||
|
|
||||||
const PAGE_SIZES = [25, 50, 100];
|
const PAGE_SIZES = [25, 50, 100];
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -77,7 +78,7 @@ function formatDate(iso: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTypeConfig(type: string) {
|
function getTypeConfig(type: string) {
|
||||||
return TYPE_CONFIG[type] ?? { label: type, color: "bg-gray-500/20 text-gray-400", sign: null };
|
return TYPE_CONFIG[type] ?? { label: type, color: "bg-gray-500/20 text-gray-400", sign: "+" };
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPositive(type: string): boolean {
|
function isPositive(type: string): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user