module Web.View.GovernanceTemplates.Show where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Web.Routes () import Data.Aeson (Value(..), decode, encode) import qualified Data.ByteString.Lazy.Char8 as BL data ShowView = ShowView { template :: !GovernanceTemplate , hub :: !Hub , cloneCount :: !Int } instance View ShowView where html ShowView { .. } = [hsx|
Hub: {hub.name}
{tshow cloneCount} clones
{maybe mempty renderTemplateDesc template.description}
{cs (BL.unpack (encode template.templateBody)) :: Text}
{d}
|] jsonArrayTexts :: Value -> [Text] jsonArrayTexts val = case decode (encode val) of Just (arr :: [Text]) -> arr Nothing -> []