netviz/app/templates/base.html
2025-03-25 23:41:13 +01:00

166 lines
No EOL
7 KiB
HTML

<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}NetViz{% endblock %}</title>
<meta name="description" content="Secure Network Documentation & Visualization Tool">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
primary: '#3B82F6', /* blue-500 */
secondary: '#10B981', /* emerald-500 */
accent: '#8B5CF6', /* violet-500 */
}
}
}
}
// Check for dark mode preference
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
} else {
document.documentElement.classList.remove('dark')
}
</script>
<!-- HTMX -->
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
<!-- Custom CSS -->
<style>
[x-cloak] {
display: none !important;
}
</style>
{% block head %}{% endblock %}
</head>
<body class="h-full bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-100">
<header class="bg-white dark:bg-gray-800 shadow-md">
<nav class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<div class="flex-shrink-0 flex items-center">
<a href="{{ url_for('core.index') }}" class="text-2xl font-bold text-primary">
NetViz
</a>
</div>
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
{% if current_user.is_authenticated %}
<a href="{{ url_for('core.dashboard') }}"
class="border-transparent text-gray-500 dark:text-gray-300 hover:text-gray-700 hover:dark:text-white hover:border-primary inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
Dashboard
</a>
{% endif %}
<a href="#"
class="border-transparent text-gray-500 dark:text-gray-300 hover:text-gray-700 hover:dark:text-white hover:border-primary inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
Documentation
</a>
<a href="#"
class="border-transparent text-gray-500 dark:text-gray-300 hover:text-gray-700 hover:dark:text-white hover:border-primary inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
About
</a>
</div>
</div>
<div class="hidden sm:ml-6 sm:flex sm:items-center">
<!-- Dark mode toggle -->
<button type="button" id="dark-mode-toggle"
class="p-1 rounded-full text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 block dark:hidden" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hidden dark:block" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
</svg>
</button>
<!-- User menu -->
<div class="ml-3 relative">
{% if current_user.is_authenticated %}
<div class="flex items-center">
<span class="mr-2">{{ current_user.username }}</span>
<a href="{{ url_for('auth.logout') }}"
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-primary hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Logout
</a>
</div>
{% else %}
<div>
<a href="{{ url_for('auth.login') }}"
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-primary hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Login
</a>
<a href="{{ url_for('auth.register') }}"
class="ml-2 inline-flex items-center px-3 py-2 border border-gray-300 dark:border-gray-600 text-sm leading-4 font-medium rounded-md text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
Register
</a>
</div>
{% endif %}
</div>
</div>
</div>
</nav>
</header>
<main class="max-w-7xl mx-auto py-6 sm:px-6 lg:px-8">
<!-- Flash messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages">
{% for category, message in messages %}
<div class="mb-4 p-4 rounded-md
{% if category == 'success' %}bg-green-50 dark:bg-green-900 text-green-800 dark:text-green-100
{% elif category == 'danger' %}bg-red-50 dark:bg-red-900 text-red-800 dark:text-red-100
{% elif category == 'warning' %}bg-yellow-50 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-100
{% else %}bg-blue-50 dark:bg-blue-900 text-blue-800 dark:text-blue-100{% endif %}">
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<!-- Main content -->
{% block content %}{% endblock %}
</main>
<footer class="bg-white dark:bg-gray-800 py-6 mt-10">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="border-t border-gray-200 dark:border-gray-700 pt-6">
<p class="text-center text-sm text-gray-500 dark:text-gray-400">
&copy; {{ current_year }} NetViz. All rights reserved.
</p>
</div>
</div>
</footer>
<!-- Dark mode toggle script -->
<script>
document.getElementById('dark-mode-toggle').addEventListener('click', function () {
if (document.documentElement.classList.contains('dark')) {
document.documentElement.classList.remove('dark')
localStorage.theme = 'light'
} else {
document.documentElement.classList.add('dark')
localStorage.theme = 'dark'
}
});
</script>
{% block scripts %}{% endblock %}
</body>
</html>