summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-03-20 17:30:22 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-03-20 17:30:22 +0100 |
commit | 125eb8ba1e1707bd5468a96131a740abef3c6f43 (patch) | |
tree | 28216937c3d3403906f347108ab19d89f0afa828 /src/shared/battle/Battle/View/Statistic.elm | |
parent | b6fa3b730fe0c4249e714545ca88d2729c815a9b (diff) |
...
Diffstat (limited to 'src/shared/battle/Battle/View/Statistic.elm')
-rw-r--r-- | src/shared/battle/Battle/View/Statistic.elm | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/src/shared/battle/Battle/View/Statistic.elm b/src/shared/battle/Battle/View/Statistic.elm index 4e2e91a..a3ac669 100644 --- a/src/shared/battle/Battle/View/Statistic.elm +++ b/src/shared/battle/Battle/View/Statistic.elm @@ -8,10 +8,11 @@ module Battle.View.Statistic exposing -- Elm ------------------------------------------------------------------------- import Html -import Html.Statistics +import Html.Attributes +import Html.Events -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistic +import Battle.Struct.Statistics -- Local Module ---------------------------------------------------------------- import Struct.Event @@ -25,9 +26,9 @@ import Struct.HelpRequest -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- get_html : ( - Battle.Struct.Statistic.Category -> + Battle.Struct.Statistics.Category -> Int -> - (List (Html.Html Struct.Event.Type)) + (Html.Html Struct.Event.Type) ) get_html statistic value = (Html.div @@ -41,30 +42,36 @@ get_html statistic value = [ (Html.div [ - (Html.Statistics.class "omnimod-icon"), - (Html.Statistics.class + (Html.Attributes.class "omnimod-icon"), + (Html.Attributes.class ( "omnimod-icon-" - ++ (Battle.Struct.Statistic.encode_category statistic) + ++ (Battle.Struct.Statistics.encode_category statistic) ) - ), + ) ] [ ] ), (Html.div [ - (Html.Statistics.class "omnimod-value") + (Html.Attributes.class "omnimod-value") ] [ - (Html.text ((String.FromInt value) ++ "%")) + (Html.text + ( + if (Battle.Struct.Statistics.is_percent statistic) + then ((String.fromInt value) ++ "%") + else (String.fromInt value) + ) + ) ] ) ] ) get_signed_html : ( - Battle.Struct.Statistic.Category -> + Battle.Struct.Statistics.Category -> Int -> (Html.Html Struct.Event.Type) ) @@ -73,8 +80,8 @@ get_signed_html statistic value = [ ( if (value < 0) - then (Html.Statistics.class "omnimod-negative") - else (Html.Statistics.class "omnimod-positive") + then (Html.Attributes.class "omnimod-negative") + else (Html.Attributes.class "omnimod-positive") ), (Html.Events.onClick (Struct.Event.RequestedHelp @@ -85,31 +92,35 @@ get_signed_html statistic value = [ (Html.div [ - (Html.Statistics.class "omnimod-icon"), - (Html.Statistics.class + (Html.Attributes.class "omnimod-icon"), + (Html.Attributes.class ( "omnimod-icon-" - ++ (Battle.Struct.Statistic.encode_category statistic) + ++ (Battle.Struct.Statistics.encode_category statistic) ) - ), + ) ] [ ] ), (Html.div [ - (Html.Statistics.class "omnimod-value") + (Html.Attributes.class "omnimod-value") ] [ (Html.text ( ( - if (value < 0) - then "-" - else "+" + if (value > 0) + then ("+" ++ (String.fromInt value)) + else (String.fromInt value) + ) + ++ + ( + if (Battle.Struct.Statistics.is_percent statistic) + then "%" + else "" ) - ++ (String.FromInt value) - ++ "%" ) ) ] |