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