This commit is contained in:
Bryce
2025-10-22 17:34:13 -07:00
commit 2383d1ad9a
15 changed files with 1372 additions and 0 deletions

28
templates/base.html Normal file
View File

@@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ title or 'App' }}</title>
<!-- Tailwind (CDN for demo; consider self-hosting for prod) -->
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="min-h-screen bg-slate-50 text-slate-900">
<header class="border-b bg-white">
<div class="max-w-5xl mx-auto p-4 flex items-center justify-between">
<a href="/" class="font-semibold">Filevine Demo</a>
<nav class="space-x-4">
{% if session.uid %}
<a href="/dashboard" class="text-sm text-slate-600 hover:text-slate-900">Dashboard</a>
<a href="/logout" class="text-sm text-slate-600 hover:text-slate-900">Logout</a>
{% else %}
<a href="/login" class="text-sm text-slate-600 hover:text-slate-900">Login</a>
{% endif %}
</nav>
</div>
</header>
<main class="max-w-5xl mx-auto p-6">
{% block content %}{% endblock %}
</main>
</body>
</html>

45
templates/dashboard.html Normal file
View File

@@ -0,0 +1,45 @@
{% extends 'base.html' %}
{% block content %}
<h1 class="text-xl font-semibold mb-4">Projects for {{ case_email }}</h1>
<div class="bg-white shadow rounded-2xl overflow-hidden">
<table class="min-w-full">
<thead class="bg-slate-100 text-left text-sm">
<tr>
<th class="px-4 py-3">Project Email</th>
<th class="px-4 py-3">Matter Description</th>
<th class="px-4 py-3">Number</th>
<th class="px-4 py-3">Incident Date</th>
<th class="px-4 py-3">Name</th>
<th class="px-4 py-3">Link</th>
</tr>
</thead>
<tbody class="divide-y">
{% for r in rows %}
<tr class="hover:bg-slate-50">
<td class="px-4 py-3 text-sm">{{ r.client or '—' }}</td>
<td class="px-4 py-3 text-sm">{{ r.matter_description or '—' }}</td>
<td class="px-4 py-3 text-sm">
<ul>
{% for c in r.contacts %}
<li>{{ c.orgContact.firstName }}</li>
{% endfor %}
</ul>
</td>
<td class="px-4 py-3 text-sm">{{ r.Number or '—' }}</td>
<td class="px-4 py-3 text-sm">{{ (r.IncidentDate or '')[:10] }}</td>
<td class="px-4 py-3 text-sm">{{ r.ProjectName or '—' }}</td>
<td class="px-4 py-3 text-sm">
{% if r.projectUrl %}
<a class="text-blue-600 hover:underline" href="{{ r.projectUrl }}" target="_blank">Open</a>
{% else %}—{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="5" class="px-4 py-6 text-center text-slate-500">No matching projects found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

69
templates/login.html Normal file
View File

@@ -0,0 +1,69 @@
{% extends 'base.html' %}
{% block content %}
<div class="max-w-md mx-auto bg-white shadow rounded-2xl p-6">
<h1 class="text-xl font-semibold mb-4">Sign in</h1>
<form id="login-form" class="space-y-3">
<div>
<label class="block text-sm mb-1">Email</label>
<input id="email" type="email" required class="w-full border rounded-lg p-2" />
</div>
<div>
<label class="block text-sm mb-1">Password</label>
<input id="password" type="password" required class="w-full border rounded-lg p-2" />
</div>
<button type="submit" class="w-full py-2 rounded-lg bg-slate-900 text-white">Sign in</button>
<p id="error" class="text-sm text-red-600 mt-2 hidden"></p>
</form>
</div>
<!-- Firebase App (the core Firebase SDK) -->
<script src="https://www.gstatic.com/firebasejs/12.4.0/firebase-app-compat.js"></script>
<!-- Firebase Auth -->
<script src="https://www.gstatic.com/firebasejs/12.4.0/firebase-auth-compat.js"></script>
<script>
window.FIREBASE_CONFIG = {{ firebase_config|tojson }};
// import { initializeApp } from 'https://www.gstatic.com/firebasejs/12.4.0/firebase-app.js'
// // If you enabled Analytics in your project, add the Firebase SDK for Google Analytics
// import { getAnalytics } from 'https://www.gstatic.com/firebasejs/12.4.0/firebase-analytics.js'
// // Add Firebase products that you want to use
// import { getAuth } from 'https://www.gstatic.com/firebasejs/12.4.0/firebase-auth.js'
// import { getFirestore } from 'https://www.gstatic.com/firebasejs/12.4.0/firebase-firestore.js'
const app = firebase.initializeApp(window.FIREBASE_CONFIG || {});
const auth = firebase.auth()
console.log(app)
console.log(auth)
console.log(auth.signInWithEmailAndPassword)
const form = document.getElementById('login-form');
const email = document.getElementById('email');
const password = document.getElementById('password');
const err = document.getElementById('error');
form.addEventListener('submit', async (e) => {
e.preventDefault();
err.classList.add('hidden');
try {
const cred = await auth.signInWithEmailAndPassword(email.value, password.value);
const idToken = await cred.user.getIdToken();
const res = await fetch('/session_login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ idToken })
});
if(!res.ok){
throw new Error('Session exchange failed');
}
window.location.href = '/';
} catch (e) {
err.textContent = e.message || 'Login failed';
err.classList.remove('hidden');
}
});
</script>
{% endblock %}

11
templates/welcome.html Normal file
View File

@@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% block content %}
<div class="bg-white shadow rounded-2xl p-6">
<h1 class="text-xl font-semibold mb-2">Welcome!</h1>
<p class="text-slate-700">Your account is almost ready. An administrator will finish setup soon.</p>
<ul class="mt-4 list-disc pl-6 text-sm text-slate-700">
<li><strong>enabled</strong>: {{ 'true' if profile.enabled else 'false' }}</li>
<li><strong>caseEmail</strong>: {{ profile.caseEmail or '—' }}</li>
</ul>
</div>
{% endblock %}