interface to string

This commit is contained in:
DieMyst 2020-11-26 02:46:33 +03:00
parent 370cd20a31
commit 58c8a9a3f7
2 changed files with 27 additions and 4 deletions

View File

@ -22,6 +22,7 @@
"elm-community/graph": "6.0.0",
"elm-community/intdict": "3.0.0",
"ivadzy/bbase64": "1.1.1",
"lukewestby/elm-string-interpolate": "1.0.4",
"mpizenberg/elm-pointer-events": "4.0.2",
"rtfeldman/elm-iso8601-date-strings": "1.1.3"
},

View File

@ -1,8 +1,11 @@
module ModulePage.View exposing (..)
import Html exposing (Html)
import Json.Encode as Encode
import ModulePage.Model exposing (ModuleInfo)
import Palette exposing (classes)
import Services.Model exposing (Record)
import String.Interpolate exposing(interpolate)
view : ModuleInfo -> Html msg
view moduleInfo =
@ -15,8 +18,27 @@ view moduleInfo =
viewInfo : ModuleInfo -> Html msg
viewInfo moduleInfo =
Html.article [classes "cf"]
[ Html.div [classes "fl w-30 gray"] [Html.text "AUTHOR"]
, Html.div [classes "fl w-70"] [ Html.span [classes "fl w-100 black b"] [Html.text moduleInfo.author], Html.span [classes "fl w-100 black"] [Html.text moduleInfo.authorPeerId]]
, Html.div [classes "fl w-30 gray"] [Html.text "DESCRIPTION"]
, Html.div [classes "fl w-70"] [ Html.span [classes "fl w-100 black b"] [Html.text moduleInfo.author]]
[ Html.div [classes "fl w-30 gray mv1"] [Html.text "AUTHOR"]
, Html.div [classes "fl w-70 mv1"] [ Html.span [classes "fl w-100 black b"] [Html.text moduleInfo.author], Html.span [classes "fl w-100 black"] [Html.text moduleInfo.authorPeerId]]
, Html.div [classes "fl w-30 gray mv1"] [Html.text "DESCRIPTION"]
, Html.div [classes "fl w-70 mv1"] [ Html.span [classes "fl w-100 black"] [Html.text moduleInfo.description]]
, Html.div [classes "fl w-30 gray mv1"] [Html.text "INTERFACE"]
, Html.div [classes "fl w-70 mv1"] [ Html.span [classes "fl w-100 black"] (recordsToString moduleInfo.service.interface.record_types)]
]
recordsToString : List Record -> List (Html msg)
recordsToString record =
(List.map recordToString record)
recordToString : Record -> Html msg
recordToString record =
Html.div [classes "i"]
([Html.span [classes "fl w-100 mt2"] [Html.text (record.name ++ " {")]] ++
fieldsToString record.fields ++
[Html.span [classes "fl w-100 mb2"] [Html.text ("}")]])
fieldsToString : List (List String) -> List (Html msg)
fieldsToString fields =
(fields |> List.map (\f -> Html.span [classes "fl w-100 ml2"] [Html.text (String.join ": " f)] ))