aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/Views
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/Views')
-rw-r--r--src/app/Views/editor/index.php49
-rw-r--r--src/app/Views/gallery/index.php40
2 files changed, 89 insertions, 0 deletions
diff --git a/src/app/Views/editor/index.php b/src/app/Views/editor/index.php
new file mode 100644
index 0000000..624002a
--- /dev/null
+++ b/src/app/Views/editor/index.php
@@ -0,0 +1,49 @@
+<?php // Editor page: capture or upload an image, pick an overlay, preview, and save as a post.?>
+<div class="editor-page">
+ <h1>Create a post</h1>
+ <?php include __DIR__ . '/../partials/flash.php'; ?>
+ <input type="hidden" id="csrf-token" value="<?= htmlspecialchars(\App\Csrf::generate()) ?>">
+
+ <div class="editor-layout">
+ <div class="editor-source">
+ <div class="source-tabs">
+ <button id="tab-webcam" class="tab active">Webcam</button>
+ <button id="tab-upload" class="tab">Upload</button>
+ </div>
+
+ <div id="webcam-panel">
+ <video id="webcam-video" autoplay playsinline></video>
+ <button id="btn-capture" class="btn">Take photo</button>
+ </div>
+
+ <div id="upload-panel" hidden>
+ <input type="file" id="file-input" accept="image/jpeg,image/png">
+ </div>
+ </div>
+
+ <div class="editor-preview">
+ <canvas id="preview-canvas" width="640" height="640"></canvas>
+
+ <div class="overlay-controls">
+ <label for="overlay-scale">Overlay size</label>
+ <input type="range" id="overlay-scale" min="10" max="200" value="100">
+ </div>
+
+ <h2>Overlays</h2>
+ <?php if (empty($overlays)): ?>
+ <p class="hint">No overlays available.</p>
+ <?php else: ?>
+ <div class="overlay-grid">
+ <?php foreach ($overlays as $overlay): ?>
+ <img src="<?= htmlspecialchars($overlay) ?>"
+ class="overlay-thumb"
+ alt="overlay"
+ data-filename="<?= htmlspecialchars(basename($overlay)) ?>">
+ <?php endforeach; ?>
+ </div>
+ <?php endif; ?>
+
+ <button id="btn-save" class="btn" disabled>Save post</button>
+ </div>
+ </div>
+</div>
diff --git a/src/app/Views/gallery/index.php b/src/app/Views/gallery/index.php
new file mode 100644
index 0000000..62fd7f3
--- /dev/null
+++ b/src/app/Views/gallery/index.php
@@ -0,0 +1,40 @@
+<?php // Gallery: public feed of all posts with pagination.?>
+<div class="gallery-page">
+ <h1>Gallery</h1>
+
+ <?php if (empty($posts)): ?>
+ <p class="hint">No posts yet. Be the first!</p>
+ <?php endif; ?>
+
+ <div class="gallery-feed">
+ <?php foreach ($posts as $post): ?>
+ <article class="gallery-post">
+ <div class="post-header">
+ <strong><?= htmlspecialchars($post['username']) ?></strong>
+ <time><?= date('M j, Y', strtotime($post['created_at'])) ?></time>
+ </div>
+ <img src="/<?= htmlspecialchars($post['image_path']) ?>" alt="Post by <?= htmlspecialchars($post['username']) ?>">
+ </article>
+ <?php endforeach; ?>
+ </div>
+
+ <?php if ($totalPages > 1): ?>
+ <nav class="pagination">
+ <?php if ($page > 1): ?>
+ <a href="/gallery?page=<?= $page - 1 ?>">&laquo; Previous</a>
+ <?php endif; ?>
+
+ <?php for ($i = 1; $i <= $totalPages; $i++): ?>
+ <?php if ($i === $page): ?>
+ <span class="current-page"><?= $i ?></span>
+ <?php else: ?>
+ <a href="/gallery?page=<?= $i ?>"><?= $i ?></a>
+ <?php endif; ?>
+ <?php endfor; ?>
+
+ <?php if ($page < $totalPages): ?>
+ <a href="/gallery?page=<?= $page + 1 ?>">Next &raquo;</a>
+ <?php endif; ?>
+ </nav>
+ <?php endif; ?>
+</div>