v1
This commit is contained in:
parent
95cf0af616
commit
f96cd48907
25
add_session.php
Normal file
25
add_session.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$start_time = $_POST['start_time'] ?? '';
|
||||||
|
$end_time = $_POST['end_time'] ?? '';
|
||||||
|
$rating = isset($_POST['rating']) ? (int)$_POST['rating'] : null;
|
||||||
|
|
||||||
|
if ($start_time && $end_time) {
|
||||||
|
try {
|
||||||
|
$stmt = db()->prepare("INSERT INTO sleep_sessions (start_time, end_time, rating) VALUES (?, ?, ?)");
|
||||||
|
$stmt->execute([$start_time, $end_time, $rating]);
|
||||||
|
header('Location: index.php?success=1');
|
||||||
|
exit;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Error saving session: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Location: index.php?error=missing_fields');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
@ -1,346 +1,124 @@
|
|||||||
:root {
|
:root {
|
||||||
--color-bg: #ffffff;
|
--bg-night: #0a0e1b;
|
||||||
--color-text: #1a1a1a;
|
--accent-indigo: #6366f1; /* Slightly brighter indigo */
|
||||||
--color-primary: #2563EB; /* Vibrant Blue */
|
--accent-teal: #14b8a6;
|
||||||
--color-secondary: #000000;
|
--glass-bg: rgba(255, 255, 255, 0.07);
|
||||||
--color-accent: #A3E635; /* Lime Green */
|
--glass-border: rgba(255, 255, 255, 0.15);
|
||||||
--color-surface: #f8f9fa;
|
--font-main: 'Inter', sans-serif;
|
||||||
--font-heading: 'Space Grotesk', sans-serif;
|
|
||||||
--font-body: 'Inter', sans-serif;
|
|
||||||
--border-width: 2px;
|
|
||||||
--shadow-hard: 5px 5px 0px #000;
|
|
||||||
--shadow-hover: 8px 8px 0px #000;
|
|
||||||
--radius-pill: 50rem;
|
|
||||||
--radius-card: 1rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body.bg-night {
|
||||||
font-family: var(--font-body);
|
background: radial-gradient(circle at top right, #1e1b4b, #0a0e1b);
|
||||||
background-color: var(--color-bg);
|
|
||||||
color: var(--color-text);
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6, .navbar-brand {
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
letter-spacing: -0.03em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Utilities */
|
|
||||||
.text-primary { color: var(--color-primary) !important; }
|
|
||||||
.bg-black { background-color: #000 !important; }
|
|
||||||
.text-white { color: #fff !important; }
|
|
||||||
.shadow-hard { box-shadow: var(--shadow-hard); }
|
|
||||||
.border-2-black { border: var(--border-width) solid #000; }
|
|
||||||
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
|
|
||||||
|
|
||||||
/* Navbar */
|
|
||||||
.navbar {
|
|
||||||
background: rgba(255, 255, 255, 0.9);
|
|
||||||
backdrop-filter: blur(10px);
|
|
||||||
border-bottom: var(--border-width) solid transparent;
|
|
||||||
transition: all 0.3s;
|
|
||||||
padding-top: 1rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar.scrolled {
|
|
||||||
border-bottom-color: #000;
|
|
||||||
padding-top: 0.5rem;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-text {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link {
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--color-text);
|
|
||||||
margin-left: 1rem;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link:hover, .nav-link.active {
|
|
||||||
color: var(--color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Buttons */
|
|
||||||
.btn {
|
|
||||||
font-weight: 700;
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
padding: 0.8rem 2rem;
|
|
||||||
border-radius: var(--radius-pill);
|
|
||||||
border: var(--border-width) solid #000;
|
|
||||||
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
|
|
||||||
box-shadow: var(--shadow-hard);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn:hover {
|
|
||||||
transform: translate(-2px, -2px);
|
|
||||||
box-shadow: var(--shadow-hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn:active {
|
|
||||||
transform: translate(2px, 2px);
|
|
||||||
box-shadow: 0 0 0 #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: var(--color-primary);
|
|
||||||
border-color: #000;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #1d4ed8;
|
|
||||||
border-color: #000;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-outline-dark {
|
|
||||||
background-color: #fff;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cta {
|
|
||||||
background-color: var(--color-accent);
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-cta:hover {
|
|
||||||
background-color: #8cc629;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hero Section */
|
|
||||||
.hero-section {
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-top: 80px;
|
font-family: var(--font-main);
|
||||||
|
color: #ffffff !important; /* Force white text */
|
||||||
}
|
}
|
||||||
|
|
||||||
.background-blob {
|
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
|
||||||
position: absolute;
|
color: #ffffff !important;
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
opacity: 0.6;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-1 {
|
|
||||||
top: -10%;
|
|
||||||
right: -10%;
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
background: radial-gradient(circle, var(--color-accent), transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-2 {
|
|
||||||
bottom: 10%;
|
|
||||||
left: -10%;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: radial-gradient(circle, var(--color-primary), transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.highlight-text {
|
|
||||||
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 100% 40%;
|
|
||||||
background-position: 0 88%;
|
|
||||||
padding: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dot { color: var(--color-primary); }
|
|
||||||
|
|
||||||
.badge-pill {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: 50px;
|
|
||||||
font-weight: 700;
|
|
||||||
background: #fff;
|
|
||||||
box-shadow: 4px 4px 0 #000;
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Marquee */
|
|
||||||
.marquee-container {
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
border-top: 2px solid #000;
|
|
||||||
border-bottom: 2px solid #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rotate-divider {
|
|
||||||
transform: rotate(-2deg) scale(1.05);
|
|
||||||
z-index: 10;
|
|
||||||
position: relative;
|
|
||||||
margin-top: -50px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.marquee-content {
|
|
||||||
display: inline-block;
|
|
||||||
animation: marquee 20s linear infinite;
|
|
||||||
font-family: var(--font-heading);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
letter-spacing: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes marquee {
|
|
||||||
0% { transform: translateX(0); }
|
|
||||||
100% { transform: translateX(-50%); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Portfolio Cards */
|
|
||||||
.project-card {
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: var(--radius-card);
|
|
||||||
overflow: hidden;
|
|
||||||
background: #fff;
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
box-shadow: var(--shadow-hard);
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
.project-card:hover {
|
|
||||||
transform: translateY(-10px);
|
|
||||||
box-shadow: 8px 8px 0 #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-img-holder {
|
|
||||||
height: 250px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
border-bottom: 2px solid #000;
|
|
||||||
position: relative;
|
|
||||||
font-size: 4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.placeholder-art {
|
|
||||||
transition: transform 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.project-card:hover .placeholder-art {
|
|
||||||
transform: scale(1.2) rotate(10deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-soft-blue { background-color: #e0f2fe; }
|
|
||||||
.bg-soft-green { background-color: #dcfce7; }
|
|
||||||
.bg-soft-purple { background-color: #f3e8ff; }
|
|
||||||
.bg-soft-yellow { background-color: #fef9c3; }
|
|
||||||
|
|
||||||
.category-tag {
|
|
||||||
position: absolute;
|
|
||||||
top: 15px;
|
|
||||||
right: 15px;
|
|
||||||
background: #000;
|
|
||||||
color: #fff;
|
|
||||||
padding: 5px 12px;
|
|
||||||
border-radius: 20px;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-body { padding: 1.5rem; }
|
.glass-card {
|
||||||
|
background: var(--glass-bg);
|
||||||
.link-arrow {
|
backdrop-filter: blur(12px);
|
||||||
text-decoration: none;
|
-webkit-backdrop-filter: blur(12px);
|
||||||
color: #000;
|
border: 1px solid var(--glass-border);
|
||||||
font-weight: 700;
|
border-radius: 24px;
|
||||||
display: inline-flex;
|
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
|
||||||
align-items: center;
|
|
||||||
margin-top: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
|
|
||||||
.link-arrow:hover i { transform: translateX(5px); }
|
|
||||||
|
|
||||||
/* About */
|
|
||||||
.about-image-stack {
|
|
||||||
position: relative;
|
|
||||||
height: 400px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stack-card {
|
|
||||||
position: absolute;
|
|
||||||
width: 80%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: var(--radius-card);
|
|
||||||
border: 2px solid #000;
|
|
||||||
box-shadow: var(--shadow-hard);
|
|
||||||
left: 10%;
|
|
||||||
transform: rotate(-3deg);
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Forms */
|
|
||||||
.form-control {
|
.form-control {
|
||||||
border: 2px solid #000;
|
background: rgba(255, 255, 255, 0.08);
|
||||||
border-radius: 0.5rem;
|
border: 1px solid var(--glass-border);
|
||||||
padding: 1rem;
|
color: #ffffff;
|
||||||
font-weight: 500;
|
border-radius: 12px;
|
||||||
background: #f8f9fa;
|
padding: 0.75rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control:focus {
|
.form-control:focus {
|
||||||
box-shadow: 4px 4px 0 var(--color-primary);
|
background: rgba(255, 255, 255, 0.12);
|
||||||
border-color: #000;
|
border-color: var(--accent-indigo);
|
||||||
background: #fff;
|
color: #ffffff;
|
||||||
|
box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animations */
|
.form-label {
|
||||||
.animate-up {
|
color: #ffffff !important;
|
||||||
opacity: 0;
|
font-weight: 500;
|
||||||
transform: translateY(30px);
|
opacity: 0.9 !important;
|
||||||
animation: fadeUp 0.8s ease forwards;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.delay-100 { animation-delay: 0.1s; }
|
.btn-primary {
|
||||||
.delay-200 { animation-delay: 0.2s; }
|
background: var(--accent-indigo);
|
||||||
|
border: none;
|
||||||
@keyframes fadeUp {
|
border-radius: 12px;
|
||||||
to {
|
padding: 0.8rem 1.5rem;
|
||||||
opacity: 1;
|
font-weight: 600;
|
||||||
transform: translateY(0);
|
transition: all 0.2s;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Social */
|
.btn-primary:hover {
|
||||||
.social-links a {
|
background: #818cf8;
|
||||||
transition: transform 0.2s;
|
transform: translateY(-2px);
|
||||||
display: inline-block;
|
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
|
||||||
}
|
|
||||||
.social-links a:hover {
|
|
||||||
transform: scale(1.2) rotate(10deg);
|
|
||||||
color: var(--color-accent) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsive */
|
.rating-label {
|
||||||
@media (max-width: 991px) {
|
width: 42px;
|
||||||
.rotate-divider {
|
height: 42px;
|
||||||
transform: rotate(0);
|
display: flex;
|
||||||
margin-top: 0;
|
align-items: center;
|
||||||
margin-bottom: 2rem;
|
justify-content: center;
|
||||||
}
|
border: 1px solid var(--glass-border);
|
||||||
|
border-radius: 10px;
|
||||||
.hero-section {
|
cursor: pointer;
|
||||||
padding-top: 120px;
|
transition: all 0.2s;
|
||||||
text-align: center;
|
color: #ffffff;
|
||||||
min-height: auto;
|
}
|
||||||
padding-bottom: 100px;
|
|
||||||
}
|
.form-check-input:checked + .rating-label {
|
||||||
|
background: var(--accent-teal);
|
||||||
.display-1 { font-size: 3.5rem; }
|
border-color: var(--accent-teal);
|
||||||
|
color: #fff;
|
||||||
.blob-1 { width: 300px; height: 300px; right: -20%; }
|
box-shadow: 0 0 15px rgba(20, 184, 166, 0.4);
|
||||||
.blob-2 { width: 300px; height: 300px; left: -20%; }
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
--bs-table-bg: transparent;
|
||||||
|
--bs-table-hover-bg: rgba(255, 255, 255, 0.05);
|
||||||
|
--bs-table-color: #ffffff;
|
||||||
|
color: #ffffff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table thead th {
|
||||||
|
border-bottom: 2px solid var(--glass-border);
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
color: #e2e8f0 !important; /* Brighter header color */
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
padding: 0.6em 1em;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom text utility for better contrast */
|
||||||
|
.text-muted-light {
|
||||||
|
color: #cbd5e1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.opacity-75 {
|
||||||
|
opacity: 0.9 !important; /* Increase opacity for better readability */
|
||||||
|
}
|
||||||
|
|
||||||
|
.opacity-50 {
|
||||||
|
opacity: 0.7 !important; /* Increase opacity for better readability */
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
color: #ffffff !important;
|
||||||
}
|
}
|
||||||
@ -1,73 +1,43 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
// Set default times if inputs exist
|
||||||
|
const startInput = document.getElementById('start_time');
|
||||||
|
const endInput = document.getElementById('end_time');
|
||||||
|
|
||||||
// Smooth scrolling for navigation links
|
if (startInput && endInput) {
|
||||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
const now = new Date();
|
||||||
anchor.addEventListener('click', function (e) {
|
const yesterday = new Date(now);
|
||||||
e.preventDefault();
|
yesterday.setHours(now.getHours() - 8);
|
||||||
const targetId = this.getAttribute('href');
|
|
||||||
if (targetId === '#') return;
|
|
||||||
|
|
||||||
const targetElement = document.querySelector(targetId);
|
// Format to YYYY-MM-DDTHH:mm
|
||||||
if (targetElement) {
|
const formatDate = (date) => {
|
||||||
// Close mobile menu if open
|
const pad = (num) => String(num).padStart(2, '0');
|
||||||
const navbarToggler = document.querySelector('.navbar-toggler');
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||||
const navbarCollapse = document.querySelector('.navbar-collapse');
|
};
|
||||||
if (navbarCollapse.classList.contains('show')) {
|
|
||||||
navbarToggler.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll with offset
|
if (!startInput.value) startInput.value = formatDate(yesterday);
|
||||||
const offset = 80;
|
if (!endInput.value) endInput.value = formatDate(now);
|
||||||
const elementPosition = targetElement.getBoundingClientRect().top;
|
}
|
||||||
const offsetPosition = elementPosition + window.pageYOffset - offset;
|
|
||||||
|
|
||||||
window.scrollTo({
|
// Form validation
|
||||||
top: offsetPosition,
|
const form = document.querySelector('form');
|
||||||
behavior: "smooth"
|
if (form) {
|
||||||
});
|
form.addEventListener('submit', (e) => {
|
||||||
|
const start = new Date(startInput.value);
|
||||||
|
const end = new Date(endInput.value);
|
||||||
|
|
||||||
|
if (end <= start) {
|
||||||
|
e.preventDefault();
|
||||||
|
alert('Wake up time must be after bed time!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
// Navbar scroll effect
|
// Rating selection visual feedback (optional since CSS handles it, but good for accessibility)
|
||||||
const navbar = document.querySelector('.navbar');
|
const ratingLabels = document.querySelectorAll('.rating-label');
|
||||||
window.addEventListener('scroll', () => {
|
ratingLabels.forEach(label => {
|
||||||
if (window.scrollY > 50) {
|
label.addEventListener('click', () => {
|
||||||
navbar.classList.add('scrolled', 'shadow-sm', 'bg-white');
|
ratingLabels.forEach(l => l.style.borderColor = '');
|
||||||
navbar.classList.remove('bg-transparent');
|
label.style.borderColor = 'var(--accent-teal)';
|
||||||
} else {
|
|
||||||
navbar.classList.remove('scrolled', 'shadow-sm', 'bg-white');
|
|
||||||
navbar.classList.add('bg-transparent');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Intersection Observer for fade-up animations
|
|
||||||
const observerOptions = {
|
|
||||||
threshold: 0.1,
|
|
||||||
rootMargin: "0px 0px -50px 0px"
|
|
||||||
};
|
|
||||||
|
|
||||||
const observer = new IntersectionObserver((entries) => {
|
|
||||||
entries.forEach(entry => {
|
|
||||||
if (entry.isIntersecting) {
|
|
||||||
entry.target.classList.add('animate-up');
|
|
||||||
entry.target.style.opacity = "1";
|
|
||||||
observer.unobserve(entry.target); // Only animate once
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, observerOptions);
|
|
||||||
|
|
||||||
// Select elements to animate (add a class 'reveal' to them in HTML if not already handled by CSS animation)
|
|
||||||
// For now, let's just make sure the hero animations run.
|
|
||||||
// If we want scroll animations, we'd add opacity: 0 to elements in CSS and reveal them here.
|
|
||||||
// Given the request, the CSS animation I added runs on load for Hero.
|
|
||||||
// Let's make the project cards animate in.
|
|
||||||
|
|
||||||
const projectCards = document.querySelectorAll('.project-card');
|
|
||||||
projectCards.forEach((card, index) => {
|
|
||||||
card.style.opacity = "0";
|
|
||||||
card.style.animationDelay = `${index * 0.1}s`;
|
|
||||||
observer.observe(card);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
258
index.php
258
index.php
@ -1,150 +1,136 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
@ini_set('display_errors', '1');
|
@ini_set('display_errors', '1');
|
||||||
@error_reporting(E_ALL);
|
@error_reporting(E_ALL);
|
||||||
@date_default_timezone_set('UTC');
|
@date_default_timezone_set('UTC');
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
try {
|
||||||
|
$sessions = db()->query("SELECT *, TIMESTAMPDIFF(MINUTE, start_time, end_time) as duration_mins FROM sleep_sessions ORDER BY start_time DESC LIMIT 10")->fetchAll();
|
||||||
|
|
||||||
|
$stats = db()->query("SELECT AVG(TIMESTAMPDIFF(MINUTE, start_time, end_time)) as avg_duration FROM sleep_sessions")->fetch();
|
||||||
|
$avg_duration = $stats['avg_duration'] ? round($stats['avg_duration'] / 60, 1) : 0;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$sessions = [];
|
||||||
|
$avg_duration = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$now = date('Y-m-d H:i:s');
|
$now = date('Y-m-d H:i:s');
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>New Style</title>
|
<title>Sleep Tracker - Better Nights, Better Days</title>
|
||||||
<?php
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
// Read project preview data from environment
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap" rel="stylesheet">
|
||||||
?>
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<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;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="bg-night text-light">
|
||||||
<main>
|
<nav class="navbar navbar-expand-lg navbar-dark bg-transparent">
|
||||||
<div class="card">
|
<div class="container">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<a class="navbar-brand fw-bold" href="index.php">🌙 SleepTracker</a>
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
</div>
|
||||||
<span class="sr-only">Loading…</span>
|
</nav>
|
||||||
</div>
|
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
<main class="container py-5">
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<div class="row mb-5">
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<div class="col-lg-8 mx-auto text-center">
|
||||||
</div>
|
<h1 class="display-4 fw-bold mb-3">Track Your Sleep</h1>
|
||||||
</main>
|
<p class="lead opacity-75">Consistency is the key to quality rest. Log your sessions and improve your health.</p>
|
||||||
<footer>
|
</div>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
</div>
|
||||||
</footer>
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card glass-card p-4">
|
||||||
|
<h3 class="h5 mb-4">Log New Session</h3>
|
||||||
|
<form action="add_session.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="start_time" class="form-label small opacity-75">Went to bed</label>
|
||||||
|
<input type="datetime-local" class="form-control" id="start_time" name="start_time" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="end_time" class="form-label small opacity-75">Woke up</label>
|
||||||
|
<input type="datetime-local" class="form-control" id="end_time" name="end_time" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label small opacity-75">Sleep Rating</label>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<?php for ($i = 1; $i <= 5; $i++): ?>
|
||||||
|
<div class="form-check form-check-inline m-0">
|
||||||
|
<input class="form-check-input d-none" type="radio" name="rating" id="r<?= $i ?>" value="<?= $i ?>">
|
||||||
|
<label class="rating-label" for="r<?= $i ?>"><?= $i ?></label>
|
||||||
|
</div>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100 py-3 fw-bold">Save Session</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card glass-card mt-4 p-4 text-center">
|
||||||
|
<p class="mb-0 opacity-75 small">Average Sleep Duration</p>
|
||||||
|
<h2 class="display-5 fw-bold mb-0"><?= $avg_duration ?> <small class="h6">hours</small></h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card glass-card p-4">
|
||||||
|
<h3 class="h5 mb-4">Recent Sessions</h3>
|
||||||
|
<?php if (empty($sessions)): ?>
|
||||||
|
<div class="text-center py-5">
|
||||||
|
<p class="opacity-50">No sessions logged yet. Start tonight!</p>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-dark table-hover align-middle">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Start</th>
|
||||||
|
<th>End</th>
|
||||||
|
<th>Duration</th>
|
||||||
|
<th>Rating</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($sessions as $s): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= date('M j', strtotime($s['start_time'])) ?></td>
|
||||||
|
<td><?= date('H:i', strtotime($s['start_time'])) ?></td>
|
||||||
|
<td><?= date('H:i', strtotime($s['end_time'])) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$h = floor($s['duration_mins'] / 60);
|
||||||
|
$m = $s['duration_mins'] % 60;
|
||||||
|
echo "{$h}h {$m}m";
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge bg-<?= $s['rating'] >= 4 ? 'success' : ($s['rating'] >= 3 ? 'warning' : 'danger') ?>">
|
||||||
|
<?= str_repeat('★', $s['rating']) ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="container text-center py-5 opacity-50">
|
||||||
|
<p>© <?= date('Y') ?> SleepTracker App. Keep dreaming.</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user