module IHP.IDE.Logs.View.Logs where

import IHP.ViewPrelude
import IHP.IDE.ToolServer.Types
import IHP.IDE.ToolServer.Layout ()

data LogsView = LogsView { LogsView -> ByteString
standardOutput :: ByteString, LogsView -> ByteString
errorOutput :: ByteString }

instance View LogsView where
    html :: (?context::ControllerContext, ?view::LogsView) => LogsView -> Html
html LogsView { ByteString
$sel:standardOutput:LogsView :: LogsView -> ByteString
$sel:errorOutput:LogsView :: LogsView -> ByteString
standardOutput :: ByteString
errorOutput :: ByteString
.. } = [hsx|
        <div id="logs">
            <div class="logs-navigation">
                <a href={AppLogsAction} class={classes [("active", isActivePath AppLogsAction)]}>App</a>
                <a href={PostgresLogsAction} class={classes [("active", isActivePath PostgresLogsAction)]}>Postgres</a>
            </div>

            <pre>{standardOutput}</pre>
            <pre>{errorOutput}</pre>
        </div>
    |]