1
0

layout.twig 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE html>
  2. <html lang="en" class="h-full" data-irdb-locale-fallback="{{ ui_locale_fallback|default('') }}">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="csrf-token" content="{{ csrf_token|default('') }}">
  7. <title>{% block title %}IRDB{% endblock %}</title>
  8. {# Dark-mode FOUC prevention: read localStorage before paint, set the class on <html>. #}
  9. <script>
  10. (function () {
  11. try {
  12. var stored = localStorage.getItem('irdb-theme');
  13. var prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
  14. var theme = stored || (prefersDark ? 'dark' : 'light');
  15. if (theme === 'dark') {
  16. document.documentElement.classList.add('dark');
  17. }
  18. } catch (e) {
  19. /* localStorage unavailable — accept default light theme */
  20. }
  21. })();
  22. </script>
  23. <link rel="stylesheet" href="/assets/app.css">
  24. </head>
  25. <body class="h-full bg-slate-50 text-slate-900 antialiased dark:bg-slate-950 dark:text-slate-100">
  26. {% block body %}
  27. {% if current_user %}
  28. {% include 'partials/topnav.twig' %}
  29. <div class="flex min-h-[calc(100vh-4rem)]">
  30. {% include 'partials/sidebar.twig' %}
  31. <main class="flex-1 px-6 py-8">
  32. {% include 'partials/flash.twig' %}
  33. {% block content %}{% endblock %}
  34. </main>
  35. </div>
  36. {% else %}
  37. <main class="min-h-screen">
  38. {% include 'partials/flash.twig' %}
  39. {% block guest_content %}{% endblock %}
  40. </main>
  41. {% endif %}
  42. {% endblock %}
  43. <script src="/assets/app.js" defer></script>
  44. </body>
  45. </html>