Implement CardFilterPanel

This commit is contained in:
2025-07-10 21:54:55 +02:00
parent 54a4f7e08a
commit 50009b7e61
51 changed files with 3202 additions and 789 deletions

View File

@@ -1,12 +1,14 @@
import type {
Card,
CardType,
MonsterCard,
MonsterCard, MonsterCardSubType,
MonsterCardType,
SpellCard, SpellCardType,
TrapCard, TrapCardType
} from "../api/openapi";
type CardSubTypes = MonsterCardType | TrapCardType | SpellCardType
export const getCardType = (card: Card) => {
switch (card.cardType) {
case "MONSTER":
@@ -33,18 +35,18 @@ export const isSpellCard = (card: Card): card is SpellCard => {
}
export const getMonsterCardType = (monsterCard: MonsterCard) => {
return `${monsterCard.subType} MONSTER `
return `${monsterCard.type} MONSTER `
}
export const getSpellCardType = (spellCard: SpellCard) => {
return `${spellCard.subType} SPELL`
return `${spellCard.type} SPELL`
}
export const getTrapCardType = (trapCard: TrapCard) => {
return `${trapCard.subType} TRAP`
return `${trapCard.type} TRAP`
}
export const getCardTypeSeverity = (cardType: CardType): string => {
export const getCardSeverity = (cardType: CardType): string => {
switch (cardType) {
case "MONSTER":
return "warn"
@@ -57,14 +59,14 @@ export const getCardTypeSeverity = (cardType: CardType): string => {
}
}
export const getCardSubtypeSeverity = (card: Card) => {
export const getCardTypeSeverity = (card: Card) => {
switch (card.cardType) {
case "MONSTER":
return getSeverityFromMonsterCardType((card as MonsterCard).subType)
return getSeverityFromMonsterCardType((card as MonsterCard).type)
case "SPELL":
return getSeverityFromSpellCardType((card as SpellCard).subType)
return getSeverityFromSpellCardType((card as SpellCard).type)
case "TRAP":
return getSeverityFromTrapCardType((card as TrapCard).subType)
return getSeverityFromTrapCardType((card as TrapCard).type)
default:
return "CONSTRAST"
}
@@ -75,17 +77,17 @@ export const getSeverityFromMonsterCardType = (monsterCardType: MonsterCardType)
case 'NORMAL':
return "secondary"
case 'EFFECT':
return "secondary"
return "warn"
case 'RITUAL':
return "info"
case 'FUSION':
return "info"
case 'SYNCHRO':
return "warn"
return "contrast"
case 'XYZ':
return "danger"
case 'LINK':
return "contrast"
return "info"
}
}