github.com/simpleiot/simpleiot@v0.18.3/frontend/src/Components/NodeShelly.elm (about)

     1  module Components.NodeShelly exposing (view)
     2  
     3  import Api.Point as Point
     4  import Components.NodeOptions exposing (NodeOptions, oToInputO)
     5  import Element exposing (..)
     6  import Element.Border as Border
     7  import UI.Icon as Icon
     8  import UI.NodeInputs as NodeInputs
     9  import UI.Style exposing (colors)
    10  import UI.ViewIf exposing (viewIf)
    11  
    12  
    13  view : NodeOptions msg -> Element msg
    14  view o =
    15      let
    16          disabled =
    17              Point.getBool o.node.points Point.typeDisabled ""
    18      in
    19      column
    20          [ width fill
    21          , Border.widthEach { top = 2, bottom = 0, left = 0, right = 0 }
    22          , Border.color colors.black
    23          , spacing 6
    24          ]
    25      <|
    26          wrappedRow [ spacing 10 ]
    27              [ Icon.shelly
    28              , text <|
    29                  Point.getText o.node.points Point.typeDescription ""
    30              , viewIf disabled <| text "(disabled)"
    31              ]
    32              :: (if o.expDetail then
    33                      let
    34                          labelWidth =
    35                              180
    36  
    37                          opts =
    38                              oToInputO o labelWidth
    39  
    40                          textInput =
    41                              NodeInputs.nodeTextInput opts "0"
    42  
    43                          checkboxInput =
    44                              NodeInputs.nodeCheckboxInput opts "0"
    45                      in
    46                      [ textInput Point.typeDescription "Description" ""
    47                      , checkboxInput Point.typeDisabled "Disabled"
    48                      ]
    49  
    50                  else
    51                      []
    52                 )