just triggered an compiler error, marks it

This commit is contained in:
2019-11-27 21:54:54 +01:00
parent 32ff8bd2d6
commit c52fea683d
7 changed files with 87 additions and 62 deletions

View File

@@ -5,6 +5,7 @@ import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Page.Admin as Admin
import Page.Chest as Chest
import Page.Chest.Wealth as Wealth
import Page.Shop as Shop
import Session exposing (Session)
import Utils exposing (renderIcon)
@@ -83,8 +84,8 @@ view page =
case maybeSession of
Just session ->
case Session.user session of
Session.Player id ->
String.fromInt id
Session.Player player _ ->
player.name
Session.Admin ->
"Administration"
@@ -96,13 +97,13 @@ view page =
case maybeSession of
Just session ->
case Session.user session of
Session.Player id ->
Session.Player player _ ->
let
linkWithGem =
navLink "fas fa-gem"
in
[ navLink "fas fa-store-alt" "Marchand" "/marchand"
, if id == 0 then
, if player.id == 0 then
linkWithGem "Nouveau loot" "/nouveau-tresor"
else
@@ -117,43 +118,52 @@ view page =
in
( title
, { title = navbarTitle, links = navbarLinks }
, viewSessionBar maybeSession controls
:: content
, [ div [ class "container" ] <|
viewSessionBar maybeSession [ controls ]
:: content
]
)
viewSessionBar maybeSession controls =
controls
let
user =
case Maybe.map Session.user maybeSession of
Nothing ->
[ text "" ]
Just (Session.Player player wealth) ->
Wealth.view player.wealth wealth
++ (if player.debt > 0 then
[ div [ class "level-item" ]
[ p [ class "heading is-size-4 has-text-danger" ]
[ text ("Dette : " ++ String.fromInt player.debt ++ "po") ]
]
]
else
[]
)
|> List.map (Html.map Wealth)
Just Session.Admin ->
[ text "Admin" ]
in
section [ class "hero is-dark is-bold" ]
[ div [ class "hero-body" ]
[ renderLevel user controls ]
]
renderLevel left right =
div [ class "level container is-mobile" ]
[ div [ class "level-left" ] left
, div [ class "level-right" ] right
]
-- PLAYER BAR
{-
viewPlayerBar : Player -> List (Html Msg) -> Wealth.Model -> Html Msg
viewPlayerBar player actionControls wealthModel =
section [ class "hero is-dark is-bold" ]
[ div [ class "hero-body" ]
[ div [ class "level container is-mobile" ]
[ div [ class "level-left" ]
(Wealth.view player.wealth wealthModel
++ (if player.debt > 0 then
[ div [ class "level-item" ]
[ p [ class "heading is-size-4 has-text-danger" ]
[ text ("Dette : " ++ String.fromInt player.debt ++ "po") ]
]
]
else
[]
)
)
|> Html.map WealthMsg
, div [ class "level-right" ] actionControls
]
]
]
-}
navLink icon linkText url =
@@ -172,6 +182,7 @@ type PageMsg
= GotChestMsg Chest.Msg
| GotAdminMsg Admin.Msg
| GotShopMsg Shop.Msg
| Wealth Wealth.Msg
update msg page =
@@ -204,7 +215,7 @@ updatePage toPage toMsg ( subModel, subMsg ) =
gotoHome session =
case Session.user session of
Session.Player _ ->
Session.Player _ _ ->
Chest.init session
|> updatePage Chest GotChestMsg