Wichtel-Werkstatt: Secret-Santa-App mit Räumen, Ausschlüssen und Recovery-Links
- FastAPI + SQLite, serverseitig gerenderte Templates, mobil-zuerst - Admin-Passwort, einseitige Ausschlüsse, eingefrorene Auslosung - Teilnehmer sehen Ergebnis per Cookie; Einmal-Recovery-Links bei Verlust - Docker/podman-tauglich (Entrypoint mit Privilegien-Drop, SELinux-:z) - Unit-Tests für Auslosung, E2E-Testskript (30 Checks)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Wichtel-Werkstatt: Copy-Buttons und Bestätigungsdialoge.
|
||||
|
||||
document.addEventListener("click", (event) => {
|
||||
const button = event.target.closest("[data-copy]");
|
||||
if (!button) return;
|
||||
const source = document.querySelector(button.dataset.copy);
|
||||
if (!source) return;
|
||||
const text = source.value || source.textContent;
|
||||
const done = () => {
|
||||
const original = button.textContent;
|
||||
button.textContent = "Kopiert ✓";
|
||||
setTimeout(() => { button.textContent = original; }, 1600);
|
||||
};
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard.writeText(text).then(done).catch(() => fallbackCopy(source, done));
|
||||
} else {
|
||||
fallbackCopy(source, done);
|
||||
}
|
||||
});
|
||||
|
||||
function fallbackCopy(source, done) {
|
||||
source.focus();
|
||||
source.select();
|
||||
try {
|
||||
document.execCommand("copy");
|
||||
done();
|
||||
} catch {
|
||||
// Kopieren nicht möglich – Text bleibt im Feld zum manuellen Markieren.
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("submit", (event) => {
|
||||
const form = event.target.closest("form[data-confirm]");
|
||||
if (form && !window.confirm(form.dataset.confirm)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,281 @@
|
||||
/* Wichtel-Werkstatt – mobil-zuerst, weihnachtliche Farbpalette */
|
||||
|
||||
:root {
|
||||
--green: #1d5c3f;
|
||||
--green-dark: #123f2b;
|
||||
--red: #a4243b;
|
||||
--red-dark: #831b2e;
|
||||
--gold: #c9a227;
|
||||
--gold-soft: #f3e6c0;
|
||||
--cream: #faf4e8;
|
||||
--card: #ffffff;
|
||||
--ink: #2f2a26;
|
||||
--muted: #6f675e;
|
||||
--line: #e6dccb;
|
||||
--radius: 14px;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
html { -webkit-text-size-adjust: 100%; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
font-size: 1rem;
|
||||
line-height: 1.55;
|
||||
color: var(--ink);
|
||||
background-color: var(--cream);
|
||||
/* dezente Schneeflocken-Tupfer */
|
||||
background-image:
|
||||
radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.9) 0 3px, transparent 4px),
|
||||
radial-gradient(circle at 78% 8%, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px),
|
||||
radial-gradient(circle at 55% 42%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
|
||||
radial-gradient(circle at 28% 72%, rgba(255, 255, 255, 0.8) 0 3px, transparent 4px),
|
||||
radial-gradient(circle at 90% 60%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
|
||||
linear-gradient(180deg, #f4e9d5 0%, var(--cream) 240px);
|
||||
min-height: 100dvh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* ---------- Kopf & Fuß ---------- */
|
||||
|
||||
.site-header {
|
||||
padding: 0.9rem 1rem 0.4rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.brand {
|
||||
font-size: 1.35rem;
|
||||
font-weight: 800;
|
||||
color: var(--red);
|
||||
text-decoration: none;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.site-footer {
|
||||
margin-top: auto;
|
||||
padding: 1.4rem 1rem 1.8rem;
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 100%;
|
||||
max-width: 30rem;
|
||||
margin: 0 auto;
|
||||
padding: 0.6rem 0.9rem 1.5rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* ---------- Typo & Bausteine ---------- */
|
||||
|
||||
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.8rem 0 0.6rem; color: var(--green-dark); }
|
||||
h2 { font-size: 1.12rem; margin: 0 0 0.6rem; color: var(--green-dark); }
|
||||
|
||||
.hero { text-align: center; margin: 0.4rem 0 1rem; }
|
||||
.hero h1 { font-size: 1.9rem; color: var(--red); }
|
||||
.hero p { color: var(--muted); margin: 0 auto; max-width: 26rem; }
|
||||
|
||||
.room-title { text-align: center; }
|
||||
|
||||
.card {
|
||||
background: var(--card);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 6px 18px rgba(90, 60, 20, 0.08);
|
||||
padding: 1.1rem 1rem;
|
||||
margin: 0.9rem 0;
|
||||
}
|
||||
|
||||
.card-highlight {
|
||||
border-color: var(--gold);
|
||||
background: linear-gradient(180deg, #fffdf4, var(--card));
|
||||
}
|
||||
|
||||
.card-result { text-align: center; }
|
||||
|
||||
.divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
margin: 1.1rem 0.4rem;
|
||||
}
|
||||
.divider::before,
|
||||
.divider::after {
|
||||
content: "";
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: var(--line);
|
||||
}
|
||||
|
||||
.hint { color: var(--muted); font-size: 0.85rem; }
|
||||
.hello { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.3rem; }
|
||||
.waiting { margin-top: 0.4rem; }
|
||||
|
||||
.result-label { margin: 0.8rem 0 0.2rem; color: var(--muted); }
|
||||
.result-name {
|
||||
font-size: 1.7rem;
|
||||
font-weight: 800;
|
||||
color: var(--red);
|
||||
background: var(--gold-soft);
|
||||
border: 2px dashed var(--gold);
|
||||
border-radius: var(--radius);
|
||||
padding: 0.8rem 0.6rem;
|
||||
margin: 0.4rem 0 0.9rem;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
/* ---------- Formulare ---------- */
|
||||
|
||||
.stack { display: flex; flex-direction: column; gap: 0.8rem; }
|
||||
|
||||
label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; font-size: 0.95rem; }
|
||||
label small { font-weight: 400; color: var(--muted); }
|
||||
|
||||
input[type="text"],
|
||||
input[type="password"],
|
||||
select {
|
||||
width: 100%;
|
||||
min-height: 48px;
|
||||
padding: 0.55rem 0.8rem;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
color: var(--ink);
|
||||
background: #fff;
|
||||
border: 1.5px solid var(--line);
|
||||
border-radius: 10px;
|
||||
}
|
||||
input:focus, select:focus {
|
||||
outline: 2px solid var(--green);
|
||||
outline-offset: 1px;
|
||||
border-color: var(--green);
|
||||
}
|
||||
input[readonly] { background: var(--cream); color: var(--green-dark); font-size: 0.9rem; }
|
||||
|
||||
/* ---------- Buttons ---------- */
|
||||
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.4rem;
|
||||
min-height: 48px;
|
||||
padding: 0.6rem 1.2rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: transform 0.05s ease, background-color 0.15s ease;
|
||||
}
|
||||
.btn:active { transform: scale(0.98); }
|
||||
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
.btn-primary { background: var(--green); color: #fff; }
|
||||
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
|
||||
|
||||
.btn-secondary { background: var(--red); color: #fff; }
|
||||
.btn-secondary:hover:not(:disabled) { background: var(--red-dark); }
|
||||
|
||||
.btn-danger { background: var(--red); color: #fff; }
|
||||
.btn-danger:hover:not(:disabled) { background: var(--red-dark); }
|
||||
|
||||
.btn-ghost {
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
border: 1.5px solid var(--line);
|
||||
}
|
||||
|
||||
.btn-big { width: 100%; min-height: 56px; font-size: 1.1rem; }
|
||||
|
||||
.btn-small { min-height: 38px; padding: 0.3rem 0.75rem; font-size: 0.9rem; }
|
||||
|
||||
.logout-row { display: flex; justify-content: center; margin: 1.2rem 0 0.4rem; }
|
||||
|
||||
/* ---------- Listen & Admin ---------- */
|
||||
|
||||
.admin-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.6rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-block;
|
||||
padding: 0.15rem 0.65rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
background: var(--green);
|
||||
color: #fff;
|
||||
}
|
||||
.tag-gold { background: var(--gold); color: #3d2f05; }
|
||||
|
||||
.list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.6rem;
|
||||
padding: 0.55rem 0.2rem;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.list-item:last-child { border-bottom: none; }
|
||||
.list-item form { margin: 0; }
|
||||
.list-name { overflow-wrap: anywhere; }
|
||||
|
||||
.copy-row { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
|
||||
.copy-row input { flex: 1; min-width: 0; }
|
||||
|
||||
.code-line { margin: 0.6rem 0 0; color: var(--muted); }
|
||||
.code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
font-size: 1.15rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.18em;
|
||||
color: var(--green-dark);
|
||||
background: var(--gold-soft);
|
||||
border-radius: 8px;
|
||||
padding: 0.15rem 0.55rem;
|
||||
}
|
||||
|
||||
.exclusion-form {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.5rem;
|
||||
margin: 0.7rem 0 0.4rem;
|
||||
}
|
||||
.exclusion-form .btn { grid-column: 1 / -1; }
|
||||
|
||||
/* ---------- Meldungen ---------- */
|
||||
|
||||
.alert {
|
||||
border-radius: var(--radius);
|
||||
padding: 0.75rem 0.9rem;
|
||||
margin: 0.8rem 0;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.alert-ok { background: #e7f2ea; border: 1px solid var(--green); color: var(--green-dark); }
|
||||
.alert-error { background: #fae8ec; border: 1px solid var(--red); color: var(--red-dark); }
|
||||
|
||||
.card-message { text-align: center; }
|
||||
.card-message .btn { margin-top: 0.8rem; }
|
||||
|
||||
/* ---------- Desktop ---------- */
|
||||
|
||||
@media (min-width: 640px) {
|
||||
main { padding-top: 1.2rem; }
|
||||
.card { padding: 1.4rem 1.4rem; }
|
||||
.hero h1 { font-size: 2.3rem; }
|
||||
.exclusion-form { grid-template-columns: 1fr 1fr auto; }
|
||||
.exclusion-form .btn { grid-column: auto; }
|
||||
}
|
||||
Reference in New Issue
Block a user