From 72760b0fe1afcb23acfbefd88e27f052f81f4e21 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 5 Apr 2022 20:53:38 +0200 Subject: 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) --- server/HtmlOrphans.hs | 24 ++++++++++++++++-------- 1 file 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 -- cgit v1.2.3