This commit is contained in:
Flatlogic Bot 2025-11-22 14:14:13 +00:00
parent eea139a530
commit b654b375c7
10 changed files with 400 additions and 145 deletions

View File

@ -0,0 +1,85 @@
body {
font-size: .875rem;
}
.feather {
width: 16px;
height: 16px;
vertical-align: text-bottom;
}
/*
* Sidebar
*/
.sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
z-index: 100; /* Behind the navbar */
padding: 48px 0 0; /* Height of navbar */
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}
.sidebar-sticky {
position: relative;
top: 0;
height: calc(100vh - 48px);
padding-top: .5rem;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
}
.sidebar .nav-link {
font-weight: 500;
color: #333;
}
.sidebar .nav-link .feather {
margin-right: 4px;
color: #727272;
}
.sidebar .nav-link.active {
color: #2470dc;
}
.sidebar .nav-link:hover .feather,
.sidebar .nav-link.active .feather {
color: inherit;
}
.sidebar-heading {
font-size: .75rem;
text-transform: uppercase;
}
/*
* Navbar
*/
.navbar-brand {
padding-top: .75rem;
padding-bottom: .75rem;
font-size: 1rem;
background-color: rgba(0, 0, 0, .25);
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}
.navbar .form-control {
padding: .75rem 1rem;
border-width: 0;
border-radius: 0;
}
.form-control-dark {
color: #fff;
background-color: rgba(255, 255, 255, .1);
border-color: rgba(255, 255, 255, .1);
}
.form-control-dark:focus {
border-color: transparent;
box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
}

4
admin/index.php Normal file
View File

@ -0,0 +1,4 @@
<?php
header("Location: users.php");
exit();
?>

12
admin/partials/footer.php Normal file
View File

@ -0,0 +1,12 @@
</main>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script>
feather.replace()
</script>
</body>
</html>

40
admin/partials/header.php Normal file
View File

@ -0,0 +1,40 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo isset($pageTitle) ? htmlspecialchars($pageTitle) : "Admin"; ?> - OldHelp</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
</head>
<body>
<header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-3 col-lg-2 me-0 px-3" href="#">OldHelp Admin</a>
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</header>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="users.php">
<span data-feather="users"></span>
Users
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../index.php">
<span data-feather="arrow-left"></span>
Back to Main Site
</a>
</li>
</ul>
</div>
</nav>
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">

51
admin/users.php Normal file
View File

@ -0,0 +1,51 @@
<?php
$pageTitle = "User Management";
include 'partials/header.php';
require_once __DIR__ . '/../db/config.php';
$pdo = db();
$stmt = $pdo->query('SELECT id, name, email, role FROM users');
$users = $stmt->fetchAll();
?>
<div class="container-fluid">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">User Management</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<button type="button" class="btn btn-sm btn-outline-secondary">
<span data-feather="plus-circle"></span>
Add User
</button>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td><?php echo htmlspecialchars($user['id']); ?></td>
<td><?php echo htmlspecialchars($user['name']); ?></td>
<td><?php echo htmlspecialchars($user['email']); ?></td>
<td><?php echo htmlspecialchars($user['role']); ?></td>
<td>
<button type="button" class="btn btn-sm btn-outline-secondary">Edit</button>
<button type="button" class="btn btn-sm btn-outline-danger">Delete</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php include 'partials/footer.php'; ?>

55
assets/css/custom.css Normal file
View File

