<!DOCTYPE html>
<html lang="en">
  <head>
      <!-- Meta -->
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />

      <!--[if lt IE 11]>
    	<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    	<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->

      <title>{{ user_manager.USER_APP_NAME }}</title>
      <link rel="stylesheet" href="{{ url_for('static', filename='local/global.css') }}">
      <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
      <link rel="preconnect" href="https://fonts.googleapis.com">
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
      <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk&display=swap" rel="stylesheet">
      {% if config.FONTAWESOME_KIT_ID %}
      <script src="https://kit.fontawesome.com/{{ config.FONTAWESOME_KIT_ID }}.js" crossorigin="anonymous"></script>
      {% else %}
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
      {% endif %}
      {% block extra_head %}{% endblock %}
  </head>

<body style="font-family: 'Space Grotesk', sans-serif;">
    <!-- Header -->
    <header class="header">
        <div class="header-left">
            <a href="/" class="header-logo">
                <em class="fa-solid fa-cubes"></em> {{ user_manager.USER_APP_NAME }}
            </a>
        </div>
        <div class="header-center">
        </div>
        <div class="header-right">
            <ul class="header-nav">
                <li>
                    <a href="{{ url_for('local.about') }}">{%trans%}About{%endtrans%}</a>
                </li>
                {% if user_manager.USER_ENABLE_REGISTER and not user_manager.USER_REQUIRE_INVITATION %}
                    {% if not call_or_get(current_user.is_authenticated) %}
                    <li>
                        <a href="{{ url_for('user.register') }}">{%trans%}Register{%endtrans%}</a>
                    </li>
                    {% endif %}
                {% endif %}
                {% if call_or_get(current_user.is_authenticated) %}
                    <li>
                        <a href="{{ url_for('user.edit_user_profile') }}">
                            <em class="fas fa-user"></em> {{ current_user.username or current_user.email }}
                        </a>
                    </li>
                    <li>
                        <a href="{{ url_for('user.logout') }}">
                            <em class="fas fa-arrow-right-from-bracket"></em> {%trans%}Sign out{%endtrans%}
                        </a>
                    </li>
                {% else %}
                    <li>
                        <a href="{{ url_for('user.login') }}">{%trans%}Sign in{%endtrans%}</a>
                    </li>
                {% endif %}
            </ul>
        </div>
    </header>

    <!-- Sidebar -->
    <aside class="sidebar">
        <ul class="sidebar-menu">
            <li class="sidebar-menu-item">
                <a href="{{ url_for('home.blog_posts') }}" class="sidebar-menu-link">
                    <span class="sidebar-menu-icon"><em class="fa-solid fa-lightbulb"></em></span>
                    <span>Thoughts</span>
                </a>
            </li>
            {% if call_or_get(current_user.is_authenticated) %}
                {% if current_user.has_roles( admin_group_name ) %}
                    <li class="sidebar-section-title">Admin</li>
                    <li class="sidebar-menu-item">
                        <a href="{{ url_for('home.tasks') }}" class="sidebar-menu-link">
                            <span class="sidebar-menu-icon"><em class="fas fa-list"></em></span>
                            <span>Tasks</span>
                        </a>
                    </li>
                    <li class="sidebar-menu-item">
                        <a href="{{ url_for('cmd.terminal') }}" class="sidebar-menu-link">
                            <span class="sidebar-menu-icon"><em class="fas fa-terminal"></em></span>
                            <span>Prompt</span>
                        </a>
                    </li>
                    <li class="sidebar-menu-item">
                        <a href="{{ url_for('admin.system_chart') }}" class="sidebar-menu-link">
                            <span class="sidebar-menu-icon"><i class="fas fa-temperature-half"></i></span>
                            <span>Health</span>
                        </a>
                    </li>
                    <li class="sidebar-menu-item">
                        <a href="{{ url_for('admin.system_perf') }}" class="sidebar-menu-link">
                            <span class="sidebar-menu-icon"><em class="fas fa-chart-line"></em></span>
                            <span>Stats</span>
                        </a>
                    </li>
                    <li class="sidebar-menu-item">
                        <a href="{{ url_for('admin.log_download') }}" class="sidebar-menu-link">
                            <span class="sidebar-menu-icon"><em class="fas fa-file"></em></span>
                            <span>Logs</span>
                        </a>
                    </li>
                {% endif %}
            {% endif %}
        </ul>
    </aside>

    <!-- Main Content -->
    <main class="main-content">
        <div class="content-wrapper">
            {% block main %}{% endblock main %}
        </div>
    </main>

    <script src="{{ url_for('static', filename='vendor/jquery/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='local/global.js') }}"></script>

    {% block extra_js %}{% endblock %}
  </body>
</html>