Added register page, email field, finished login + register UI, reduced the number of templates generated.

This commit is contained in:
2025-12-06 14:45:23 +01:00
parent e749ec772e
commit 5732fe17de
27 changed files with 889 additions and 284 deletions

View File

@@ -1,5 +1,45 @@
{{ define "home" -}}
<h1>
Hello, Pagerino User!
</h1>
{{- end }}
<div class="min-h-screen bg-gray-100 p-6">
<!-- System Status -->
<div class="bg-white shadow-lg rounded-2xl p-6 mb-8">
<h2 class="text-2xl font-bold text-gray-800 mb-4">System Overview</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="p-4 rounded-lg bg-green-50 border border-green-200">
<p class="text-sm text-gray-500">Status</p>
<p class="text-lg font-semibold text-green-700">Operational</p>
</div>
<div class="p-4 rounded-lg bg-blue-50 border border-blue-200">
<p class="text-sm text-gray-500">Active Devices</p>
<p class="text-lg font-semibold text-blue-700">42</p>
</div>
<div class="p-4 rounded-lg bg-yellow-50 border border-yellow-200">
<p class="text-sm text-gray-500">Pending Alerts</p>
<p class="text-lg font-semibold text-yellow-700">3</p>
</div>
</div>
</div>
<!-- Devices List -->
<div class="bg-white shadow-lg rounded-2xl p-6">
<h2 class="text-xl font-bold text-gray-800 mb-4">Devices</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- Example Device Card -->
<div class="p-4 bg-gray-50 rounded-xl border border-gray-200">
<h3 class="text-lg font-semibold text-gray-700">Device A</h3>
<p class="text-sm text-gray-500">ID: 12345</p>
<p class="mt-2 text-sm text-gray-600">Status: <span class="text-green-600 font-semibold">Online</span></p>
</div>
<div class="p-4 bg-gray-50 rounded-xl border border-gray-200">
<h3 class="text-lg font-semibold text-gray-700">Device B</h3>
<p class="text-sm text-gray-500">ID: 67890</p>
<p class="mt-2 text-sm text-gray-600">Status: <span class="text-red-600 font-semibold">Offline</span></p>
</div>
<div class="p-4 bg-gray-50 rounded-xl border border-gray-200">
<h3 class="text-lg font-semibold text-gray-700">Device C</h3>
<p class="text-sm text-gray-500">ID: 54321</p>
<p class="mt-2 text-sm text-gray-600">Status: <span class="text-yellow-600 font-semibold">Pending</span></p>
</div>
</div>
</div>
</div>

View File

@@ -3,25 +3,25 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/styles/stylesheet.css" rel="stylesheet">
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="manifest" href="/static/site.webmanifest" />
{{ template "meta" . }}
{{ template "meta.tmpl" . }}
</head>
<body class="bg-gray-100">
{{ template "navbar" . }}
<body>
<header>
{{ template "navbar.tmpl" . }}
</header>
<main>
{{ if eq .Page "login" }}
{{ template "login" . }}
{{ template "login.tmpl" . }}
{{ else if eq .Page "home" }}
{{ template "home" . }}
{{ template "home.tmpl" . }}
{{ else if eq .Page "register" }}
{{ template "register.tmpl" . }}
{{ end }}
</main>
<footer>
{{ template "footer" . }}
{{ template "footer.tmpl" . }}
</footer>
</body>
</html>

View File

@@ -1,35 +1,28 @@
{{ define "login" -}}
<div class="flex items-center justify-center min-h-screen bg-gray-100">
<form method="POST" action="/login"
class="bg-white shadow-lg rounded-2xl p-8 w-full max-w-md space-y-6">
<h2 class="text-2xl font-bold text-center text-gray-800">Login</h2>
<div class="flex items-center justify-center min-h-screen">
<div class="w-full max-w-sm card">
<h2 class="card-title">Login</h2>
<!-- Username -->
<div>
<label for="username" class="block text-sm font-medium text-gray-600">Username</label>
<input type="text" id="username" name="username" required
class="mt-1 w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none" />
</div>
<form method="POST" action="/login" class="space-y-4">
<!-- Username -->
<div>
<label for="username" class="input-label">Username</label>
<input type="text" id="username" name="username" required class="input-field" />
</div>
<!-- Password -->
<div>
<label for="password" class="block text-sm font-medium text-gray-600">Password</label>
<input type="password" id="password" name="password" required
class="mt-1 w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none" />
</div>
<!-- Password -->
<div>
<label for="password" class="input-label">Password</label>
<input type="password" id="password" name="password" required class="input-field" />
</div>
<!-- Submit -->
<button type="submit"
class="w-full bg-blue-600 text-white py-2 rounded-lg font-medium hover:bg-blue-700 transition-colors">
Login
</button>
<!-- Submit -->
<button type="submit" class="btn btn-accent">Sign in</button>
</form>
<!-- Optional link -->
<p class="text-sm text-center text-gray-500">
<!-- Register link -->
<p class="mt-6 text-center text-sm text-text-muted">
Dont have an account?
<a href="/register" class="text-blue-600 hover:underline">Sign up</a>
<a href="/register" class="text-accent-muted">Register here</a>
</p>
</form>
</div>
</div>
{{- end }}

View File

@@ -0,0 +1,40 @@
<div class="flex items-center justify-center min-h-screen">
<div class="w-full max-w-md card">
<h2 class="card-title">Create an Account</h2>
<form method="POST" action="/register" class="space-y-4">
<!-- Username -->
<div>
<label for="username" class="input-label">Username</label>
<input type="text" id="username" name="username" required class="input-field" />
</div>
<!-- Email -->
<div>
<label for="email" class="input-label">Email</label>
<input type="email" id="email" name="email" required class="input-field" />
</div>
<!-- Password -->
<div>
<label for="password" class="input-label">Password</label>
<input type="password" id="password" name="password" required class="input-field" />
</div>
<!-- Confirm Password -->
<div>
<label for="confirm_password" class="input-label">Confirm Password</label>
<input type="password" id="confirm_password" name="confirm_password" required class="input-field" />
</div>
<!-- Submit -->
<button type="submit" class="btn btn-accent">Register</button>
</form>
<!-- Link to login -->
<p class="mt-6 text-center text-sm">
Already have an account?
<a href="/login" class="text-accent-muted">Login here</a>
</p>
</div>
</div>