web: behavior: fix subtle spacing issue
an empty (invisible) metadata table still had a margin-bottom pushing
content after it down by ~5px
@@ -52,7 +52,7 @@ import Routes exposing (Highlight(..), StepID, showHighlight)
import StrictEvents
import Time
import Tooltip
-import Url exposing (fromString)
+import Url
import Views.DictView as DictView
import Views.Icon as Icon
import Views.Spinner as Spinner
@@ -973,12 +973,10 @@ viewVersion version =
viewMetadata : List MetadataField -> Html Message
-viewMetadata =
- List.map
- (\{ name, value } ->
- ( Html.text name
- , Html.pre []
- [ case fromString value of
+viewMetadata meta =
+ let
+ val value =
+ case Url.fromString value of
Just _ ->
Html.a
[ href value
@@ -989,17 +987,22 @@ viewMetadata =
Nothing ->
Html.text value
- ]
- )
- )
- >> List.map
- (\( key, value ) ->
+
+ tr { name, value } =
Html.tr []
- [ Html.td (Styles.metadataCell Styles.Key) [ key ]
- , Html.td (Styles.metadataCell Styles.Value) [ value ]
+ [ Html.td (Styles.metadataCell Styles.Key)
+ [ Html.text name ]
+ , Html.td (Styles.metadataCell Styles.Value)
+ [ val value ]
]
- )
- >> Html.table Styles.metadataTable
+ in
+ if meta == [] then
+ Html.text ""
+
+ else
+ meta
+ |> List.map tr
+ |> Html.table Styles.metadataTable
viewStepStateWithoutTooltip : StepState -> Html Message