@ -0,0 +1,55 @@
body {
background-color: #f8f9fa;
font-family: 'Verdana', 'Arial', sans-serif;
}
.hero {
background: linear-gradient(135deg, #f8f9fa, #e9ecef);
padding: 4rem 2rem;
border-bottom: 1px solid #dee2e6;
}
.hero h1 {
font-size: 3rem;
font-weight: bold;
}
.hero p {
font-size: 1.25rem;
color: #6c757d;
}
.action-card {
border: none;
border-radius: 0.5rem;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
cursor: pointer;
padding: 2rem;
text-align: center;
background-color: #ffffff;
}
.action-card:hover {
transform: translateY(-5px);
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.action-card .icon {
font-size: 4rem;
color: #007bff;
}
.action-card .card-title {
font-size: 1.5rem;
font-weight: bold;
margin-top: 1rem;
}
.toast-container {
position: fixed;
top: 20px;
right: 20px;
z-index: 1055;
}

39
assets/js/main.js Normal file
View File

@ -0,0 +1,39 @@
document.addEventListener('DOMContentLoaded', function () {
const actionCards = document.querySelectorAll('.action-card');
const toastContainer = document.querySelector('.toast-container');
const showToast = (message) => {
const toastEl = document.createElement('div');
toastEl.className = 'toast show';
toastEl.setAttribute('role', 'alert');
toastEl.setAttribute('aria-live', 'assertive');
toastEl.setAttribute('aria-atomic', 'true');
toastEl.innerHTML = `
<div class="toast-header">
<strong class="me-auto">OldHelp Assistant</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
${message}
</div>
`;
toastContainer.appendChild(toastEl);
const toast = new bootstrap.Toast(toastEl, { delay: 5000 });
toast.show();
toastEl.addEventListener('hidden.bs.toast', () => {
toastEl.remove();
});
};
actionCards.forEach(card => {
card.addEventListener('click', () => {
const task = card.getAttribute('data-task');
showToast(`Help for <strong>${task}</strong> is on the way!`);
});
});
});

18
db/migrate.php Normal file
View File

@ -0,0 +1,18 @@
<?php
require_once __DIR__ . '/config.php';
$pdo = db();
$sql_file = __DIR__ . '/migrations/001_create_users_table.sql';
if (!file_exists($sql_file)) {
die("Migration file not found: " . $sql_file);
}
try {
$sql = file_get_contents($sql_file);
$pdo->exec($sql);
echo "Migration successful!\n";
} catch (PDOException $e) {
die("Migration failed: " . $e->getMessage() . "\n");
}

View File

@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS `users` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL UNIQUE,
`role` VARCHAR(50) NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert some dummy data
INSERT INTO `users` (`name`, `email`, `role`) VALUES
('John Doe', 'john.doe@example.com', 'admin'),
('Jane Smith', 'jane.smith@example.com', 'caregiver'),
('Peter Jones', 'peter.jones@example.com', 'elderly');

228
index.php
View File

@ -1,150 +1,88 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OldHelp - Your AI Companion</title>
<!-- SEO Meta Tags -->
<meta name="description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'An AI companion for elderly users.'); ?>">
<meta name="author" content="OldHelp">
<meta name="keywords" content="AI assistant, elderly support, computer help">
<!-- Open Graph / Twitter Meta Tags (Platform Managed) -->
<meta property="og:title" content="OldHelp - Your AI Companion">
<meta property="og:description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'An AI companion for elderly users.'); ?>">
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<meta name="twitter:card" content="summary_large_image">
<!-- Bootstrap 5.3 CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
<header class="hero text-center">
<div class="container">
<h1 class="display-4">How can I help you today?</h1>
<p class="lead">Click one of the buttons below to get started.</p>
</div>
</header>
<main class="container my-5">
<div class="row g-4">
<div class="col-md-6 col-lg-4">
<div class="action-card" data-task="Email">
<i class="bi bi-envelope-fill icon"></i>
<h3 class="card-title">Email</h3>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="action-card" data-task="Internet">
<i class="bi bi-globe icon"></i>
<h3 class="card-title">Internet</h3>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="action-card" data-task="Video Call">
<i class="bi bi-camera-video-fill icon"></i>
<h3 class="card-title">Video Call</h3>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="action-card" data-task="Files">
<i class="bi bi-folder-fill icon"></i>
<h3 class="card-title">My Files</h3>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="action-card" data-task="Computer Health">
<i class="bi bi-heart-pulse-fill icon"></i>
<h3 class="card-title">Computer Health</h3>
</div>
</div>
<div class="col-md-6 col-lg-4">
<div class="action-card" data-task="Live Support">
<i class="bi bi-question-circle-fill icon"></i>
<h3 class="card-title">Live Support</h3>
</div>
</div>
</div>
</main>
<footer class="mt-5 text-center text-muted">
<p>&copy; <?php echo date("Y"); ?> OldHelp. All rights reserved. | <a href="admin/">Admin</a></p>
</footer>
<!-- Toast Container for Notifications -->
<div class="toast-container"></div>
<!-- Bootstrap 5.3 JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS -->
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>
</html>