module IHP.IDE.CodeGen.View.NewController where import IHP.ViewPrelude import IHP.IDE.CodeGen.Types import IHP.IDE.ToolServer.Types import IHP.IDE.CodeGen.View.Generators (renderPlan) data NewControllerView = NewControllerView { plan :: Either Text [GeneratorAction] , controllerName :: Text , applicationName :: Text , applications :: [Text] , pagination :: Bool } instance View NewControllerView where html NewControllerView { .. } = [hsx|
{renderFlashMessages}
{if isEmpty then renderEmpty else renderPreview} {unless isEmpty (renderPlan plan)}
|] where renderEmpty = [hsx|
{when (length applications /= 1) renderApplicationSelector}
|] renderPreview = [hsx|
{controllerName}
|] renderApplicationOptions = forM_ applications (\x -> [hsx||]) renderApplicationSelector = [hsx| |] isEmpty = null controllerName