diff --git a/public/main.js b/public/main.js index ae5f7dfd1a3920c2b296ee7825789138c8ba2dea..9e93f342fcff837e471eb53c6a41f3bf8ee93131 100644 --- a/public/main.js +++ b/public/main.js @@ -5544,100 +5544,9 @@ var $elm$html$Html$Attributes$stringProperty = F2( }); var $elm$html$Html$Attributes$class = $elm$html$Html$Attributes$stringProperty('className'); var $elm$html$Html$div = _VirtualDom_node('div'); +var $elm$html$Html$p = _VirtualDom_node('p'); var $elm$virtual_dom$VirtualDom$text = _VirtualDom_text; var $elm$html$Html$text = $elm$virtual_dom$VirtualDom$text; -var $elm$html$Html$p = _VirtualDom_node('p'); -var $author$project$Main$ChangePriority = F2( - function (a, b) { - return {$: 'ChangePriority', a: a, b: b}; - }); -var $author$project$Stats$isAttributeOfCategory = F2( - function (category, stat) { - return _Utils_eq( - stat.statType, - $author$project$Stats$Attribute(category)); - }); -var $author$project$Stats$attributesOfCategoryInList = F2( - function (category, stats) { - return A2( - $elm$core$List$filter, - $author$project$Stats$isAttributeOfCategory(category), - stats); - }); -var $elm$html$Html$button = _VirtualDom_node('button'); -var $author$project$OrderedAttributeCategories$categoryValue = F2( - function (oac, category) { - var index = A2($author$project$OrderedAttributeCategories$indexOf, oac.order, category); - return A2( - $elm$core$Maybe$withDefault, - _Utils_Tuple2(0, 0), - $elm$core$List$head( - A2( - $elm$core$List$filter, - function (x) { - return _Utils_eq(x.a, index); - }, - A2($elm$core$List$indexedMap, $elm$core$Tuple$pair, oac.points)))).b; - }); -var $elm$core$List$sum = function (numbers) { - return A3($elm$core$List$foldl, $elm$core$Basics$add, 0, numbers); -}; -var $author$project$Stats$count = function (stats) { - return $elm$core$List$sum( - A2( - $elm$core$List$map, - function ($) { - return $.value; - }, - A2( - $elm$core$List$map, - function ($) { - return $.dots; - }, - stats))); -}; -var $elm$core$Basics$compare = _Utils_compare; -var $author$project$Main$creationInfo = function (points) { - var notificationColor = function () { - var _v0 = A2($elm$core$Basics$compare, points, 0); - switch (_v0.$) { - case 'GT': - return 'is-warning'; - case 'EQ': - return 'is-success'; - default: - return 'is-danger'; - } - }(); - return A2( - $elm$html$Html$div, - _List_fromArray( - [ - $elm$html$Html$Attributes$class('notification ' + notificationColor) - ]), - _List_fromArray( - [ - $elm$html$Html$text( - $elm$core$String$fromInt(points) + ' remaining') - ])); -}; -var $elm$virtual_dom$VirtualDom$Normal = function (a) { - return {$: 'Normal', a: a}; -}; -var $elm$virtual_dom$VirtualDom$on = _VirtualDom_on; -var $elm$html$Html$Events$on = F2( - function (event, decoder) { - return A2( - $elm$virtual_dom$VirtualDom$on, - event, - $elm$virtual_dom$VirtualDom$Normal(decoder)); - }); -var $elm$html$Html$Events$onClick = function (msg) { - return A2( - $elm$html$Html$Events$on, - 'click', - $elm$json$Json$Decode$succeed(msg)); -}; var $elm$core$String$fromFloat = _String_fromNumber; var $elm$svg$Svg$Attributes$height = _VirtualDom_attribute('height'); var $elm$core$List$map3 = _List_map3; @@ -5703,6 +5612,23 @@ var $elm$core$Tuple$mapSecond = F2( x, func(y)); }); +var $elm$virtual_dom$VirtualDom$Normal = function (a) { + return {$: 'Normal', a: a}; +}; +var $elm$virtual_dom$VirtualDom$on = _VirtualDom_on; +var $elm$html$Html$Events$on = F2( + function (event, decoder) { + return A2( + $elm$virtual_dom$VirtualDom$on, + event, + $elm$virtual_dom$VirtualDom$Normal(decoder)); + }); +var $elm$html$Html$Events$onClick = function (msg) { + return A2( + $elm$html$Html$Events$on, + 'click', + $elm$json$Json$Decode$succeed(msg)); +}; var $elm$svg$Svg$Attributes$points = _VirtualDom_attribute('points'); var $elm$svg$Svg$polygon = $elm$svg$Svg$trustedNode('polygon'); var $elm$svg$Svg$Attributes$stroke = _VirtualDom_attribute('stroke'); @@ -5777,11 +5703,11 @@ var $author$project$Main$viewDots = function (stat) { $elm$core$List$map, $elm$core$Basics$gt(stat.dots.value), rangeList); - var dotSize = 12; + var dotSize = 12 * 2; var dotOutline = 0.05 * dotSize; var svgOutlineMargin = $elm$core$Basics$sqrt( 2 * A2($elm$core$Basics$pow, dotOutline, 2)) / 2; - var dotGap = 4; + var dotGap = dotSize / 2; var marginalIncrease = (dotSize + dotGap) / 2; return A2( $elm$svg$Svg$svg, @@ -5813,20 +5739,130 @@ var $author$project$Main$viewStat = function (stat) { [ A2( $elm$html$Html$p, - _List_Nil, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('block') + ]), _List_fromArray( [ $elm$html$Html$text(stat.name) ])), A2( $elm$html$Html$p, - _List_Nil, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('block') + ]), _List_fromArray( [ $author$project$Main$viewDots(stat) ])) ])); }; +var $author$project$Main$viewArete = function (arete) { + return A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('has-text-centered') + ]), + _List_fromArray( + [ + A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('columns is-centered is-mobile') + ]), + _List_fromArray( + [ + A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('column is-three-fifths') + ]), + _List_fromArray( + [ + $author$project$Main$viewStat(arete) + ])) + ])) + ])); +}; +var $author$project$Main$ChangePriority = F2( + function (a, b) { + return {$: 'ChangePriority', a: a, b: b}; + }); +var $author$project$Stats$isAttributeOfCategory = F2( + function (category, stat) { + return _Utils_eq( + stat.statType, + $author$project$Stats$Attribute(category)); + }); +var $author$project$Stats$attributesOfCategoryInList = F2( + function (category, stats) { + return A2( + $elm$core$List$filter, + $author$project$Stats$isAttributeOfCategory(category), + stats); + }); +var $elm$html$Html$button = _VirtualDom_node('button'); +var $author$project$OrderedAttributeCategories$categoryValue = F2( + function (oac, category) { + var index = A2($author$project$OrderedAttributeCategories$indexOf, oac.order, category); + return A2( + $elm$core$Maybe$withDefault, + _Utils_Tuple2(0, 0), + $elm$core$List$head( + A2( + $elm$core$List$filter, + function (x) { + return _Utils_eq(x.a, index); + }, + A2($elm$core$List$indexedMap, $elm$core$Tuple$pair, oac.points)))).b; + }); +var $elm$core$List$sum = function (numbers) { + return A3($elm$core$List$foldl, $elm$core$Basics$add, 0, numbers); +}; +var $author$project$Stats$count = function (stats) { + return $elm$core$List$sum( + A2( + $elm$core$List$map, + function ($) { + return $.value; + }, + A2( + $elm$core$List$map, + function ($) { + return $.dots; + }, + stats))); +}; +var $elm$core$Basics$compare = _Utils_compare; +var $author$project$Main$creationInfo = function (points) { + var notificationColor = function () { + var _v0 = A2($elm$core$Basics$compare, points, 0); + switch (_v0.$) { + case 'GT': + return 'is-warning'; + case 'EQ': + return 'is-success'; + default: + return 'is-danger'; + } + }(); + return A2( + $elm$html$Html$div, + _List_fromArray( + [ + $elm$html$Html$Attributes$class('notification ' + notificationColor) + ]), + _List_fromArray( + [ + $elm$html$Html$text( + $elm$core$String$fromInt(points) + ' remaining') + ])); +}; var $author$project$Main$viewAttributeCol = F4( function (oac, name, category, attributes) { var index = A2($author$project$OrderedAttributeCategories$indexOf, oac.order, category); @@ -5928,8 +5964,8 @@ var $author$project$Main$viewAttributeCol = F4( ]), A2($elm$core$List$map, $author$project$Main$viewStat, categoryAttributes))); }); -var $author$project$Main$viewAttributes = F3( - function (cp, oac, attributes) { +var $author$project$Main$viewAttributes = F2( + function (oac, attributes) { return A2( $elm$html$Html$div, _List_fromArray( @@ -5949,7 +5985,7 @@ var $author$project$Main$viewAttributes = F3( $elm$html$Html$div, _List_fromArray( [ - $elm$html$Html$Attributes$class('columns is-centered') + $elm$html$Html$Attributes$class('columns is-centered is-mobile') ]), _List_fromArray( [ @@ -6223,7 +6259,7 @@ var $author$project$Main$viewSpheres = F2( $elm$html$Html$div, _List_fromArray( [ - $elm$html$Html$Attributes$class('columns is-centered') + $elm$html$Html$Attributes$class('columns is-centered is-mobile') ]), _List_fromArray( [ @@ -6242,7 +6278,7 @@ var $author$project$Main$viewSpheres = F2( $elm$html$Html$div, _List_fromArray( [ - $elm$html$Html$Attributes$class('columns is-centered') + $elm$html$Html$Attributes$class('columns is-centered is-mobile') ]), _List_fromArray( [ @@ -6292,30 +6328,14 @@ var $author$project$Main$view = function (model) { _List_fromArray( [ A2($author$project$Main$viewEditableText, $author$project$Main$Name, model.character.name), - A3($author$project$Main$viewAttributes, model.character.creationPoints, model.character.creationPoints.attributes, model.character.stats), + A2($author$project$Main$viewAttributes, model.character.creationPoints.attributes, model.character.stats), A2( $author$project$Main$viewSpheres, model.character.creationPoints, $author$project$Stats$spheresInList(model.character.stats)), - $author$project$Main$viewStat( + $author$project$Main$viewArete( $author$project$Stats$areteInList(model.character.stats)), - $author$project$Main$viewModal(model), - A2( - $elm$html$Html$div, - _List_Nil, - _List_fromArray( - [ - $elm$html$Html$text( - 'freebie: ' + $elm$core$String$fromInt(model.character.creationPoints.freebie)) - ])), - A2( - $elm$html$Html$div, - _List_Nil, - _List_fromArray( - [ - $elm$html$Html$text( - 'spheres: ' + $elm$core$String$fromInt(model.character.creationPoints.spheres)) - ])) + $author$project$Main$viewModal(model) ])) ]), title: 'Character Sheet' diff --git a/src/Main.elm b/src/Main.elm index 6b9d3a788c3d92c073806f57bf113607bb62490c..8485b668de232c2eb50bebc488ee5b7bf729f2ab 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -94,12 +94,10 @@ view model = , body = [ div [ class "container is-max-desktop" ] [ viewEditableText Name model.character.name - , viewAttributes model.character.creationPoints model.character.creationPoints.attributes model.character.stats + , viewAttributes model.character.creationPoints.attributes model.character.stats , viewSpheres model.character.creationPoints ( Stats.spheresInList model.character.stats ) - , viewStat ( Stats.areteInList model.character.stats ) + , viewArete ( Stats.areteInList model.character.stats ) , viewModal model - , div [] [ text ( "freebie: " ++ String.fromInt model.character.creationPoints.freebie ) ] - , div [] [ text ( "spheres: " ++ String.fromInt model.character.creationPoints.spheres ) ] ] ] } @@ -120,11 +118,11 @@ viewEditableText modalType content = ] ] -viewAttributes : CreationPoints -> OAC -> List Stat -> Html Msg -viewAttributes cp oac attributes = +viewAttributes : OAC -> List Stat -> Html Msg +viewAttributes oac attributes = div [ class "has-text-centered" ] [ p [] [ text "Attributes" ] - , div [ class "columns is-centered" ] + , div [ class "columns is-centered is-mobile" ] [ viewAttributeCol oac "Physical" Stats.Physical attributes , viewAttributeCol oac "Social" Stats.Social attributes , viewAttributeCol oac "Mental" Stats.Mental attributes @@ -183,12 +181,12 @@ viewSpheres cp spheres = in div [ class "has-text-centered" ] [ p [] [ text "Spheres" ] - , div [ class "columns is-centered" ] + , div [ class "columns is-centered is-mobile" ] [ div [ class "column is-three-fifths" ] [ creationInfo points ] ] - , div [ class "columns is-centered" ] + , div [ class "columns is-centered is-mobile" ] [ div [ class "column is-one-fifth" ] ( List.map viewStat ( Stats.everyThirdStat spheres 0 ) ) @@ -215,21 +213,30 @@ creationInfo points = [ text ( ( String.fromInt points ) ++ " remaining" ) ] +viewArete : Stat -> Html Msg +viewArete arete = + div [ class "has-text-centered" ] + [ div [ class "columns is-centered is-mobile" ] + [ div [ class "column is-three-fifths" ] + [ viewStat arete + ] + ] + ] + viewStat : Stat -> Html Msg viewStat stat = div [ class "notification" ] - [ p [] [ text stat.name ] - , p [] [ viewDots stat ] + [ p [ class "block" ] [ text stat.name ] + , p [ class "block" ] [ viewDots stat ] ] - viewDots : Stat -> Html Msg viewDots stat = let - dotSize = 12 - dotGap = 4 + dotSize = 12*2 + dotGap = dotSize / 2 dotOutline = 0.05 * dotSize - marginalIncrease = ( dotSize + dotGap ) / 2 + marginalIncrease = ( dotSize + dotGap ) / 2 svgOutlineMargin = ( sqrt ( 2 * ( dotOutline ^ 2 ) ) ) / 2 rangeList = List.range 0 ( stat.dots.max - 1 )