Files
bloodpressure/app/templates/_layout.html
2024-12-24 20:32:58 +11:00

88 lines
3.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}BP Tracker{% endblock %}</title>
<script src="/static/js/tailwindcss@3.2.4.js"></script>
<script src="/static/js/alpine.min.js" defer></script>
</head>
<body class="bg-gray-100 text-gray-800">
<!-- Navbar -->
<nav class="bg-blue-600 text-white p-4">
<div class="container mx-auto flex justify-between items-center">
<!-- Logo -->
<a href="/" class="text-2xl font-bold">BP Tracker</a>
<!-- Navigation Links -->
<div class="flex items-center space-x-4">
{% if current_user.is_authenticated %}
<a rel="prefetch" href="{{ url_for('main.dashboard') }}" class="px-4 py-2 hover:underline">Dashboard</a>
<a href="{{ url_for('main.manage_data') }}" class="px-4 py-2 hover:underline">Data</a>
<!-- Profile with Photo or Default Icon -->
<a rel="prefetch" href="{{ url_for('user.profile') }}"
class="relative flex items-center space-x-2 group">
{% if current_user.profile and current_user.profile.profile_pic %}
<img src="data:image/png;base64,{{ current_user.profile.profile_pic }}" alt="Profile Picture"
class="w-8 h-8 rounded-full border-2 border-white object-cover group-hover:scale-105 transition">
{% else %}
<!-- Default SVG Icon -->
<div
class="w-8 h-8 bg-gray-300 rounded-full flex items-center justify-center border-2 border-white">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="w-5 h-5 text-gray-600"
viewBox="0 0 24 24">
<path
d="M12 12c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" />
</svg>
</div>
{% endif %}
<span class="hidden sm:inline text-sm font-medium group-hover:underline">Profile</span>
</a>
<a href="{{ url_for('auth.logout') }}" class="px-4 py-2 bg-red-500 rounded hover:bg-red-600">
Logout
</a>
{% else %}
<a href="{{ url_for('auth.login') }}" class="px-4 py-2 hover:underline">Login</a>
<a href="{{ url_for('auth.signup') }}"
class="px-4 py-2 bg-white text-blue-600 rounded hover:bg-gray-200">
Signup
</a>
{% endif %}
</div>
</div>
</nav>
{% with messages = get_flashed_messages(with_categories=True) %}
{% if messages %}
<div class="container mx-auto mt-4 space-y-4">
{% for category, message in messages %}
<div class="flex items-center justify-between p-4 rounded-lg shadow text-white bg-{{ 'red' if category == 'danger' else 'green' }}-500"
x-data="{ visible: true }" x-show="visible" x-transition.duration.300ms>
<span>{{ message }}</span>
<button @click="visible = false" class="text-xl font-bold">&times;</button>
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<!-- Main Content -->
<main class="container mx-auto mt-6">
{% block content %}
<!-- Content goes here -->
{% endblock %}
</main>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-4 mt-10">
<div class="container mx-auto text-center">
<p>&copy; 2024 BP Tracker. All rights reserved.</p>
</div>
</footer>
</body>
</html>