Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
@ -1,103 +0,0 @@
|
|||||||
|
|
||||||
body {
|
|
||||||
background-color: #E5E5E5;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 100vh;
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 0 auto;
|
|
||||||
background-color: #E5E5E5;
|
|
||||||
border-left: 1px solid #ddd;
|
|
||||||
border-right: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-header {
|
|
||||||
background-color: #0088cc;
|
|
||||||
color: white;
|
|
||||||
padding: 1rem;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: 500;
|
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-messages {
|
|
||||||
flex-grow: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
padding: 1rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.75rem;
|
|
||||||
padding-bottom: 80px; /* Space for the input form */
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-bubble {
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
border-radius: 1.25rem;
|
|
||||||
max-width: 75%;
|
|
||||||
word-wrap: break-word;
|
|
||||||
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-bubble.sent {
|
|
||||||
background-color: #DCF8C6;
|
|
||||||
align-self: flex-end;
|
|
||||||
border-bottom-right-radius: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-bubble.received {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
align-self: flex-start;
|
|
||||||
border-bottom-left-radius: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message-time {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
color: #999;
|
|
||||||
margin-top: 4px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-form {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
max-width: 800px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 1rem;
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
border-top: 1px solid #ddd;
|
|
||||||
box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-form form {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-form input {
|
|
||||||
flex-grow: 1;
|
|
||||||
border-radius: 1.5rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-form button {
|
|
||||||
border-radius: 50%;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: none;
|
|
||||||
background-color: #0088cc;
|
|
||||||
color: white;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
237
index.php
237
index.php
@ -1,111 +1,150 @@
|
|||||||
<?php
|
<?php
|
||||||
// db/config.php is expected to be included and provide a db() function.
|
declare(strict_types=1);
|
||||||
require_once 'db/config.php';
|
@ini_set('display_errors', '1');
|
||||||
|
@error_reporting(E_ALL);
|
||||||
// --- Database and App Logic ---
|
@date_default_timezone_set('UTC');
|
||||||
try {
|
|
||||||
$pdo = db();
|
|
||||||
|
|
||||||
// Idempotent table creation
|
|
||||||
$pdo->exec("CREATE TABLE IF NOT EXISTS messages (
|
|
||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
message TEXT NOT NULL,
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
||||||
);");
|
|
||||||
|
|
||||||
// Handle new message submission (Post/Redirect/Get pattern)
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty(trim($_POST['message']))) {
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO messages (message) VALUES (?)");
|
|
||||||
$stmt->execute([$_POST['message']]);
|
|
||||||
// Prevent form resubmission on refresh
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch all messages for display
|
|
||||||
$messages = $pdo->query("SELECT * FROM messages ORDER BY created_at ASC")->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
} catch (PDOException $e) {
|
|
||||||
// For a real app, you'd want to log this and show a user-friendly error page.
|
|
||||||
error_log("Database error: " . $e->getMessage());
|
|
||||||
// Keep the page from crashing, show an error inline.
|
|
||||||
$dbError = "Could not connect to the database or run the query. Please check server logs.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Dynamic Meta Tags & SEO --- (Platform-managed)
|
|
||||||
$project_name = htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'Telegram App');
|
|
||||||
$project_description = htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A simple messaging app.');
|
|
||||||
$project_image_url = htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? '');
|
|
||||||
|
|
||||||
|
$phpVersion = PHP_VERSION;
|
||||||
|
$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.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title><?= $project_name ?></title>
|
<title>New Style</title>
|
||||||
<meta name="description" content="<?= $project_description ?>">
|
<?php
|
||||||
|
// Read project preview data from environment
|
||||||
<!-- Open Graph / Facebook -->
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||||
<meta property="og:type" content="website">
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||||
<meta property="og:title" content="<?= $project_name ?>">
|
?>
|
||||||
<meta property="og:description" content="<?= $project_description ?>">
|
<?php if ($projectDescription): ?>
|
||||||
<?php if ($project_image_url): ?>
|
<!-- Meta description -->
|
||||||
<meta property="og:image" content="<?= $project_image_url ?>">
|
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||||
<?php endif; ?>
|
<!-- Open Graph meta tags -->
|
||||||
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<!-- Twitter -->
|
<!-- Twitter meta tags -->
|
||||||
<meta property="twitter:card" content="summary_large_image">
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||||
<meta property="twitter:title" content="<?= $project_name ?>">
|
<?php endif; ?>
|
||||||
<meta property="twitter:description" content="<?= $project_description ?>">
|
<?php if ($projectImageUrl): ?>
|
||||||
<?php if ($project_image_url): ?>
|
<!-- Open Graph image -->
|
||||||
<meta property="twitter:image" content="<?= $project_image_url ?>">
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<?php endif; ?>
|
<!-- Twitter image -->
|
||||||
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||||
<!-- Libs -->
|
<?php endif; ?>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<!-- Custom App Styles -->
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
<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>
|
||||||
|
<main>
|
||||||
<div class="chat-container">
|
<div class="card">
|
||||||
<header class="chat-header">
|
<h1>Analyzing your requirements and generating your website…</h1>
|
||||||
Public Chat
|
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||||
</header>
|
<span class="sr-only">Loading…</span>
|
||||||
|
</div>
|
||||||
<main class="chat-messages" id="chat-messages">
|
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||||
<?php if (isset($dbError)): ?>
|
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||||
<div class="alert alert-danger mx-auto">Error: <?= htmlspecialchars($dbError) ?></div>
|
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||||
<?php elseif (empty($messages)): ?>
|
|
||||||
<div class="text-center text-muted mt-5">No messages yet. Be the first to post!</div>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php foreach ($messages as $msg): ?>
|
|
||||||
<div class="message-bubble sent">
|
|
||||||
<div><?= htmlspecialchars($msg['message']) ?></div>
|
|
||||||
<div class="message-time"><?= date('h:i A', strtotime($msg['created_at'])) ?></div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</main>
|
</main>
|
||||||
|
<footer>
|
||||||
<footer class="chat-form">
|
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||||
<form action="index.php" method="POST" autocomplete="off">
|
|
||||||
<input type="text" name="message" placeholder="Type a message..." autofocus>
|
|
||||||
<button type="submit" aria-label="Send">➤</button>
|
|
||||||
</form>
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Auto-scroll to the latest message
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
const chatMessages = document.getElementById('chat-messages');
|
|
||||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user