stabilizes Header and Player bars

This commit is contained in:
2019-11-02 00:42:04 +01:00
parent 1a23eb4c31
commit b5a50bd039
2 changed files with 61 additions and 24 deletions

62
main.js
View File

@@ -6825,11 +6825,13 @@ var $author$project$Main$viewHeaderBar = function (model) {
_List_fromArray( _List_fromArray(
[ [
$elm$html$Html$Attributes$class('navbar-item'), $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( _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 $elm$html$Html$button = _VirtualDom_node('button');
var $author$project$Main$actionButton = function (t) { var $author$project$Main$actionButton = F3(
return A2( function (t, n, c) {
$elm$html$Html$button, return A2(
_List_fromArray( $elm$html$Html$button,
[ _List_fromArray(
$elm$html$Html$Attributes$class('button') [
]), $elm$html$Html$Attributes$class('button is-rounded is-' + c)
_List_fromArray( ]),
[ _List_fromArray(
$elm$html$Html$text(t) [
])); 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( var $author$project$Main$viewPlayerAction = F2(
function (player, route) { function (player, route) {
switch (route.$) { switch (route.$) {
case 'PlayerChest': case 'PlayerChest':
return _List_fromArray( return _List_fromArray(
[ [
$author$project$Main$actionButton('Vendre') A3($author$project$Main$actionButton, 'Vendre', 'coins', 'danger')
]); ]);
case 'GroupLoot': case 'GroupLoot':
return _List_fromArray( return _List_fromArray(
[ [
$author$project$Main$actionButton('Demander') A3($author$project$Main$actionButton, 'Demander', 'coins', 'primary')
]); ]);
case 'Merchant': case 'Merchant':
return _List_fromArray( return _List_fromArray(
[ [
$author$project$Main$actionButton('Acheter') A3($author$project$Main$actionButton, 'Acheter', 'coins', 'success')
]); ]);
default: default:
return _List_fromArray( return _List_fromArray(
[ [
$author$project$Main$actionButton('Valider') A3($author$project$Main$actionButton, 'Valider', 'coins', 'primary'),
A3($author$project$Main$actionButton, 'Annuler', 'coins', 'danger')
]); ]);
} }
}); });

View File

@@ -292,7 +292,15 @@ viewHeaderBar model =
, div [ class "navbar-menu is-active" ] , div [ class "navbar-menu is-active" ]
[ div [class "navbar-end"] [ div [class "navbar-end"]
[ a [class "navbar-item", href "/marchand"] [text "Marchand"] [ 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) , 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 -> List (Html Msg)
viewPlayerAction player route = viewPlayerAction player route =
case route of case route of
PlayerChest -> [actionButton "Vendre" ] PlayerChest -> [actionButton "Vendre" "coins" "danger"]
GroupLoot -> [actionButton "Demander" ] GroupLoot -> [actionButton "Demander" "coins" "primary"]
Merchant -> [actionButton "Acheter" ] Merchant -> [actionButton "Acheter" "coins" "success"]
NewLoot -> [actionButton "Valider" ] NewLoot -> [actionButton "Valider" "coins" "primary", actionButton "Annuler" "coins" "danger"]
showWealth : Wealth -> List (Html Msg) showWealth : Wealth -> List (Html Msg)