From 58da85432a02afa35f9e16a0cf4a47832149e599 Mon Sep 17 00:00:00 2001 From: Mathieu Marques Date: Wed, 31 Jul 2024 13:35:32 +0200 Subject: [PATCH] fix(markdown): remove deprecated row variant usage --- .../articles/2020/03/21/the-mindkiller.md | 14 +++++++------- markdown/articles/2020/06/22/fat-stacks.md | 10 +++++----- .../articles/2020/10/05/gangsta-trippin.md | 16 ++++++++-------- .../2021/01/07/history-of-doomsday.md | 4 ++-- .../2021/03/21/everything-vintage-doomsday.md | 4 ++-- .../2022/01/16/the-mindkiller-update.md | 18 +++++++++--------- .../articles/2022/02/10/axion-mega-report.md | 2 +- .../articles/2022/04/15/axion-mega-brum.md | 8 ++++---- markdown/chapters/ddft/winning-without-dd.md | 6 +++--- markdown/chapters/entombsday/gameplay.md | 12 ++++++------ markdown/chapters/meandeck/interaction.md | 4 ++-- markdown/chapters/meandeck/practice.md | 6 +++--- markdown/chapters/meandeck/ptt.md | 8 ++++---- src/components/Markdown/renderers/Row.tsx | 19 +++++++++++-------- 14 files changed, 67 insertions(+), 64 deletions(-) diff --git a/markdown/articles/2020/03/21/the-mindkiller.md b/markdown/articles/2020/03/21/the-mindkiller.md index f090c036..7830f0ad 100644 --- a/markdown/articles/2020/03/21/the-mindkiller.md +++ b/markdown/articles/2020/03/21/the-mindkiller.md @@ -177,7 +177,7 @@ how they should play out. ### Hand 1 -:::row{variant=HAND} +:::row City of Brass Gemstone Mine LP @@ -196,7 +196,7 @@ Echo. ### Hand 2 -:::row{variant=HAND} +:::row LP LP LED @@ -216,7 +216,7 @@ have enough mana to still cast Echo afterwards. ### Hand 3 -:::row{variant=HAND} +:::row LP DR LED @@ -237,7 +237,7 @@ have a chance even against decks that could race the goblins. ### Hand 4 -:::row{variant=HAND} +:::row LP DR DD @@ -269,7 +269,7 @@ O R P H O S E. ### Hand 5 -:::row{variant=HAND} +:::row LP EoE DD @@ -285,7 +285,7 @@ on the haters. ### Hand 6 -:::row{variant=HAND} +:::row LP Gemstone Mine Rite of Flame @@ -303,7 +303,7 @@ guaranteed, and the deck mulligans pretty well. I'd throw this back. ### Hand 7 -:::row{variant=HAND} +:::row LP DR City of Brass diff --git a/markdown/articles/2020/06/22/fat-stacks.md b/markdown/articles/2020/06/22/fat-stacks.md index 87ee1425..c7130633 100644 --- a/markdown/articles/2020/06/22/fat-stacks.md +++ b/markdown/articles/2020/06/22/fat-stacks.md @@ -221,7 +221,7 @@ some real world game examples. > You already played a land. > Opponent has a single uncracked fetchland in play. 4 cards in hand. -:::row{variant=HAND} +:::row DR|MMQ DD FoW|EMA @@ -330,7 +330,7 @@ TO #### If we play Duress and it resolves we see the following hand -:::row{variant=HAND} +:::row Spell Snare Stifle Scalding Tarn @@ -364,7 +364,7 @@ find additional protection or free up our mana. > Opponent has 6 untapped lands, 4 that can make {U}. 5 cards in hand. We know > they have at least 1 Force of Will and blue card. -:::row{variant=HAND} +:::row DR|MMQ DD FoW|EMA @@ -480,7 +480,7 @@ turn, play a land and have the following hand / board state: My hand is thus: -:::row{variant=HAND} +:::row DD FoW Daze @@ -552,7 +552,7 @@ let's break it down from the other side too. First we should consider what AgyePA had in hand. On my Doomsday being placed on the stack it looked like this: -:::row{variant=HAND} +:::row DD FoW Daze diff --git a/markdown/articles/2020/10/05/gangsta-trippin.md b/markdown/articles/2020/10/05/gangsta-trippin.md index c8b6a7c5..0f66ffde 100644 --- a/markdown/articles/2020/10/05/gangsta-trippin.md +++ b/markdown/articles/2020/10/05/gangsta-trippin.md @@ -246,7 +246,7 @@ Brainstorm. We know that Brainstorm, in conjecture with an additional card in hand post-Doomsday resolving, can lead to a deterministic, same-turn win. Let's consider the following hand: -:::row{variant=HAND} +:::row DR Pnd FoW @@ -258,7 +258,7 @@ Pre In this scenario we have 2 lands in play, Underground Sea and a Polluted Delta. -:::row{variant=HAND} +:::row Underground Sea Polluted Delta ::: @@ -412,14 +412,14 @@ targeting our tapped Underground Sea. Our board is: -:::row{variant=HAND} +:::row Underground Sea Polluted Delta ::: Our hand is: -:::row{variant=HAND} +:::row DR EoA FoW @@ -454,14 +454,14 @@ state and hand: Our board is: -:::row{variant=HAND} +:::row Underground Sea Underground Sea ::: Our hand is: -:::row{variant=HAND} +:::row DR SW Pre @@ -496,13 +496,13 @@ turn 2. Our opponent has just cantripped turn 1 and passed. Our board is: -:::row{variant=HAND} +:::row Underground Sea ::: Our hand is: -:::row{variant=HAND} +:::row Daze Island Pre diff --git a/markdown/articles/2021/01/07/history-of-doomsday.md b/markdown/articles/2021/01/07/history-of-doomsday.md index 0c8ed460..cc567c50 100644 --- a/markdown/articles/2021/01/07/history-of-doomsday.md +++ b/markdown/articles/2021/01/07/history-of-doomsday.md @@ -1075,7 +1075,7 @@ Doomsday of the time made those otherwise _dead_ cards very live. The speed was also a key point. The Meandeck list, with a perfect draw, could achieve a turn 2 kill with the following cards in hand/drawn: -:::row{variant=HAND} +:::row DR|MMQ DD DR|MMQ @@ -1093,7 +1093,7 @@ draw and cast Probe into Unearth. Cast Unearth to reanimate Labman to then activate Top to draw for the win. An equivalent perfect draw from DDFT could result in a turn 1 win. -:::row{variant=HAND} +:::row DR|MMQ DD DR|MMQ diff --git a/markdown/articles/2021/03/21/everything-vintage-doomsday.md b/markdown/articles/2021/03/21/everything-vintage-doomsday.md index dac29952..f9cf706f 100644 --- a/markdown/articles/2021/03/21/everything-vintage-doomsday.md +++ b/markdown/articles/2021/03/21/everything-vintage-doomsday.md @@ -231,7 +231,7 @@ this turn and the rest of the game? Our hand is: -:::row{variant=HAND} +:::row DD SW Pre @@ -353,7 +353,7 @@ Rod], more Revokers, etc? Our hand is: -:::row{variant=HAND} +:::row Pre Daze FoW diff --git a/markdown/articles/2022/01/16/the-mindkiller-update.md b/markdown/articles/2022/01/16/the-mindkiller-update.md index 437c2cca..1d734528 100644 --- a/markdown/articles/2022/01/16/the-mindkiller-update.md +++ b/markdown/articles/2022/01/16/the-mindkiller-update.md @@ -187,7 +187,7 @@ slightly longer game, letting you field additional lands to help play through soft counters or make more colored mana. An interesting situation you will likely find yourself in is a hand like this: -:::row{variant=HAND} +:::row City of Brass Gemstone Mine DR @@ -212,7 +212,7 @@ perfectly with the macro-archetypes. #### Out -:::row{variant=HAND} +:::row Doomsday Doomsday Doomsday @@ -223,7 +223,7 @@ Manamorphose #### In -:::row{variant=HAND} +:::row Galvanic Relay Galvanic Relay Galvanic Relay @@ -241,7 +241,7 @@ spells to keep the deck threat-dense, and add a bit more protection. #### Out -:::row{variant=HAND} +:::row Thoughtseize Thoughtseize Thoughtseize @@ -249,7 +249,7 @@ Thoughtseize #### In -:::row{variant=HAND} +:::row Orim's Chant Orim's Chant Prismatic Ending @@ -265,7 +265,7 @@ based on play vs. draw. #### Out -:::row{variant=HAND} +:::row Empty the Warrens Empty the Warrens Empty the Warrens @@ -273,7 +273,7 @@ Empty the Warrens #### In -:::row{variant=HAND} +:::row Orim's Chant Orim's Chant Orim's Chant @@ -292,7 +292,7 @@ use this strategy if I trounce someone turn 1 and never see their deck. #### Out -:::row{variant=HAND} +:::row Doomsday Doomsday Doomsday @@ -302,7 +302,7 @@ Street Wraith #### In -:::row{variant=HAND} +:::row Prismatic Ending Prismatic Ending Orim's Chant diff --git a/markdown/articles/2022/02/10/axion-mega-report.md b/markdown/articles/2022/02/10/axion-mega-report.md index f9861fbf..0b1d315d 100644 --- a/markdown/articles/2022/02/10/axion-mega-report.md +++ b/markdown/articles/2022/02/10/axion-mega-report.md @@ -380,7 +380,7 @@ that my friend Matt always tells me I shouldn't go for. The sort of hand where I just can't help myself and too often get away with. This is my opening 7 (on the draw mind). -:::row{variant=HAND} +:::row DR | MMQ DD FoW diff --git a/markdown/articles/2022/04/15/axion-mega-brum.md b/markdown/articles/2022/04/15/axion-mega-brum.md index adbaa6ee..d5499295 100644 --- a/markdown/articles/2022/04/15/axion-mega-brum.md +++ b/markdown/articles/2022/04/15/axion-mega-brum.md @@ -58,7 +58,7 @@ my sideboard plan for 8-Cast, which will become very relevant later, as I realised I did something different every time and suspected the deck to be popular (spoiler, it was). -:::row{variant=HAND} +:::row Force of Negation Flusterstorm ::: @@ -120,7 +120,7 @@ something nasty like an :card[Em] under there then I am well and truly fucked. But, waiting means more time for them to do whatever they are doing or finding disruption. As a result I decided to risk jamming and seeing what happened. -:::row{variant=HAND} +:::row Shelldock Isle ::: @@ -255,7 +255,7 @@ off Cavern with a silly amount of interaction available. What would you have taken here? -:::row{variant=HAND} +:::row Lightning Bolt Narset, Parter of Veils Jace, the Mind Sculptor @@ -427,7 +427,7 @@ small chance to eke in to the top thanks to great breakers if I could smash this one out. My opponent snap keeps a 7 and I get a little scared as I have to go down to 5. But what a 5 it was! (And yes, of course I was on the play again). -:::row{variant=HAND} +:::row DR | MMQ DD FoW diff --git a/markdown/chapters/ddft/winning-without-dd.md b/markdown/chapters/ddft/winning-without-dd.md index c109ea94..42c1cd75 100644 --- a/markdown/chapters/ddft/winning-without-dd.md +++ b/markdown/chapters/ddft/winning-without-dd.md @@ -29,7 +29,7 @@ so as early as the first turn. Typically you'll want to do this early in the game before your opponent establishes a board presence, but it can still be effective later on depending on the matchup. Consider the following hand: -:::row{variant=HAND} +:::row DR VoS LED @@ -85,7 +85,7 @@ land drop you can use this to generate mana after Echo. Consider the following situation, where your opening 7 looks like this: -:::row{variant=HAND} +:::row LED LED Scalding Tarn @@ -187,7 +187,7 @@ One last thing to address: there will be times when you determine that you simply have to take a risk and go for a natural storm kill without a Wish in hand. Perhaps your hand looks like this: -:::row{variant=HAND} +:::row LED LED LP diff --git a/markdown/chapters/entombsday/gameplay.md b/markdown/chapters/entombsday/gameplay.md index 73d65b88..da215cf5 100644 --- a/markdown/chapters/entombsday/gameplay.md +++ b/markdown/chapters/entombsday/gameplay.md @@ -162,7 +162,7 @@ game 1 plan, a protection spell is also helpful. Below are a number of sample starting hands. Would you keep them or mulligan? -:::row{variant=HAND} +:::row Marsh Flats Lotus Petal LED @@ -180,7 +180,7 @@ chance to draw a blue card for Force to protect your combo, but we're not here to send back a turn 1 combo. ::: -:::row{variant=HAND} +:::row Underground Sea Lotus Petal Polluted Delta @@ -198,7 +198,7 @@ to enable your combo. You'll need to find both Entomb (or Griselbrand) and a reanimation spell. ::: -:::row{variant=HAND} +:::row Underground Sea Flooded Strand Marsh Flats @@ -216,7 +216,7 @@ multiple ways to dig for a reanimation spell. I would lead on the fetch lands and cast Lim-Dul's vault in my opponent's End Step. ::: -:::row{variant=HAND} +:::row Polluted Delta Entomb Cabal Therapy @@ -234,7 +234,7 @@ multiple pieces of protection, giving you time to find your second land or a Dark Ritual. ::: -:::row{variant=HAND} +:::row Flooded Strand Lotus Petal Polluted Delta @@ -252,7 +252,7 @@ outs between your 4 Entombs and 2 Griselbrands, but there is a chance you cast your cantrips and whiff. ::: -:::row{variant=HAND} +:::row Underground Sea Polluted Delta Cabal Therapy diff --git a/markdown/chapters/meandeck/interaction.md b/markdown/chapters/meandeck/interaction.md index 02d32f6f..aa6405d1 100644 --- a/markdown/chapters/meandeck/interaction.md +++ b/markdown/chapters/meandeck/interaction.md @@ -135,7 +135,7 @@ has resolved (from the Basics chapter): > Game 1 > On the play -:::row{variant=HAND} +:::row DR DD FoW @@ -210,7 +210,7 @@ The extra card drawn can allow a lot of flexibility in keeping up countermagic. Take the following hand: -:::row{variant=HAND} +:::row DR DD FoW diff --git a/markdown/chapters/meandeck/practice.md b/markdown/chapters/meandeck/practice.md index 2e896c85..21ab1c5c 100644 --- a/markdown/chapters/meandeck/practice.md +++ b/markdown/chapters/meandeck/practice.md @@ -166,7 +166,7 @@ Opponent has 5 cards in hand. Your hand: -:::row{variant=HAND} +:::row DD DR Misty Rainforest @@ -305,7 +305,7 @@ Game 3 turn 1 on the play with a 5 cards opening hand. Your hand: -:::row{variant=HAND} +:::row DD DR Misty Rainforest @@ -422,7 +422,7 @@ You have 2 Underground Sea in play, 18 Life and your land drop available to you. Your hand: -:::row{variant=HAND} +:::row DD LP SW diff --git a/markdown/chapters/meandeck/ptt.md b/markdown/chapters/meandeck/ptt.md index 85987a50..f48d9262 100644 --- a/markdown/chapters/meandeck/ptt.md +++ b/markdown/chapters/meandeck/ptt.md @@ -50,7 +50,7 @@ Take the following example: > Game 1 > On the play -:::row{variant=hand} +:::row DR DD FoW @@ -116,7 +116,7 @@ ways that your opponents can prevent you from executing the pile as desired. If we were to look at the pile presented and have cast DR, DD from Underground Sea we are left with the following cards in hand: -:::row{variant=hand} +:::row FoW FoW Island @@ -195,7 +195,7 @@ we had in hand from Ponder to Brainstorm. > Game 1 > On the play -:::row{variant=hand} +:::row DR DD FoW @@ -296,7 +296,7 @@ a land already in hand. Once again returning to our scenario for the chapter: > Game 1 > On the play -:::row{variant=hand} +:::row DR DD FoW diff --git a/src/components/Markdown/renderers/Row.tsx b/src/components/Markdown/renderers/Row.tsx index 1bfa6089..b8941fa8 100644 --- a/src/components/Markdown/renderers/Row.tsx +++ b/src/components/Markdown/renderers/Row.tsx @@ -7,14 +7,14 @@ import { type ExtraProps } from 'react-markdown'; import { Card } from '@/components/Card/Card'; import { gutters } from '@/theme/tools/gutters'; import { type ScryCard } from '@/tools/scryfall/types'; +import { union } from '@/tools/z/union'; -const VARIANTS = { - CENTERED: 'CENTERED', - PILE: 'PILE', -} as const; +const VARIANTS = ['CENTERED', 'PILE'] as const; + +const VARIANTS_SCHEMA = union(VARIANTS).optional(); const STYLES: Record< - keyof typeof VARIANTS, + (typeof VARIANTS)[number], (theme: Theme) => SystemStyleObject > = { CENTERED: ({ mixins }) => ({ @@ -45,10 +45,13 @@ export const Row: FunctionComponent = ({ node, row, variant }) => { console.error('Missing cards for row', node); return null; } - if (variant && !Object.keys(VARIANTS).includes(variant)) { - console.error('Unknown variant for row', node); + let style: (typeof VARIANTS)[number] = 'CENTERED'; + const { data, error } = VARIANTS_SCHEMA.safeParse(variant); + if (error) { + console.error(`Unknown variant "${variant}" for row`); + } else if (data) { + style = data; } - const style = VARIANTS[variant as keyof typeof VARIANTS] || VARIANTS.CENTERED; return ( mixins.barf}>