Files
loustique-home/flask/templates/dashboard.html

352 lines
9.7 KiB
HTML
Raw Normal View History

2026-03-21 10:53:02 +01:00
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
2026-03-26 14:47:53 +01:00
<title>Loustiques Home — Dashboard</title>
2026-03-21 10:53:02 +01:00
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
2026-03-26 14:47:53 +01:00
font-family: system-ui, sans-serif;
background: #1f1f1f;
color: #f0f0f0;
2026-03-21 10:53:02 +01:00
min-height: 100vh;
}
header {
2026-03-26 14:47:53 +01:00
display: flex;
align-items: center;
justify-content: space-between;
padding: 18px 32px;
border-bottom: 1px solid #2e2e2e;
background: #1a1a1a;
2026-03-21 10:53:02 +01:00
}
.logo {
2026-03-26 14:47:53 +01:00
font-size: 17px;
font-weight: 700;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.header-right {
display: flex;
align-items: center;
gap: 20px;
}
2026-03-21 10:53:02 +01:00
.status-dot {
2026-03-26 14:47:53 +01:00
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
color: #888;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: #4ade80;
animation: pulse 2s infinite;
}
2026-03-21 10:53:02 +01:00
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.logout {
2026-03-26 14:47:53 +01:00
font-family: inherit;
font-size: 12px;
color: #888;
background: none;
border: 1px solid #3a3a3a;
padding: 6px 14px;
border-radius: 6px;
cursor: pointer;
transition: color 0.15s, border-color 0.15s;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.logout:hover { color: #f0f0f0; border-color: #666; }
2026-03-21 10:53:02 +01:00
main {
2026-03-26 14:47:53 +01:00
max-width: 1100px;
margin: 0 auto;
padding: 36px 32px;
2026-03-21 10:53:02 +01:00
}
.welcome {
2026-03-26 14:47:53 +01:00
margin-bottom: 36px;
text-align: center;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.welcome .label {
font-size: 14px;
letter-spacing: 0.15em;
text-transform: uppercase;
color: #2563eb;
margin-bottom: 8px;
}
2026-03-21 10:53:02 +01:00
2026-03-26 14:47:53 +01:00
.welcome h1 {
font-size: 30px;
font-weight: 700;
}
2026-03-21 10:53:02 +01:00
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
2026-03-26 14:47:53 +01:00
gap: 14px;
2026-03-21 10:53:02 +01:00
margin-bottom: 32px;
}
.card {
2026-03-26 14:47:53 +01:00
background: #2a2a2a;
border: 1px solid #333;
border-radius: 8px;
padding: 22px;
2026-03-21 10:53:02 +01:00
position: relative;
}
2026-03-26 14:47:53 +01:00
.card-label {
font-size: 11px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: #888;
margin-bottom: 10px;
}
2026-03-21 10:53:02 +01:00
2026-03-26 14:47:53 +01:00
.card-value {
font-size: 22px;
font-weight: 700;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.card-sub {
font-size: 12px;
color: #666;
margin-top: 6px;
}
2026-03-21 10:53:02 +01:00
.card-icon {
2026-03-26 14:47:53 +01:00
position: absolute;
top: 20px;
right: 20px;
width: 28px;
height: 28px;
opacity: 0.15;
2026-03-21 10:53:02 +01:00
}
.section-title {
2026-03-26 14:47:53 +01:00
font-size: 11px;
letter-spacing: 0.15em;
text-transform: uppercase;
color: #666;
margin-bottom: 14px;
display: flex;
align-items: center;
gap: 10px;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.section-title::after { content: ''; flex: 1; height: 1px; background: #2e2e2e; }
2026-03-21 10:53:02 +01:00
.actions {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 12px;
}
2026-03-26 14:47:53 +01:00
.action-btn {
background: #2a2a2a;
border: 1px solid #333;
border-radius: 8px;
padding: 18px 20px;
cursor: pointer;
text-align: left;
color: #f0f0f0;
position: relative;
transition: border-color 0.15s, background 0.15s;
}
.action-btn:hover { border-color: #2563eb; background: #2e2e3a; }
2026-03-21 10:53:02 +01:00
.action-btn:active { transform: scale(0.98); }
.action-btn .a-label {
2026-03-26 14:47:53 +01:00
font-size: 14px;
font-weight: 600;
display: block;
margin-bottom: 4px;
}
.action-btn .a-sub {
font-size: 11px;
color: #888;
2026-03-21 10:53:02 +01:00
}
.action-btn .a-arrow {
2026-03-26 14:47:53 +01:00
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
color: #555;
font-size: 18px;
transition: color 0.15s, right 0.15s;
2026-03-21 10:53:02 +01:00
}
2026-03-26 14:47:53 +01:00
.action-btn:hover .a-arrow { color: #2563eb; right: 12px; }
2026-03-21 10:53:02 +01:00
.toast {
2026-03-26 14:47:53 +01:00
position: fixed;
bottom: 24px;
right: 24px;
background: #2a2a2a;
border: 1px solid #333;
border-radius: 8px;
padding: 12px 18px;
font-size: 13px;
color: #f0f0f0;
display: flex;
align-items: center;
gap: 10px;
transform: translateY(20px);
opacity: 0;
2026-03-21 10:53:02 +01:00
transition: transform 0.3s, opacity 0.3s;
z-index: 100;
}
.toast.show { transform: translateY(0); opacity: 1; }
2026-03-26 14:47:53 +01:00
.toast-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
2026-03-21 10:53:02 +01:00
</style>
</head>
<body>
<header>
2026-03-26 14:47:53 +01:00
<div class="logo">Loustiques Home</div>
2026-03-21 10:53:02 +01:00
<div class="header-right">
<div class="status-dot"><div class="dot"></div> Système actif</div>
<button class="logout" onclick="window.location.href='/'">Déconnexion</button>
</div>
</header>
<main>
<div class="welcome">
<div class="label">Tableau de bord</div>
2026-03-26 14:47:53 +01:00
<h1>Bienvenue chez vous</h1>
2026-03-21 10:53:02 +01:00
</div>
<div class="grid">
<div class="card">
<svg class="card-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
<div class="card-label">Statut</div>
2026-03-26 14:47:53 +01:00
<div class="card-value" style="color:#4ade80;">En ligne</div>
2026-03-21 10:53:02 +01:00
<div class="card-sub">Serveur opérationnel</div>
</div>
<div class="card">
<svg class="card-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
<div class="card-label">Heure locale</div>
2026-03-26 14:47:53 +01:00
<div class="card-value" id="clock">--:--</div>
2026-03-21 10:53:02 +01:00
<div class="card-sub" id="date-display">--</div>
</div>
<div class="card">
<svg class="card-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
<div class="card-label">Raspberry Pi</div>
2026-03-26 14:47:53 +01:00
<div class="card-value" style="color:#2563eb;">Actif</div>
2026-03-21 10:53:02 +01:00
<div class="card-sub">Flask 3.1</div>
</div>
<div class="card">
<svg class="card-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
<div class="card-label">Session</div>
2026-03-26 14:47:53 +01:00
<div class="card-value">Authentifiée</div>
2026-03-21 10:53:02 +01:00
<div class="card-sub">Accès autorisé</div>
</div>
</div>
<div class="section-title">Actions rapides</div>
<div class="actions">
<button class="action-btn" onclick="callLed()">
<span class="a-label">💡 LED</span>
<span class="a-sub">Contrôler la LED</span>
<span class="a-arrow"></span>
2026-03-27 15:00:11 +01:00
</button>
<button class="action-btn" onclick="callAlarm()">
<span class="a-label">💡 Alarme</span>
<span class="a-sub">Contrôler la alarme</span>
<span class="a-arrow"></span>
2026-03-30 14:00:03 +02:00
</button>
<button class="action-btn" onclick="callBoard1()">
<span class="a-label">💡 Board1</span>
<span class="a-sub">Contrôler la board1</span>
<span class="a-arrow"></span>
2026-03-21 10:53:02 +01:00
</button>
<button class="action-btn" onclick="showToast('Fonction à venir...')">
<span class="a-label">⚙️ Paramètres</span>
<span class="a-sub">Configuration système</span>
<span class="a-arrow"></span>
</button>
<button class="action-btn" onclick="showToast('Fonction à venir...')">
<span class="a-label">📡 Réseau</span>
<span class="a-sub">État de la connexion</span>
<span class="a-arrow"></span>
</button>
2026-03-26 14:47:53 +01:00
<button class="action-btn" onclick="go_admin()">
2026-03-24 23:06:07 +01:00
<span class="a-label">Administration</span>
<span class="a-sub">Administrer les loustiques</span>
<span class="a-arrow"></span>
</button>
2026-03-21 10:53:02 +01:00
</div>
</main>
<div class="toast" id="toast">
<div class="toast-dot"></div>
<span id="toast-text">Action effectuée</span>
</div>
<script>
function updateClock() {
const now = new Date();
document.getElementById("clock").textContent =
now.toLocaleTimeString("fr-FR", { hour: "2-digit", minute: "2-digit" });
document.getElementById("date-display").textContent =
now.toLocaleDateString("fr-FR", { weekday: "long", day: "numeric", month: "long" });
}
updateClock();
setInterval(updateClock, 1000);
2026-03-27 15:00:11 +01:00
async function callLed() {
2026-03-21 10:53:02 +01:00
try {
2026-03-24 23:06:07 +01:00
const res = await fetch('/led', {
2026-03-26 14:47:53 +01:00
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});
2026-03-21 10:53:02 +01:00
showToast("LED activée !");
} catch {
showToast("Erreur lors de l'appel LED.");
}
2026-03-30 14:00:03 +02:00
}
async function callAlarm() {
2026-03-27 15:00:11 +01:00
try {
const res = await fetch('/alarme', {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});
showToast("alarme activée !");
} catch {
showToast("Erreur lors de l'appel alarme.");
}
2026-03-21 10:53:02 +01:00
}
2026-03-30 14:00:03 +02:00
async function callBoard1() {
try {
const res = await fetch('/board1', {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
});
showToast("board1 activée !");
} catch {
showToast("Erreur lors de l'appel board1.");
}
}
2026-03-21 10:53:02 +01:00
2026-03-26 14:47:53 +01:00
function go_admin() {
window.location.href = "/admin";
2026-03-24 23:06:07 +01:00
}
2026-03-26 14:47:53 +01:00
2026-03-21 10:53:02 +01:00
function showToast(msg) {
const toast = document.getElementById("toast");
document.getElementById("toast-text").textContent = msg;
toast.classList.add("show");
setTimeout(() => toast.classList.remove("show"), 3000);
}
</script>
</body>
2026-03-26 14:47:53 +01:00
</html>