app

Safe Haskell None
Language Haskell2010

LootView

Description

Module to display the view reached after a successful end of GameView. This view sits between two games, where the player can pick new cards to augment its deck.

Synopsis

Documentation

view :: Loot -> Styled (View Action) #

Top-level rendering function

data Context #

Context that is common to all calls to deckView

Constructors

Context  

Fields

rewardsViewTopMargin :: Int #

The margin from the top to the row of the rewards

rewardsViewHeight :: Int #

The height of the rewards div: the height of a card plus space for the individual legends atop each card

rewardsView :: Context -> Int -> [(ID, Picked)] -> Styled (View Action) #

The div showing the rewards. It is displayed above deckView

counts :: forall a. Eq a => [a] -> [(a, Nat)] #

Gather equal items, counting them on the way; and *keep the order*. We could use Data.Map.Ordered, but it doesn't have mapFromListWith so it's not really easier.

data DeckCard a #

A dumb container for passing structured data to deckView

Constructors

DeckCard  

Fields

  • card :: a

    The card

  • picked :: Maybe Nat

    If the card comes from the reward, its index in the list of rewards otherwise Nothing.

Instances
Functor DeckCard #  
Instance details

Defined in LootView

Methods

fmap :: (a -> b) -> DeckCard a -> DeckCard b #

(<$) :: a -> DeckCard b -> DeckCard a #

Foldable DeckCard #  
Instance details

Defined in LootView

Methods

fold :: Monoid m => DeckCard m -> m #

foldMap :: Monoid m => (a -> m) -> DeckCard a -> m #

foldr :: (a -> b -> b) -> b -> DeckCard a -> b #

foldr' :: (a -> b -> b) -> b -> DeckCard a -> b #

foldl :: (b -> a -> b) -> b -> DeckCard a -> b #

foldl' :: (b -> a -> b) -> b -> DeckCard a -> b #

foldr1 :: (a -> a -> a) -> DeckCard a -> a #

foldl1 :: (a -> a -> a) -> DeckCard a -> a #

toList :: DeckCard a -> [a] #

null :: DeckCard a -> Bool #

length :: DeckCard a -> Int #

elem :: Eq a => a -> DeckCard a -> Bool #

maximum :: Ord a => DeckCard a -> a #

minimum :: Ord a => DeckCard a -> a #

sum :: Num a => DeckCard a -> a #

product :: Num a => DeckCard a -> a #

Traversable DeckCard #  
Instance details

Defined in LootView

Methods

traverse :: Applicative f => (a -> f b) -> DeckCard a -> f (DeckCard b) #

sequenceA :: Applicative f => DeckCard (f a) -> f (DeckCard a) #

mapM :: Monad m => (a -> m b) -> DeckCard a -> m (DeckCard b) #

sequence :: Monad m => DeckCard (m a) -> m (DeckCard a) #

Eq a => Eq (DeckCard a) #  
Instance details

Defined in LootView

Methods

(==) :: DeckCard a -> DeckCard a -> Bool #

(/=) :: DeckCard a -> DeckCard a -> Bool #

deckView :: Context -> Int -> [DeckCard ID] -> Styled (View Action) #

The div showing the deck. The value of type Picked indicates whether the card is a reward that was picked or a card from the deck of the previous game.