biohazard-web-old/admin.html
2025-10-02 16:01:12 -06:00

215 lines
6.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin — Biohazard VFX</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="css/styles.css">
<style>
#admin.content-block {
max-width: 700px;
margin: 0 auto;
padding: 12vh var(--gutter-x) 8vh;
font-family: "SpaceMono", monospace;
color: var(--acid);
text-shadow: 0 0 2px var(--acid);
border-bottom: 1px solid var(--graphite);
background: none;
min-height: 60vh;
}
.admin-title {
font-family: "ArchiveCond", sans-serif;
font-size: 2rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--hot);
margin-bottom: 1.2rem;
margin-top: 0;
text-align: center;
text-shadow: 0 0 2px var(--acid);
}
.admin-section {
margin-top: 2.5rem;
background: var(--graphite);
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.18);
padding: 2rem 1.5rem 1.2rem;
color: var(--acid);
font-family: "SpaceMono", monospace;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
.admin-section h2 {
font-family: "ArchiveCond", sans-serif;
font-size: 1.1rem;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--hot);
margin-bottom: 0.7rem;
margin-top: 0;
text-align: left;
}
.admin-section p {
font-size: 1rem;
color: var(--acid);
opacity: 0.88;
margin: 0;
line-height: 1.5;
padding-left: 0.2em;
}
.admin-warning {
color: #ffb6b6;
background: #3d1a1a;
border: 1px solid #c66;
border-radius: 6px;
padding: 1em;
margin-bottom: 2em;
text-align: center;
font-size: 1.1em;
}
.admin-cms {
background: var(--graphite);
border-radius: 10px;
box-shadow: 0 4px 18px rgba(0,0,0,0.28);
padding: 2.5rem 2rem 2rem;
max-width: 400px;
width: 100%;
margin: 2rem auto;
border: 1px solid #222;
}
.admin-cms h2 {
color: var(--acid);
font-size: 1.3rem;
text-align: center;
margin-bottom: 1.5rem;
letter-spacing: 0.04em;
text-transform: uppercase;
font-family: 'ArchiveCond', sans-serif;
}
.admin-cms label {
font-size: 0.9rem;
color: var(--acid);
margin-top: 1rem;
display: block;
}
.admin-cms input,
.admin-cms select {
width: 100%;
padding: 0.7em;
margin-top: 0.3rem;
border: 1px solid var(--graphite);
border-radius: 5px;
background: var(--dark);
color: var(--acid);
font-family: "SpaceMono", monospace;
font-size: 1rem;
}
.admin-cms button {
width: 100%;
padding: 0.7em;
background: #00ffe7;
color: #181818;
border: none;
border-radius: 5px;
font-size: 1.1em;
font-family: inherit;
font-weight: bold;
cursor: pointer;
box-shadow: 0 2px 8px #00ffe733;
transition: background 0.2s, color 0.2s;
margin-top: 1.5rem;
}
.admin-cms .feedback {
text-align: center;
font-size: 1.5em;
margin-top: 1em;
min-height: 2em;
letter-spacing: 0.1em;
}
</style>
</head>
<body>
<div id="nav-placeholder"></div>
<main id="admin" class="content-block">
<form class="admin-cms" id="projectForm" autocomplete="off">
<h2>Add New Project</h2>
<label for="title">Title*</label>
<input type="text" id="title" name="title" required maxlength="80" autocomplete="off">
<label for="size">Size</label>
<select id="size" name="size">
<option value="small" selected>Small</option>
<option value="big">Big</option>
<option value="wide">Wide</option>
<option value="tall">Tall</option>
<option value="banner">Banner</option>
</select>
<label for="embed">Embed URL*</label>
<input type="url" id="embed" name="embed" required placeholder="https://player.vimeo.com/..." autocomplete="off">
<label for="thumb">Thumbnail*</label>
<input type="file" id="thumb" name="thumb" accept=".jpg,.jpeg,.png,.webp,.gif" required>
<label for="info">Project Info</label>
<textarea id="info" name="info" rows="3" style="width:100%;padding:0.7em;margin-top:0.3rem;border:1px solid var(--graphite);border-radius:5px;background:var(--dark);color:var(--acid);font-family:'SpaceMono',monospace;font-size:1rem;"></textarea>
<label for="credits">Credits</label>
<textarea id="credits" name="credits" rows="3" style="width:100%;padding:0.7em;margin-top:0.3rem;border:1px solid var(--graphite);border-radius:5px;background:var(--dark);color:var(--acid);font-family:'SpaceMono',monospace;font-size:1rem;"></textarea>
<button type="submit">Add Project</button>
<div class="feedback" id="feedback"></div>
</form>
</main>
<div id="socials-placeholder"></div>
<footer>
<p>© 2025 Biohazard VFX. All Rights Reserved.</p>
</footer>
<script>
// Inject nav fragment
fetch('fragments/nav.html')
.then(r => r.text())
.then(html => {
document.getElementById('nav-placeholder').outerHTML = html;
});
// Inject socials fragment
fetch('fragments/socials.html')
.then(r => r.text())
.then(html => {
document.getElementById('socials-placeholder').outerHTML = html;
});
// Micro-CMS form logic
const API_URL = '/api/projects';
const API_KEY = 'YOUR_API_SECRET_HERE'; // <-- Set this to your API_SECRET
const form = document.getElementById('projectForm');
const feedback = document.getElementById('feedback');
form.addEventListener('submit', async (e) => {
e.preventDefault();
feedback.textContent = '';
feedback.className = 'feedback';
const fd = new FormData(form);
try {
const res = await fetch(API_URL, {
method: 'POST',
headers: { 'x-api-key': API_KEY },
body: fd
});
const data = await res.json();
if (data.ok) {
feedback.textContent = '✅ Project added!';
feedback.classList.add('ok');
form.reset();
} else {
feedback.textContent = '❌ ' + (data.error || 'Error');
feedback.classList.add('err');
}
} catch (err) {
feedback.textContent = '❌ Network error';
feedback.classList.add('err');
}
});
</script>
</body>
</html>