<%- await include('basic/header.html', locals) %>

<style>
    .pre-log-content{
        height: calc(100vh - 252px);
        margin-bottom: 0;
    }
    .nui-height{
        height: calc(100vh - 152px);
    }
</style>

<div>
    <ul class="nav nav-pills nav-tabs justify-content-center mb-2">
        <li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#nav-console"
            role="tab" aria-controls="nav-console" aria-selected="true" onclick="doScroll('consoleLog');">Console Logs</a></li>
        <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#nav-actions"
            role="tab" aria-controls="nav-actions" aria-selected="true" onclick="doScroll('actionsLog');">Actions Logs</a></li>
    </ul>
</div>
<div class="card border-primary">
    <div class="card-body">
        <div class="tab-content <%= isWebInterface ? '' : 'nui-height' %>" id="nav-tabContent">
            <div class="tab-pane fade active show" id="nav-console" role="tabpanel">
                <pre id="consoleLog" class="thin-scroll pre-log-content"><%- consoleLog %></pre>
            </div>
            <div class="tab-pane fade" id="nav-actions" role="tabpanel">
                <pre id="actionsLog" class="thin-scroll pre-log-content"><%- actionLog %></pre>
            </div>
        </div>
    </div>
</div>


<%- await include('basic/footer.html', locals) %>


<script>
    function doScroll(target){
        setTimeout(() => {
            $("#"+target).scrollTop($("#"+target)[0].scrollHeight);
        }, 250);
    }

    $(document).ready(function () {
        $("#consoleLog").scrollTop($("#consoleLog")[0].scrollHeight);
    });
</script>
