106 lines
4.6 KiB
HTML
106 lines
4.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>RigbyRaffle</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap" rel="stylesheet">
|
|
{% load static %}
|
|
<link rel="stylesheet" href="{% static 'style.css' %}">
|
|
</head>
|
|
|
|
<body data-theme="light">
|
|
<script>
|
|
// Check for saved theme preference or system preference
|
|
const savedTheme = localStorage.getItem('theme');
|
|
if (savedTheme) {
|
|
document.body.setAttribute('data-theme', savedTheme);
|
|
} else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
document.body.setAttribute('data-theme', 'dark');
|
|
}
|
|
</script>
|
|
<div class="blob-bg"></div>
|
|
<nav class="glass-nav">
|
|
<a href="{% url 'item_list' %}" class="logo">Rigby<span>Raffle</span></a>
|
|
<div class="nav-links">
|
|
{% if user.is_authenticated %}
|
|
<span class="welcome-text">Hi, {{ user.username }}</span>
|
|
{% if user.is_auctioneer %}
|
|
<a href="{% url 'item_create' %}" class="btn-primary-small">Add Item</a>
|
|
{% endif %}
|
|
<form method="post" action="{% url 'logout' %}" style="display:inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn-secondary-small">Logout</button>
|
|
</form>
|
|
{% else %}
|
|
<a href="{% url 'login' %}" class="btn-secondary-small">Login</a>
|
|
<a href="{% url 'register' %}" class="btn-primary-small">Register</a>
|
|
{% endif %}
|
|
|
|
<button id="theme-toggle" class="btn-secondary-small"
|
|
style="padding: 0.5rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; width: 40px; height: 40px;"
|
|
aria-label="Toggle Theme">
|
|
<!-- Sun Icon -->
|
|
<svg id="sun-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
|
|
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
style="display: none;">
|
|
<circle cx="12" cy="12" r="5"></circle>
|
|
<line x1="12" y1="1" x2="12" y2="3"></line>
|
|
<line x1="12" y1="21" x2="12" y2="23"></line>
|
|
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
|
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
|
<line x1="1" y1="12" x2="3" y2="12"></line>
|
|
<line x1="21" y1="12" x2="23" y2="12"></line>
|
|
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
|
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
|
</svg>
|
|
<!-- Moon Icon -->
|
|
<svg id="moon-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"
|
|
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
style="display: none;">
|
|
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</nav>
|
|
<main class="container">
|
|
{% block content %}
|
|
{% endblock %}
|
|
</main>
|
|
|
|
<script>
|
|
const themeToggleBtn = document.getElementById('theme-toggle');
|
|
const sunIcon = document.getElementById('sun-icon');
|
|
const moonIcon = document.getElementById('moon-icon');
|
|
|
|
function updateIcon(theme) {
|
|
if (theme === 'dark') {
|
|
sunIcon.style.display = 'block';
|
|
moonIcon.style.display = 'none';
|
|
} else {
|
|
sunIcon.style.display = 'none';
|
|
moonIcon.style.display = 'block';
|
|
}
|
|
}
|
|
|
|
// Initialize icon based on current theme
|
|
const currentTheme = document.body.getAttribute('data-theme') || 'light';
|
|
updateIcon(currentTheme);
|
|
|
|
themeToggleBtn.addEventListener('click', () => {
|
|
let theme = document.body.getAttribute('data-theme');
|
|
let newTheme = theme === 'dark' ? 'light' : 'dark';
|
|
|
|
document.body.setAttribute('data-theme', newTheme);
|
|
localStorage.setItem('theme', newTheme);
|
|
updateIcon(newTheme);
|
|
|
|
// Add a subtle click animation
|
|
themeToggleBtn.style.transform = 'scale(0.9)';
|
|
setTimeout(() => themeToggleBtn.style.transform = 'scale(1)', 150);
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |