Add gallery admin and video media support.

This updates gallery handling to support video playback with generated poster thumbnails, adds authenticated admin upload/delete flows, and improves dev/runtime behavior including reliable thumbnail generation and media-safe response handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 23:01:02 +12:00
parent 509e7ccb43
commit 45b31be9a7
22 changed files with 1002 additions and 217 deletions

View File

@@ -281,53 +281,6 @@ main {
font-size: 0.95rem;
}
.gallery-controls {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
margin-bottom: 1.25rem;
align-items: center;
}
.gallery-controls-collections {
padding: 0.75rem 0 0;
margin-bottom: 1.25rem;
border-top: 1px solid var(--border);
}
.gallery-controls-label {
font-size: 0.8rem;
font-family: var(--mono);
color: var(--text-muted);
margin-right: 0.25rem;
width: 100%;
flex-basis: 100%;
}
@media (min-width: 600px) {
.gallery-controls-label {
width: auto;
flex-basis: auto;
}
}
.filter-btn {
font: inherit;
padding: 0.45rem 0.9rem;
border-radius: 999px;
border: 1px solid var(--border);
background: transparent;
color: var(--text-muted);
cursor: pointer;
}
.filter-btn:hover,
.filter-btn.active {
background: var(--accent-soft);
color: var(--text);
border-color: rgba(196, 123, 58, 0.45);
}
.gallery-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
@@ -358,6 +311,21 @@ main {
background: var(--surface);
}
.gallery-video-badge {
position: absolute;
left: 0.35rem;
bottom: 0.35rem;
padding: 0.15rem 0.4rem;
border-radius: 3px;
background: rgba(0, 0, 0, 0.65);
color: var(--text);
font-family: var(--mono);
font-size: 0.65rem;
letter-spacing: 0.04em;
text-transform: uppercase;
pointer-events: none;
}
.gallery-item:hover img {
transform: scale(1.04);
}
@@ -530,6 +498,7 @@ main {
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1rem;
overflow: hidden;
}
.modal-close {
@@ -550,13 +519,19 @@ main {
.modal-figure {
margin: 0;
border-radius: 8px;
overflow: hidden;
background: #000;
}
.modal-figure img {
.modal-figure img,
.modal-figure video {
display: block;
width: 100%;
max-height: 75vh;
object-fit: contain;
border-radius: 8px;
background: #000;
}
.modal-figure figcaption {
@@ -675,11 +650,6 @@ main {
gap: 0.5rem;
}
.filter-btn {
min-height: 2.5rem;
padding: 0.5rem 1rem;
}
.contact-form {
max-width: none;
}
@@ -739,7 +709,8 @@ main {
min-height: 0;
}
.modal-figure img {
.modal-figure img,
.modal-figure video {
flex: 1;
min-height: 0;
max-height: none;
@@ -775,3 +746,116 @@ main {
transform: scale(1.02);
}
}
/* --- Admin --- */
.admin-body {
min-height: 100vh;
}
.admin-login {
max-width: 24rem;
margin: 4rem auto;
padding: 0 1rem;
}
.admin-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem clamp(1rem, 4vw, 2rem);
border-bottom: 1px solid var(--border);
}
.admin-header h1 {
margin: 0;
font-size: 1.25rem;
}
.admin-main {
max-width: 1100px;
margin: 0 auto;
padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem;
}
.admin-panel {
margin-bottom: 2rem;
padding: 1.25rem;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.admin-panel h2 {
margin: 0 0 1rem;
font-size: 1.1rem;
}
.admin-back {
color: var(--text-muted);
font-size: 0.9rem;
}
.admin-table-wrap {
overflow-x: auto;
}
.admin-table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
padding: 0.6rem 0.5rem;
border-bottom: 1px solid var(--border);
text-align: left;
vertical-align: middle;
}
.admin-table code {
font-family: var(--mono);
font-size: 0.8rem;
word-break: break-all;
}
.admin-thumb {
width: 4rem;
}
.admin-thumb img {
width: 4rem;
height: 4rem;
object-fit: cover;
border-radius: 6px;
}
.admin-delete {
color: #e8a090;
}
.admin-delete:hover {
background: rgba(120, 40, 40, 0.25);
}
#admin-flash:empty {
display: none;
}
.contact-form select {
display: block;
width: 100%;
box-sizing: border-box;
font: inherit;
padding: 0.65rem 0.85rem;
border-radius: 8px;
border: 1px solid var(--border);
background: var(--bg-elevated);
color: var(--text);
}
.contact-form input[type="file"] {
font-size: 0.9rem;
color: var(--text-muted);
}