gitmirror/templates/base.html
Jonas Rosland 06a77bb5e6 First commit
Signed-off-by: Jonas Rosland <jonas.rosland@gmail.com>
2025-03-14 09:04:43 -04:00

187 lines
No EOL
6.7 KiB
HTML

<!DOCTYPE html>
<html lang="en" data-bs-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}GitHub to Gitea Mirror{% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
<style>
body {
padding-top: 20px;
padding-bottom: 20px;
}
.navbar {
margin-bottom: 20px;
}
.log-content {
background-color: #f8f9fa;
padding: 15px;
border-radius: 5px;
white-space: pre-wrap;
font-family: monospace;
max-height: 600px;
overflow-y: auto;
}
.repo-card {
margin-bottom: 20px;
}
/* Dark mode styles */
[data-bs-theme="dark"] {
--bs-body-bg: #121212;
--bs-body-color: #e0e0e0;
}
[data-bs-theme="dark"] .card {
--bs-card-bg: #1e1e1e;
--bs-card-border-color: #333;
}
[data-bs-theme="dark"] .table {
--bs-table-striped-bg: #2a2a2a;
--bs-table-bg: #1e1e1e;
--bs-table-color: #e0e0e0;
--bs-table-border-color: #333;
}
[data-bs-theme="dark"] .log-content {
background-color: #212529;
color: #f8f9fa;
border: 1px solid #333;
}
[data-bs-theme="dark"] .navbar {
background-color: #1e1e1e !important;
border-color: #333;
}
[data-bs-theme="dark"] .navbar-light .navbar-brand,
[data-bs-theme="dark"] .navbar-light .nav-link {
color: #e0e0e0;
}
[data-bs-theme="dark"] .navbar-light .nav-link:hover {
color: #ffffff;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
background-color: #2a2a2a;
border-color: #444;
color: #e0e0e0;
}
[data-bs-theme="dark"] .form-check-input {
background-color: #2a2a2a;
border-color: #444;
}
/* Dark mode toggle button */
.theme-toggle {
cursor: pointer;
padding: 0.5rem;
display: flex;
align-items: center;
}
.theme-toggle i {
font-size: 1.2rem;
}
[data-bs-theme="dark"] .theme-toggle {
color: #e0e0e0;
}
</style>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light rounded">
<div class="container-fluid">
<a class="navbar-brand" href="/">GitHub to Gitea Mirror</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/repos">Repositories</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/logs">Logs</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/config">
<i class="bi bi-gear"></i> Configuration
</a>
</li>
</ul>
<div class="theme-toggle" id="theme-toggle" title="Toggle dark mode">
<i class="bi bi-sun-fill"></i>
</div>
</div>
</div>
</nav>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category if category != 'message' else 'info' }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="row">
<div class="col-md-12">
{% block content %}{% endblock %}
</div>
</div>
<footer class="mt-5 pt-3 border-top text-muted">
<p>&copy; {{ current_year }} GitHub to Gitea Mirror</p>
</footer>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const themeToggle = document.getElementById('theme-toggle');
const themeIcon = themeToggle.querySelector('i');
const htmlElement = document.documentElement;
// Check for saved theme preference or use preferred color scheme
const savedTheme = localStorage.getItem('theme');
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
// Set initial theme
if (savedTheme === 'dark' || (!savedTheme && prefersDarkMode)) {
htmlElement.setAttribute('data-bs-theme', 'dark');
themeIcon.classList.replace('bi-sun-fill', 'bi-moon-fill');
}
// Toggle theme on click
themeToggle.addEventListener('click', function() {
const currentTheme = htmlElement.getAttribute('data-bs-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
htmlElement.setAttribute('data-bs-theme', newTheme);
localStorage.setItem('theme', newTheme);
// Update icon
if (newTheme === 'dark') {
themeIcon.classList.replace('bi-sun-fill', 'bi-moon-fill');
} else {
themeIcon.classList.replace('bi-moon-fill', 'bi-sun-fill');
}
});
});
</script>
{% block scripts %}{% endblock %}
</body>
</html>