diff options
author | stuebinm | 2022-04-05 20:53:38 +0200 |
---|---|---|
committer | stuebinm | 2022-04-05 20:54:13 +0200 |
commit | 72760b0fe1afcb23acfbefd88e27f052f81f4e21 (patch) | |
tree | 0182352b916832591c82991d9fe517807e9bbcb5 | |
parent | f08c3dbfd38ed4a1195cf36a813eb84c4ccbf4f0 (diff) |
server: less boring output for very successful maps
(actually i feel like there should be an easteregg or sth for maps that
really pass everything, but i can't think of something fitting)
-rw-r--r-- | server/HtmlOrphans.hs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/server/HtmlOrphans.hs b/server/HtmlOrphans.hs index c6f74d5..bf06d4c 100644 --- a/server/HtmlOrphans.hs +++ b/server/HtmlOrphans.hs @@ -131,6 +131,11 @@ badge level = span_ [class_ badgetype] Error -> "badge badge-danger" Fatal -> "badge badge-danger" +-- | pseudo-level badge when we don't even have an info lint +-- (rare, but it does happen!) +badgeHurray :: Monad m => HtmlT m() -> HtmlT m () +badgeHurray = span_ [class_ "badge badge-success"] + -- | Lint Levels directly render into badges instance ToHtml Level where toHtml level = do badge level (show level); " " @@ -216,14 +221,17 @@ instance ToHtml (Org True, RemoteRef, DirResult a) where h2_ "Maps" flip M.foldMapWithKey dirresultMaps $ \name MapResult { .. } -> do h3_ (toHtml name) - ul_ $ forM_ mapresultGeneral $ \lint -> - li_ (toHtml lint) - unless (null mapresultLayer) $ do - h4_ "Layers" - ul_ (listMapWithKey mapresultLayer) - unless (null mapresultTileset) $ do - h4_ "Tilesets" - ul_ (listMapWithKey mapresultTileset) + if null mapresultGeneral && null mapresultLayer && null mapresultTileset + then ul_ $ li_ $ badgeHurray "All good!" + else do + ul_ $ forM_ mapresultGeneral $ \lint -> + li_ (toHtml lint) + unless (null mapresultLayer) $ do + h4_ "Layers" + ul_ (listMapWithKey mapresultLayer) + unless (null mapresultTileset) $ do + h4_ "Tilesets" + ul_ (listMapWithKey mapresultTileset) where maxlevel = maximumLintLevel res |