| | |
| | | <html lang="ru" class="dark"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> |
| | | <title>{% block title %}Amadeus{% endblock %}</title> |
| | | <script> |
| | | // Применяем сохранённую тему до отрисовки, чтобы не мигало. |
| | |
| | | </head> |
| | | <body class="min-h-screen bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100 font-sans antialiased"> |
| | | <div class="flex min-h-screen"> |
| | | <aside class="hidden md:flex w-64 shrink-0 flex-col border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900"> |
| | | <div class="h-16 flex items-center gap-2 px-5 border-b border-gray-200 dark:border-gray-800"> |
| | | <span class="relative inline-flex h-8 w-8 items-center justify-center overflow-hidden rounded-lg bg-brand-600 text-white font-bold"> |
| | | A |
| | | <img src="/avatar/bot" alt="" class="absolute inset-0 h-full w-full object-cover" onerror="this.remove()"> |
| | | </span> |
| | | <span class="text-lg font-semibold">Amadeus</span> |
| | | <!-- Затемнение под мобильным меню --> |
| | | <div id="backdrop" class="fixed inset-0 z-30 hidden bg-black/50 md:hidden"></div> |
| | | |
| | | <aside id="sidebar" |
| | | class="fixed inset-y-0 left-0 z-40 flex w-64 shrink-0 -translate-x-full flex-col border-r border-gray-200 bg-white transition-transform duration-200 dark:border-gray-800 dark:bg-gray-900 md:static md:translate-x-0"> |
| | | <div class="flex h-16 items-center justify-between gap-2 border-b border-gray-200 px-5 dark:border-gray-800"> |
| | | <div class="flex items-center gap-2"> |
| | | <span class="relative inline-flex h-8 w-8 items-center justify-center overflow-hidden rounded-lg bg-brand-600 font-bold text-white"> |
| | | A |
| | | <img src="/avatar/bot" alt="" class="absolute inset-0 h-full w-full object-cover" onerror="this.remove()"> |
| | | </span> |
| | | <span class="text-lg font-semibold">Amadeus</span> |
| | | </div> |
| | | <button id="sidebar-close" class="rounded-lg p-1.5 text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800 md:hidden" aria-label="Закрыть меню"> |
| | | <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6L6 18"/></svg> |
| | | </button> |
| | | </div> |
| | | <nav class="flex-1 p-3 space-y-1 text-sm"> |
| | | <nav class="flex-1 space-y-1 overflow-y-auto p-3 text-sm"> |
| | | {% set items = [ |
| | | ("dash", "/", "Дашборд"), |
| | | ("chats", "/chats", "Чаты"), |
| | |
| | | ("log", "/log", "Журнал") |
| | | ] %} |
| | | {% for key, href, label in items %} |
| | | <a href="{{ href }}" |
| | | class="flex items-center rounded-lg px-3 py-2 transition |
| | | <a href="{{ href }}" onclick="closeSidebar()" |
| | | class="flex items-center rounded-lg px-3 py-2.5 transition |
| | | {% if active == key %}bg-brand-600 text-white shadow{% else %}text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800{% endif %}"> |
| | | {{ label }} |
| | | </a> |
| | | {% endfor %} |
| | | </nav> |
| | | <div class="p-3 border-t border-gray-200 dark:border-gray-800"> |
| | | <div class="border-t border-gray-200 p-3 dark:border-gray-800"> |
| | | <div class="flex items-center gap-3"> |
| | | {% if user and user.photo_url %} |
| | | <img src="{{ user.photo_url }}" class="h-9 w-9 rounded-full object-cover" alt=""> |
| | | {% else %} |
| | | <span class="inline-flex h-9 w-9 items-center justify-center rounded-full bg-gray-200 dark:bg-gray-700 text-sm font-medium"> |
| | | <span class="inline-flex h-9 w-9 items-center justify-center rounded-full bg-gray-200 text-sm font-medium dark:bg-gray-700"> |
| | | {{ (user.first_name or "?")[:1] }} |
| | | </span> |
| | | {% endif %} |
| | |
| | | <div class="truncate text-xs text-gray-500">{% if user.username %}@{{ user.username }}{% else %}id {{ user.user_id }}{% endif %}</div> |
| | | </div> |
| | | </div> |
| | | <a href="/logout" class="mt-3 block text-center rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">Выйти</a> |
| | | <a href="/logout" class="mt-3 block rounded-lg border border-gray-200 px-3 py-1.5 text-center text-sm hover:bg-gray-100 dark:border-gray-700 dark:hover:bg-gray-800">Выйти</a> |
| | | </div> |
| | | </aside> |
| | | |
| | | <div class="flex-1 flex flex-col min-w-0"> |
| | | <header class="h-16 flex items-center justify-between gap-4 px-6 border-b border-gray-200 dark:border-gray-800 bg-white/70 dark:bg-gray-900/70 backdrop-blur"> |
| | | <h1 class="text-lg font-semibold truncate">{% block header %}{% endblock %}</h1> |
| | | <div class="flex min-w-0 flex-1 flex-col"> |
| | | <header class="sticky top-0 z-20 flex h-16 items-center justify-between gap-3 border-b border-gray-200 bg-white/80 px-4 backdrop-blur dark:border-gray-800 dark:bg-gray-900/80 md:px-6"> |
| | | <div class="flex min-w-0 items-center gap-3"> |
| | | <button id="sidebar-open" class="rounded-lg border border-gray-200 p-2 text-gray-600 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800 md:hidden" aria-label="Открыть меню"> |
| | | <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16"/></svg> |
| | | </button> |
| | | <h1 class="truncate text-lg font-semibold">{% block header %}{% endblock %}</h1> |
| | | </div> |
| | | <div class="flex items-center gap-2"> |
| | | <button id="theme-toggle" class="rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">Тема</button> |
| | | <a href="/logout" class="md:hidden rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-1.5 text-sm">Выйти</a> |
| | | <button id="theme-toggle" class="rounded-lg border border-gray-200 px-3 py-1.5 text-sm hover:bg-gray-100 dark:border-gray-700 dark:hover:bg-gray-800">Тема</button> |
| | | <a href="/logout" class="rounded-lg border border-gray-200 px-3 py-1.5 text-sm hover:bg-gray-100 dark:border-gray-700 dark:hover:bg-gray-800 md:hidden">Выйти</a> |
| | | </div> |
| | | </header> |
| | | <main class="p-6 space-y-6"> |
| | | <main class="space-y-6 p-4 md:p-6"> |
| | | {% block content %}{% endblock %} |
| | | </main> |
| | | </div> |
| | |
| | | root.classList.toggle("dark"); |
| | | try { localStorage.setItem("amd-theme", root.classList.contains("dark") ? "dark" : "light"); } catch (e) {} |
| | | }); |
| | | |
| | | // Мобильное меню-«шторка». |
| | | const sidebar = document.getElementById("sidebar"); |
| | | const backdrop = document.getElementById("backdrop"); |
| | | function openSidebar() { |
| | | sidebar.classList.remove("-translate-x-full"); |
| | | backdrop.classList.remove("hidden"); |
| | | } |
| | | function closeSidebar() { |
| | | sidebar.classList.add("-translate-x-full"); |
| | | backdrop.classList.add("hidden"); |
| | | } |
| | | document.getElementById("sidebar-open").addEventListener("click", openSidebar); |
| | | document.getElementById("sidebar-close").addEventListener("click", closeSidebar); |
| | | backdrop.addEventListener("click", closeSidebar); |
| | | document.addEventListener("keydown", function (e) { if (e.key === "Escape") closeSidebar(); }); |
| | | </script> |
| | | </body> |
| | | </html> |