From b5a50bd03907486463614e2d8f10626f4a4a13cc Mon Sep 17 00:00:00 2001 From: Artus Date: Sat, 2 Nov 2019 00:42:04 +0100 Subject: [PATCH] stabilizes Header and Player bars --- main.js | 62 +++++++++++++++++++++++++++++++++++++--------------- src/Main.elm | 23 ++++++++++++++----- 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/main.js b/main.js index 9723ade..e6fd45b 100644 --- a/main.js +++ b/main.js @@ -6825,11 +6825,13 @@ var $author$project$Main$viewHeaderBar = function (model) { _List_fromArray( [ $elm$html$Html$Attributes$class('navbar-item'), - $elm$html$Html$Attributes$href('/coffre') + $elm$html$Html$Attributes$href( + (!model.player.id) ? '/nouveau-tresor' : '/coffre') ]), _List_fromArray( [ - $elm$html$Html$text('Coffre de groupe') + $elm$html$Html$text( + (!model.player.id) ? 'Nouveau loot' : 'Coffre de groupe') ])) ])) ])) @@ -6912,40 +6914,64 @@ var $author$project$Main$showWealth = function (wealth) { ]); }; var $elm$html$Html$button = _VirtualDom_node('button'); -var $author$project$Main$actionButton = function (t) { - return A2( - $elm$html$Html$button, - _List_fromArray( - [ - $elm$html$Html$Attributes$class('button') - ]), - _List_fromArray( - [ - $elm$html$Html$text(t) - ])); -}; +var $author$project$Main$actionButton = F3( + function (t, n, c) { + return A2( + $elm$html$Html$button, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('button is-rounded is-' + c) + ]), + _List_fromArray( + [ + A2( + $elm$html$Html$span, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('icon') + ]), + _List_fromArray( + [ + A2( + $elm$html$Html$i, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('fas fa-' + n) + ]), + _List_Nil) + ])), + A2( + $elm$html$Html$span, + _List_Nil, + _List_fromArray( + [ + $elm$html$Html$text(t) + ])) + ])); + }); var $author$project$Main$viewPlayerAction = F2( function (player, route) { switch (route.$) { case 'PlayerChest': return _List_fromArray( [ - $author$project$Main$actionButton('Vendre') + A3($author$project$Main$actionButton, 'Vendre', 'coins', 'danger') ]); case 'GroupLoot': return _List_fromArray( [ - $author$project$Main$actionButton('Demander') + A3($author$project$Main$actionButton, 'Demander', 'coins', 'primary') ]); case 'Merchant': return _List_fromArray( [ - $author$project$Main$actionButton('Acheter') + A3($author$project$Main$actionButton, 'Acheter', 'coins', 'success') ]); default: return _List_fromArray( [ - $author$project$Main$actionButton('Valider') + A3($author$project$Main$actionButton, 'Valider', 'coins', 'primary'), + A3($author$project$Main$actionButton, 'Annuler', 'coins', 'danger') ]); } }); diff --git a/src/Main.elm b/src/Main.elm index 4cfa0bd..67381ae 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -292,7 +292,15 @@ viewHeaderBar model = , div [ class "navbar-menu is-active" ] [ div [class "navbar-end"] [ a [class "navbar-item", href "/marchand"] [text "Marchand"] - , a [class "navbar-item", href "/coffre"] [text "Coffre de groupe"] + , a + [ class "navbar-item" + , href (if model.player.id == 0 + then + "/nouveau-tresor" + else + "/coffre") + ] + [text (if model.player.id == 0 then "Nouveau loot" else "Coffre de groupe")] ] ] @@ -321,15 +329,18 @@ viewPlayerBar player route = , div [class "level-right"] (viewPlayerAction player route) ] -actionButton t = button [ class "button" ] [ text t ] +actionButton t n c = button [ class ("button is-rounded is-" ++ c) ] + [ span [ class "icon" ] [ i [ class ("fas fa-" ++ n) ] [] ] + , span [] [ text t ] + ] viewPlayerAction : Player -> Route -> List (Html Msg) viewPlayerAction player route = case route of - PlayerChest -> [actionButton "Vendre" ] - GroupLoot -> [actionButton "Demander" ] - Merchant -> [actionButton "Acheter" ] - NewLoot -> [actionButton "Valider" ] + PlayerChest -> [actionButton "Vendre" "coins" "danger"] + GroupLoot -> [actionButton "Demander" "coins" "primary"] + Merchant -> [actionButton "Acheter" "coins" "success"] + NewLoot -> [actionButton "Valider" "coins" "primary", actionButton "Annuler" "coins" "danger"] showWealth : Wealth -> List (Html Msg)