module Web.View.WidgetPatterns.Show where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Data.Aeson (encode) import qualified Data.ByteString.Lazy.Char8 as BL data ShowView = ShowView { pattern :: !WidgetPattern , hub :: !Hub , versions :: ![WidgetPatternVersion] , adopterCount :: !Int , anonCount :: !Int , meanFriction :: !(Maybe Double) , outcomeCount :: !Int } instance View ShowView where html ShowView { .. } = [hsx|
Hub: {hub.name}
{tshow adopterCount} adopters
{maybe mempty (\d -> [hsx|{d}
|]) pattern.description} {aggregatePanel adopterCount anonCount meanFriction outcomeCount}No versions published yet.
|] else [hsx|Total Adopters
{tshow adopterCount}
{if anonCount > 0 then [hsx|{tshow anonCount} opted out of aggregate feedback
|] else mempty}Mean Friction Score
{maybe "—" (\f -> tshow (round f :: Int)) meanFriction}
non-anonymous adopters
Outcome Signals
{tshow outcomeCount}
{c}
|]) v.changelog}{cs (BL.unpack (encode v.definition)) :: Text}