Display foil prices for foil copies

This commit is contained in:
Correl Roush 2023-07-18 16:39:59 -04:00
parent 2247fb5bb4
commit a24ae30c9f
2 changed files with 24 additions and 8 deletions

View file

@ -482,12 +482,20 @@ viewCardDetails model =
, description = copy.card.name
}
prices card =
prices card isFoil =
Maybe.Extra.values
[ Maybe.map (\usd -> { currency = "usd", amount = usd }) <|
Maybe.Extra.or card.prices.usd card.prices.usd_foil
if isFoil then
Maybe.Extra.or card.prices.usd_foil card.prices.usd
else
Maybe.Extra.or card.prices.usd card.prices.usd_foil
, Maybe.map (\eur -> { currency = "eur", amount = eur }) <|
Maybe.Extra.or card.prices.eur card.prices.eur_foil
if isFoil then
Maybe.Extra.or card.prices.eur_foil card.prices.eur
else
Maybe.Extra.or card.prices.eur card.prices.eur_foil
, Maybe.map (\tix -> { currency = "tix", amount = tix }) card.prices.tix
]
@ -516,7 +524,7 @@ viewCardDetails model =
, E.paragraph [ Font.heavy, Font.size 24, Font.center, Font.color UI.colors.title ]
[ E.text copy.card.name ]
, E.row [ E.spacing 5, E.centerX ] <|
List.map UI.priceBadge (prices copy.card)
List.map UI.priceBadge (prices copy.card copy.foil)
, E.paragraph [] <| [ Symbol.text model.symbols 20 copy.card.manaCost, UI.text <| " " ++ copy.card.typeLine ]
, E.paragraph [] <|
List.map (Symbol.text model.symbols 16) (String.lines copy.card.oracleText)

View file

@ -263,12 +263,20 @@ cardRow options attributes symbols card =
in
badge color isFoil card.setCode
prices =
prices isFoil =
Maybe.Extra.values
[ Maybe.map (\usd -> { currency = "usd", amount = usd }) <|
Maybe.Extra.or card.prices.usd card.prices.usd_foil
if isFoil then
Maybe.Extra.or card.prices.usd_foil card.prices.usd
else
Maybe.Extra.or card.prices.usd card.prices.usd_foil
, Maybe.map (\eur -> { currency = "eur", amount = eur }) <|
Maybe.Extra.or card.prices.eur card.prices.eur_foil
if isFoil then
Maybe.Extra.or card.prices.eur_foil card.prices.eur
else
Maybe.Extra.or card.prices.eur card.prices.eur_foil
, Maybe.map (\tix -> { currency = "tix", amount = tix }) card.prices.tix
]
in
@ -301,7 +309,7 @@ cardRow options attributes symbols card =
]
, E.column [ E.alignRight, E.height E.fill ] <|
setBadge options.foil
:: List.map priceBadge prices
:: List.map priceBadge (prices options.foil)
]