97 lines
3.6 KiB
HTML
97 lines
3.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>Time Pulse</title>
|
|
|
|
<!-- PWA Manifest -->
|
|
<link rel="manifest" href="manifest.json">
|
|
|
|
<!-- Favicons -->
|
|
<link rel="apple-touch-icon" sizes="180x180" href="../images/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="../images/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="../icons/favicon-16x16.png">
|
|
<link rel="icon" href="../images/favicon.ico" type="image/x-icon">
|
|
|
|
<!-- Tailwind CSS -->
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
|
|
<!-- Fonts -->
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
|
|
<!-- Custom Styles -->
|
|
<link rel="stylesheet" href="/style/style.css">
|
|
</head>
|
|
|
|
<body class="bg-gray-100">
|
|
|
|
<div id="app" class="min-h-screen">
|
|
<header class="bg-white shadow-md">
|
|
<nav class="container mx-auto px-6 py-3 flex justify-between items-center">
|
|
<div class="flex items-center">
|
|
<img src="../images/icon-48x48.webp" alt="Time Pulse Logo" width="48" height="48">
|
|
<h1 class="text-xl font-bold text-gray-800 ml-2">Time Pulse</h1>
|
|
</div>
|
|
<div id="nav-user-controls" class="hidden flex items-center">
|
|
<span id="welcome-message" class="text-gray-600 mr-3 text-sm sm:text-base truncate"></span>
|
|
<button id="sign-out-btn" class="bg-red-500 text-white py-2 px-3 sm:px-4 rounded-lg hover:bg-red-600 text-sm whitespace-nowrap">Sign Out</button>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<main class="container mx-auto px-6 py-8">
|
|
<div id="message-box" class="hidden"></div>
|
|
<div id="loading-spinner" class="hidden text-center py-4"></div>
|
|
<div id="auth-view"></div>
|
|
<div id="employee-dashboard" class="hidden"></div>
|
|
<div id="admin-dashboard" class="hidden"></div>
|
|
<div id="admin-archive-view" class="hidden"></div>
|
|
<div id="admin-time-off-history-view" class="hidden"></div>
|
|
</main>
|
|
|
|
<div id="modal-container"></div>
|
|
</div>
|
|
|
|
<script type="module" src="/js/main.js"></script>
|
|
<script>
|
|
let deferredPrompt;
|
|
|
|
window.addEventListener('beforeinstallprompt', (e) => {
|
|
e.preventDefault();
|
|
deferredPrompt = e;
|
|
console.log('[PWA] beforeinstallprompt fired');
|
|
|
|
// Create the install button
|
|
const installBtn = document.createElement('button');
|
|
installBtn.textContent = 'Install Time Pulse';
|
|
installBtn.className = 'fixed bottom-6 right-6 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition';
|
|
document.body.appendChild(installBtn);
|
|
|
|
// When clicked, trigger the prompt
|
|
installBtn.addEventListener('click', () => {
|
|
installBtn.style.display = 'none'; // hide button
|
|
deferredPrompt.prompt();
|
|
deferredPrompt.userChoice.then((choiceResult) => {
|
|
if (choiceResult.outcome === 'accepted') {
|
|
console.log('[PWA] User accepted install');
|
|
} else {
|
|
console.log('[PWA] User dismissed install');
|
|
}
|
|
deferredPrompt = null;
|
|
});
|
|
});
|
|
});
|
|
|
|
// Optional: show a console message when app is installed
|
|
window.addEventListener('appinstalled', () => {
|
|
console.log('[PWA] Installed');
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|