Erscheinungsbild je Einrichtung: Vorlagen, Schriften, Farben, mehrere Installationen
- Drei Design-Vorlagen (Kreis, Klar, Kacheln) mit Feinschliff: vier gut lesbare Schriften, eckig/rund/sehr rund, Hausfarben mit Live-Kontrastprüfung und „Farbe anpassen“; der Server lehnt zu helle Farben mit Vorschlag ab - Fertige Farbpaare alle mit mindestens 4,5:1 zu Weiß - Markenfarben greifen jetzt zuverlässig (Spezifität der eingebetteten Variablen); dunkle Darstellung wird aus der Hauptfarbe abgeleitet statt fest Indigo - Checkliste „Erste Schritte“ im Dashboard für neue Einrichtungen - Startwerte (APP_NAME, ORG_NAME, BRAND_COLOR, ACCENT_COLOR) beim ersten Start - deploy/: neue-einrichtung.sh, aktualisieren.sh, sichern.sh für eine Installation je Kunde mit gemeinsamem Image - mobile/: KUNDE=<kurzname> baut die App einer Einrichtung aus mobile/kunden/<kurzname>/ inklusive deren Firebase-Dateien Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
390785d3eb
commit
21a54da2e3
56 changed files with 1140 additions and 162 deletions
42
README.md
42
README.md
|
|
@ -8,13 +8,13 @@ Tablet und Desktop.
|
|||
|
||||
**App (öffentlich)**
|
||||
|
||||
- Startseite mit großem Titelbild, Akzentkreis mit umlaufendem Text, Hinweis-Fahne (Schließzeit oder
|
||||
- Startseite je nach Vorlage – z. B. großes Titelbild mit Akzentkreis und umlaufendem Text –, Hinweis-Fahne (Schließzeit oder
|
||||
angeheftete Meldung), Suche, Bereichen, Neuigkeiten und Terminen
|
||||
- Meldungen mit Titelbild, Galerie, Video (datensparsam erst nach Klick), Dateien und Ansprechpartnern
|
||||
- Infoseiten in beliebiger Tiefe (z. B. „Dienste → Sozialer Dienst“)
|
||||
- Termine & Schließzeiten, gruppiert nach Monat, mit Kalender-Abo (`/termine.ics`)
|
||||
- Ansprechpartner-Verzeichnis, Kontaktformular, Volltextsuche
|
||||
- **Barrierearm:** klare Schrift (Montserrat, selbst gehostet), 3 Schriftgrößen, Hell/Dunkel,
|
||||
- **Barrierearm:** klare Schrift (selbst gehostet, wählbar), 3 Schriftgrößen, Hell/Dunkel,
|
||||
**Leichte Sprache** pro Seite/Meldung – geprüfte Fassung (auch als KI-Entwurf erstellt) oder, wenn so
|
||||
eingestellt, automatisch per KI übertragen (gekennzeichnet, mit „Fehler melden“)
|
||||
- **Vorlesen** jeder Seite (Knopf in der Kopfzeile) oder eines Artikels: satzweise, der gelesene Satz
|
||||
|
|
@ -47,8 +47,10 @@ Tablet und Desktop.
|
|||
verpflichtend schaltbar), „Passwort vergessen“ per E-Mail, dauerhafte Sperren gegen Durchprobieren,
|
||||
Content-Security-Policy
|
||||
- Rollen: **Redakteur** (Inhalte) und **Administrator** (zusätzlich Benutzer & Einstellungen)
|
||||
- Einstellungen: App-Name, Logo, Farbpaar (Haupt- und Akzentfarbe), Titelbild, Texte, Impressum,
|
||||
Datenschutz – das App-Symbol wird daraus automatisch erzeugt
|
||||
- **Erscheinungsbild** je Einrichtung: drei Vorlagen (*Kreis*, *Klar*, *Kacheln*) mit Feinschliff –
|
||||
Hausfarben mit Kontrastprüfung („Farbe anpassen“ dunkelt zu helle Töne ab), vier gut lesbare
|
||||
Schriften (u. a. Atkinson Hyperlegible), eckig/rund/sehr rund. Das App-Symbol wird daraus erzeugt.
|
||||
- Checkliste **„Erste Schritte“** im Dashboard führt neue Einrichtungen durch die Einrichtung
|
||||
|
||||
## Native Apps (iOS und Android)
|
||||
|
||||
|
|
@ -98,11 +100,40 @@ Ohne Docker: `npm ci && npm run build && ORIGIN=https://… BODY_SIZE_LIMIT=30M
|
|||
| `ORIGIN` | Öffentliche URL (Pflicht in Produktion, sonst schlagen Formulare fehl) |
|
||||
| `DATA_DIR` | Ordner für `app.db` und `uploads/` (Standard `./data`) |
|
||||
| `ADMIN_EMAIL` / `ADMIN_PASSWORD` | Erster Admin, wird angelegt, solange es noch keinen Benutzer gibt |
|
||||
| `APP_NAME`, `ORG_NAME`, `BRAND_COLOR`, `ACCENT_COLOR` | Optionale Startwerte beim allerersten Start |
|
||||
| `BODY_SIZE_LIMIT` | Max. Upload-Größe (im Docker-Image auf 30M gesetzt) |
|
||||
| `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM` | E-Mail-Versand für „Passwort vergessen“. Ohne SMTP steht der Link im Server-Log |
|
||||
| `GOOGLE_TOKEN_URL`, `FCM_API_URL` | Nur für Tests: andere Adressen für Firebase |
|
||||
| `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY` | Optional – sonst werden die Push-Schlüssel automatisch erzeugt und gespeichert |
|
||||
|
||||
## Mehrere Einrichtungen
|
||||
|
||||
Jede Werkstatt bekommt eine **eigene Installation**: eigener Container, eigene Datenbank, eigene
|
||||
Domain – Daten und Zugänge bleiben strikt getrennt, und jede Einrichtung gestaltet ihre App selbst
|
||||
(Vorlage, Farben, Schrift, Logo unter *Einstellungen → Erscheinungsbild*). Alle nutzen dasselbe Image.
|
||||
|
||||
```bash
|
||||
docker build -t werkstatt-app:latest . # einmal bzw. bei jedem Update
|
||||
|
||||
APP_NAME="Lindenhof-App" ORG_NAME="Lindenhof Werkstätten" BRAND_COLOR=#0f4c5c \
|
||||
deploy/neue-einrichtung.sh lindenhof app.lindenhof-werkstaetten.de it@lindenhof.de
|
||||
cd /srv/werkstatt-apps/lindenhof && docker compose up -d
|
||||
```
|
||||
|
||||
Das Skript legt `/srv/werkstatt-apps/<kurzname>/` mit `.env`, `compose.yml` und `data/` an, wählt
|
||||
einen freien Port, erzeugt ein Admin-Passwort und gibt den passenden Caddy-Block aus. `APP_NAME`,
|
||||
`ORG_NAME`, `BRAND_COLOR` und `ACCENT_COLOR` gelten nur für den allerersten Start (zu helle Farben
|
||||
werden automatisch abgedunkelt); danach zählt, was in den Einstellungen steht.
|
||||
|
||||
| Skript | Zweck |
|
||||
| ------ | ----- |
|
||||
| `deploy/neue-einrichtung.sh <kurzname> <domain> [admin-mail]` | Einrichtung anlegen |
|
||||
| `deploy/aktualisieren.sh [kurzname …]` | Image neu bauen, alle (oder die genannten) Einrichtungen nacheinander neu starten – Migrationen laufen automatisch |
|
||||
| `deploy/sichern.sh [kurzname …]` | Datenbank (konsistente Kopie im laufenden Container) und Uploads sichern, 14 Tage aufbewahren |
|
||||
|
||||
Jede Einrichtung braucht etwa 100–150 MB RAM (Limit 384 MB). Für eigene Apps im Store je
|
||||
Einrichtung siehe [`mobile/README.md`](mobile/README.md#mehrere-einrichtungen).
|
||||
|
||||
## Erweitern
|
||||
|
||||
- **Neues Feld / neuer Inhaltstyp:** `src/lib/server/db/schema.ts` ändern → `npm run db:generate`
|
||||
|
|
@ -111,6 +142,9 @@ Ohne Docker: `npm ci && npm run build && ORIGIN=https://… BODY_SIZE_LIMIT=30M
|
|||
mit Liste (`+page`) und Bearbeiten (`[id]/+page`, `neu` = anlegen). Bausteine liegen in `src/lib/admin/`.
|
||||
- **Icons** für Bereiche/Seiten: `src/lib/icons.ts`. **Farben** kommen aus den Einstellungen; alle übrigen
|
||||
Töne leitet `src/app.css` daraus ab.
|
||||
- **Design-Vorlagen, Schriften, Rundungen:** `src/lib/theme.ts`. Eine Vorlage bestimmt Kopfbereich
|
||||
(`src/lib/components/Hero*.svelte`), Bereichs-Kacheln (`Tile.svelte`) und Termine auf der Startseite;
|
||||
Rundungen wirken über `data-radius` an `<html>` und die `--radius-*`-Variablen in `src/app.css`.
|
||||
- **Öffentliche Seiten:** `src/routes/(app)/`, Datenabfragen gebündelt in `src/lib/server/content.ts`.
|
||||
|
||||
## Ideen für später
|
||||
|
|
|
|||
27
deploy/aktualisieren.sh
Executable file
27
deploy/aktualisieren.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
# Baut das Image neu und startet alle Einrichtungen mit der neuen Version.
|
||||
# Die Datenbank wird beim Start jeder Einrichtung automatisch migriert.
|
||||
#
|
||||
# deploy/aktualisieren.sh alle Einrichtungen
|
||||
# deploy/aktualisieren.sh lindenhof nur diese
|
||||
#
|
||||
# Vorher sichern: deploy/sichern.sh
|
||||
set -euo pipefail
|
||||
|
||||
BASIS="${BASIS:-/srv/werkstatt-apps}"
|
||||
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
echo "→ Image bauen"
|
||||
docker build -t werkstatt-app:latest "$REPO"
|
||||
|
||||
ordner=("$BASIS"/*/)
|
||||
[[ $# -gt 0 ]] && ordner=("${@/#/$BASIS/}")
|
||||
|
||||
# Nacheinander, damit der Speicher reicht
|
||||
for d in "${ordner[@]}"; do
|
||||
[[ -f "$d/compose.yml" ]] || continue
|
||||
echo "→ $(basename "$d")"
|
||||
docker compose --project-directory "$d" up -d
|
||||
done
|
||||
docker image prune -f >/dev/null
|
||||
echo "Fertig."
|
||||
16
deploy/compose.yml
Normal file
16
deploy/compose.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Vorlage für eine Einrichtung (eine Werkstatt). Wird von neue-einrichtung.sh in
|
||||
# den Ordner der Einrichtung kopiert. Alle Einrichtungen nutzen dasselbe Image;
|
||||
# jede hat ihre eigene .env und ihren eigenen data-Ordner.
|
||||
services:
|
||||
app:
|
||||
image: ${IMAGE:-werkstatt-app:latest}
|
||||
container_name: werkstatt-${KUNDE}
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
environment:
|
||||
PORT: 3000 # im Container immer 3000; PORT in der .env ist der Port auf dem Server
|
||||
ports:
|
||||
- '127.0.0.1:${PORT}:3000'
|
||||
volumes:
|
||||
- ./data:/data
|
||||
mem_limit: 384m
|
||||
94
deploy/neue-einrichtung.sh
Executable file
94
deploy/neue-einrichtung.sh
Executable file
|
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/env bash
|
||||
# Legt eine neue Einrichtung an: eigener Ordner mit .env, compose.yml und data/.
|
||||
#
|
||||
# deploy/neue-einrichtung.sh <kurzname> <domain> [admin-e-mail]
|
||||
#
|
||||
# Beispiel:
|
||||
# deploy/neue-einrichtung.sh lindenhof app.lindenhof-werkstaetten.de it@lindenhof.de
|
||||
#
|
||||
# Umgebung (optional):
|
||||
# BASIS Ordner für alle Einrichtungen (Standard: /srv/werkstatt-apps)
|
||||
# APP_NAME Name der App beim ersten Start
|
||||
# ORG_NAME Name der Einrichtung beim ersten Start
|
||||
# BRAND_COLOR Hauptfarbe (#rrggbb), ACCENT_COLOR Akzentfarbe
|
||||
set -euo pipefail
|
||||
|
||||
KUNDE="${1:-}"
|
||||
DOMAIN="${2:-}"
|
||||
ADMIN_EMAIL="${3:-admin@${DOMAIN}}"
|
||||
BASIS="${BASIS:-/srv/werkstatt-apps}"
|
||||
HIER="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
if [[ -z "$KUNDE" || -z "$DOMAIN" ]]; then
|
||||
sed -n '2,13p' "$0" | sed 's/^# \{0,1\}//'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! "$KUNDE" =~ ^[a-z0-9][a-z0-9-]{1,30}$ ]]; then
|
||||
echo "Kurzname nur aus Kleinbuchstaben, Ziffern und Bindestrich (z. B. lindenhof)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ZIEL="$BASIS/$KUNDE"
|
||||
if [[ -e "$ZIEL" ]]; then
|
||||
echo "$ZIEL gibt es schon – nichts verändert." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Nächsten freien Port ab 3001 wählen (belegte stehen in den .env der anderen Einrichtungen)
|
||||
PORT=3001
|
||||
belegt=$(cat "$BASIS"/*/.env 2>/dev/null | sed -n 's/^PORT=//p' || true)
|
||||
while grep -qx "$PORT" <<<"$belegt"; do PORT=$((PORT + 1)); done
|
||||
|
||||
PASSWORT=$(head -c 18 /dev/urandom | base64 | tr -d '/+=' | head -c 20)
|
||||
|
||||
mkdir -p "$ZIEL/data"
|
||||
cp "$HIER/compose.yml" "$ZIEL/compose.yml"
|
||||
umask 077
|
||||
cat >"$ZIEL/.env" <<EOF
|
||||
# Einrichtung: $KUNDE – angelegt am $(date +%F)
|
||||
KUNDE=$KUNDE
|
||||
PORT=$PORT
|
||||
ORIGIN=https://$DOMAIN
|
||||
|
||||
# Erster Admin-Zugang (nur beim allerersten Start). Nach dem ersten Login ändern
|
||||
# und diese beiden Zeilen löschen.
|
||||
ADMIN_EMAIL=$ADMIN_EMAIL
|
||||
ADMIN_PASSWORD=$PASSWORT
|
||||
|
||||
# Startwerte – danach im Admin-Bereich unter „Einstellungen“ änderbar
|
||||
APP_NAME="${APP_NAME:-}"
|
||||
ORG_NAME="${ORG_NAME:-}"
|
||||
BRAND_COLOR=${BRAND_COLOR:-}
|
||||
ACCENT_COLOR=${ACCENT_COLOR:-}
|
||||
|
||||
# E-Mail-Versand (für „Passwort vergessen“)
|
||||
SMTP_HOST=
|
||||
SMTP_PORT=587
|
||||
SMTP_SECURE=false
|
||||
SMTP_USER=
|
||||
SMTP_PASS=
|
||||
SMTP_FROM="${APP_NAME:-Werkstatt-App} <no-reply@$DOMAIN>"
|
||||
EOF
|
||||
# Der Container läuft als Benutzer „node“ (UID 1000) und muss in data/ schreiben dürfen
|
||||
chown 1000:1000 "$ZIEL/data" 2>/dev/null || chmod 777 "$ZIEL/data"
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Einrichtung „$KUNDE“ angelegt in $ZIEL
|
||||
|
||||
Adresse: https://$DOMAIN (intern Port $PORT)
|
||||
Admin: $ADMIN_EMAIL
|
||||
Passwort: $PASSWORT
|
||||
|
||||
Nächste Schritte:
|
||||
1. Starten: cd $ZIEL && docker compose up -d
|
||||
2. Caddy: folgenden Block in die Caddyfile übernehmen und Caddy neu laden
|
||||
|
||||
$DOMAIN {
|
||||
encode zstd gzip
|
||||
reverse_proxy 127.0.0.1:$PORT
|
||||
}
|
||||
|
||||
3. SMTP-Zugang in $ZIEL/.env eintragen, danach: docker compose up -d
|
||||
4. Unter https://$DOMAIN/admin anmelden – die Checkliste „Erste Schritte“ führt durch den Rest.
|
||||
EOF
|
||||
27
deploy/sichern.sh
Executable file
27
deploy/sichern.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
# Sichert Datenbank und Uploads aller Einrichtungen (oder der genannten).
|
||||
#
|
||||
# deploy/sichern.sh [kurzname …]
|
||||
#
|
||||
# Die Einrichtungen müssen laufen. Ablage: $SICHERUNG (Standard: /srv/werkstatt-apps-sicherung), 14 Tage aufbewahrt.
|
||||
set -euo pipefail
|
||||
|
||||
BASIS="${BASIS:-/srv/werkstatt-apps}"
|
||||
SICHERUNG="${SICHERUNG:-/srv/werkstatt-apps-sicherung}"
|
||||
stamp=$(date +%F-%H%M)
|
||||
mkdir -p "$SICHERUNG"
|
||||
|
||||
ordner=("$BASIS"/*/)
|
||||
[[ $# -gt 0 ]] && ordner=("${@/#/$BASIS/}")
|
||||
|
||||
for d in "${ordner[@]}"; do
|
||||
d="${d%/}"
|
||||
[[ -f "$d/data/app.db" ]] || continue
|
||||
k=$(basename "$d")
|
||||
# Konsistente Kopie der laufenden SQLite-Datenbank – im Container, dort ist better-sqlite3 vorhanden
|
||||
docker exec "werkstatt-$k" node -e "require('better-sqlite3')('/data/app.db').backup('/data/sicherung.db').then(() => process.exit(0), (e) => { console.error(e); process.exit(1); })"
|
||||
tar -czf "$SICHERUNG/$k-$stamp.tar.gz" -C "$d" .env data/uploads data/sicherung.db
|
||||
rm "$d/data/sicherung.db"
|
||||
echo "→ $k gesichert"
|
||||
done
|
||||
find "$SICHERUNG" -name '*.tar.gz' -mtime +14 -delete
|
||||
3
mobile/.gitignore
vendored
3
mobile/.gitignore
vendored
|
|
@ -8,3 +8,6 @@ ios/App/CapApp-SPM/symlinks/
|
|||
# Firebase-Konfiguration: projektspezifisch, nicht ins Repository
|
||||
android/app/google-services.json
|
||||
ios/App/App/GoogleService-Info.plist
|
||||
# Einrichtungen (je Kunde .env und Firebase-Dateien) – nicht ins Repository
|
||||
kunden/*
|
||||
!kunden/beispiel/
|
||||
|
|
|
|||
|
|
@ -155,6 +155,31 @@ In Android Studio:
|
|||
Für jede neue Version in Xcode *Version/Build* bzw. in `android/app/build.gradle`
|
||||
`versionCode`/`versionName` erhöhen.
|
||||
|
||||
## Mehrere Einrichtungen
|
||||
|
||||
Jede Werkstatt bekommt ihre eigene App im Store (eigene App-ID, eigener Name, eigenes Symbol,
|
||||
eigenes Firebase-Projekt). Statt `mobile/.env` gibt es dann je Einrichtung einen Ordner:
|
||||
|
||||
```
|
||||
mobile/kunden/lindenhof/.env ← wie .env.example
|
||||
mobile/kunden/lindenhof/google-services.json ← Firebase, Android
|
||||
mobile/kunden/lindenhof/GoogleService-Info.plist ← Firebase, iOS
|
||||
```
|
||||
|
||||
Gebaut wird immer eine Einrichtung nach der anderen:
|
||||
|
||||
```bash
|
||||
KUNDE=lindenhof npm run assets # Symbole aus deren Web-App holen
|
||||
KUNDE=lindenhof npm run sync # ID, Name, Farbe, Firebase-Dateien übernehmen
|
||||
npm run open:ios # bzw. open:android → bauen und hochladen
|
||||
```
|
||||
|
||||
`npm run sync` kopiert die Firebase-Dateien der Einrichtung an die richtige Stelle und entfernt
|
||||
die einer anderen – Push-Anmeldungen landen so nie im falschen Projekt. Stammen die Symbole noch
|
||||
von einer anderen Einrichtung, gibt es einen Hinweis. Der Ordner `kunden/` wird nicht eingecheckt
|
||||
(Vorlage: `kunden/beispiel/`). Signier-Schlüssel (Android-Keystore, Apple-Zertifikate) je
|
||||
Einrichtung sicher aufbewahren.
|
||||
|
||||
## Wenn etwas nicht klappt
|
||||
|
||||
| Problem | Prüfen |
|
||||
|
|
|
|||
|
|
@ -2,9 +2,18 @@ import fs from 'node:fs';
|
|||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
/** Liest mobile/.env (ohne zusätzliche Abhängigkeit) */
|
||||
const here = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
/**
|
||||
* Liest mobile/.env (ohne zusätzliche Abhängigkeit). Mit KUNDE=<kurzname> stattdessen
|
||||
* mobile/kunden/<kurzname>/.env – so lassen sich Apps für mehrere Einrichtungen bauen.
|
||||
*/
|
||||
export function loadEnv() {
|
||||
const file = path.join(path.dirname(fileURLToPath(import.meta.url)), '.env');
|
||||
const kunde = process.env.KUNDE ?? '';
|
||||
if (kunde && !/^[a-z0-9][a-z0-9-]*$/.test(kunde)) throw new Error(`KUNDE „${kunde}“: nur Kleinbuchstaben, Ziffern und Bindestrich.`);
|
||||
const dir = kunde ? path.join(here, 'kunden', kunde) : here;
|
||||
const file = path.join(dir, '.env');
|
||||
if (kunde && !fs.existsSync(file)) throw new Error(`${file} fehlt – siehe README, Abschnitt „Mehrere Einrichtungen“.`);
|
||||
const env = {};
|
||||
if (fs.existsSync(file)) {
|
||||
for (const line of fs.readFileSync(file, 'utf8').split('\n')) {
|
||||
|
|
@ -14,6 +23,9 @@ export function loadEnv() {
|
|||
}
|
||||
const get = (k, d) => process.env[k] || env[k] || d;
|
||||
return {
|
||||
kunde,
|
||||
/** Ordner mit .env und ggf. Firebase-Dateien der Einrichtung */
|
||||
dir,
|
||||
appUrl: get('APP_URL', 'https://app.example.org').replace(/\/+$/, ''),
|
||||
appId: get('APP_ID', 'org.example.werkstattapp'),
|
||||
appName: get('APP_NAME', 'Werkstatt-App'),
|
||||
|
|
|
|||
12
mobile/kunden/beispiel/.env.example
Normal file
12
mobile/kunden/beispiel/.env.example
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Adresse, unter der die Web-App läuft (HTTPS). Die Apps laden Inhalte von dort.
|
||||
APP_URL=https://app.example.org
|
||||
|
||||
# Eindeutige App-ID (Bundle-ID bei Apple, Paketname bei Google) – später nicht mehr änderbar!
|
||||
# Dieselbe in der Redaktion unter Einstellungen → Apps eintragen.
|
||||
APP_ID=org.example.werkstattapp
|
||||
|
||||
# Name unter dem Symbol auf dem Handy
|
||||
APP_NAME=Werkstatt-App
|
||||
|
||||
# Markenfarbe (Startbildschirm, Symbol-Hintergrund)
|
||||
BRAND_COLOR=#2e2672
|
||||
|
|
@ -58,4 +58,6 @@ execFileSync(
|
|||
],
|
||||
{ cwd: root, stdio: 'inherit' }
|
||||
);
|
||||
// Merken, für welche Einrichtung die Symbole erzeugt wurden (prüft `npm run sync`)
|
||||
fs.writeFileSync(path.join(root, 'assets', '.einrichtung'), env.appId);
|
||||
console.log('✔ Symbole und Startbildschirme erzeugt. Danach `npm run sync`.');
|
||||
|
|
|
|||
|
|
@ -17,6 +17,22 @@ const write = (f, s) => fs.writeFileSync(f, s);
|
|||
const xmlEsc = (s) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
const warnings = [];
|
||||
|
||||
// Firebase-Dateien der Einrichtung übernehmen. Fehlt eine, wird die einer anderen
|
||||
// Einrichtung entfernt – sonst landeten Push-Anmeldungen im falschen Firebase-Projekt.
|
||||
if (env.kunde) {
|
||||
for (const [name, target] of [
|
||||
['google-services.json', p('android', 'app', 'google-services.json')],
|
||||
['GoogleService-Info.plist', p('ios', 'App', 'App', 'GoogleService-Info.plist')]
|
||||
]) {
|
||||
const src = path.join(env.dir, name);
|
||||
if (fs.existsSync(src)) fs.copyFileSync(src, target);
|
||||
else fs.rmSync(target, { force: true });
|
||||
}
|
||||
}
|
||||
const assetsFor = fs.existsSync(p('assets', '.einrichtung')) ? read(p('assets', '.einrichtung')).trim() : '';
|
||||
if (assetsFor && assetsFor !== env.appId)
|
||||
warnings.push(`Symbole stammen noch von ${assetsFor} – zuerst \`${env.kunde ? `KUNDE=${env.kunde} ` : ''}npm run assets\` ausführen.`);
|
||||
|
||||
if (!env.appUrl.startsWith('https://')) warnings.push('APP_URL muss mit https:// beginnen (Apple und Google verlangen HTTPS).');
|
||||
if (env.appUrl.includes('example.org')) warnings.push('APP_URL ist noch der Platzhalter – bitte in mobile/.env eintragen.');
|
||||
if (env.appId.startsWith('org.example')) warnings.push('APP_ID ist noch der Platzhalter – vor dem ersten Hochladen in die Stores festlegen (später nicht mehr änderbar).');
|
||||
|
|
@ -184,5 +200,5 @@ if (fs.existsSync(p('ios'))) {
|
|||
warnings.push('iOS: ios/App/App/GoogleService-Info.plist fehlt – ohne sie gibt es keine Push-Nachrichten (siehe README).');
|
||||
}
|
||||
|
||||
console.log(`✔ Vorbereitet: ${env.appName} (${env.appId}) → ${env.appUrl}`);
|
||||
console.log(`✔ Vorbereitet${env.kunde ? ` für „${env.kunde}“` : ''}: ${env.appName} (${env.appId}) → ${env.appUrl}`);
|
||||
for (const w of warnings) console.warn(`⚠ ${w}`);
|
||||
|
|
|
|||
33
package-lock.json
generated
33
package-lock.json
generated
|
|
@ -20,7 +20,10 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/core": "^8.5.2",
|
||||
"@fontsource-variable/atkinson-hyperlegible-next": "^5.3.0",
|
||||
"@fontsource-variable/lexend": "^5.3.0",
|
||||
"@fontsource-variable/montserrat": "^5.3.0",
|
||||
"@fontsource-variable/source-sans-3": "^5.3.0",
|
||||
"@lucide/svelte": "^1.48.0",
|
||||
"@sveltejs/adapter-node": "^5.5.7",
|
||||
"@sveltejs/kit": "^2.70.3",
|
||||
|
|
@ -983,6 +986,26 @@
|
|||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/atkinson-hyperlegible-next": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/atkinson-hyperlegible-next/-/atkinson-hyperlegible-next-5.3.0.tgz",
|
||||
"integrity": "sha512-UnLzNUy1RWoLDfydAatP4NaRm99X/WbQEph7q/PymJnCFIOOwKOx3pBmp5ys8trO0dM+CKGuJgeZP9fAR4mQpA==",
|
||||
"dev": true,
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/lexend": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/lexend/-/lexend-5.3.0.tgz",
|
||||
"integrity": "sha512-3SXtiZ8rFbT0oaPzEboCG5RM3jtyhpNxandh1jWNLqvrJRfV/eP3R+GGw+o5e3hS1uqmAGutKxSvaWG5oyrimA==",
|
||||
"dev": true,
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/montserrat": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/montserrat/-/montserrat-5.3.0.tgz",
|
||||
|
|
@ -993,6 +1016,16 @@
|
|||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/source-sans-3": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/source-sans-3/-/source-sans-3-5.3.0.tgz",
|
||||
"integrity": "sha512-dpi0GZk7EQe2tYpg6Q0Fx0OmUgnuGu+0rHPgtXqtKhglYmJuP7jZ12Mu1uN+NfRaJRY1Emn8AQJEWzmoZ4wa9g==",
|
||||
"dev": true,
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@img/colour": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@capacitor/core": "^8.5.2",
|
||||
"@fontsource-variable/atkinson-hyperlegible-next": "^5.3.0",
|
||||
"@fontsource-variable/lexend": "^5.3.0",
|
||||
"@fontsource-variable/montserrat": "^5.3.0",
|
||||
"@fontsource-variable/source-sans-3": "^5.3.0",
|
||||
"@lucide/svelte": "^1.48.0",
|
||||
"@sveltejs/adapter-node": "^5.5.7",
|
||||
"@sveltejs/kit": "^2.70.3",
|
||||
|
|
|
|||
81
src/app.css
81
src/app.css
|
|
@ -1,13 +1,23 @@
|
|||
@import 'tailwindcss';
|
||||
@import '@fontsource-variable/montserrat';
|
||||
@import '@fontsource-variable/montserrat/wght-italic.css';
|
||||
/* Weitere Schriften zur Auswahl (Einstellungen → Erscheinungsbild). Browser laden nur die verwendete. */
|
||||
@import '@fontsource-variable/atkinson-hyperlegible-next';
|
||||
@import '@fontsource-variable/lexend';
|
||||
@import '@fontsource-variable/source-sans-3';
|
||||
@plugin '@tailwindcss/typography';
|
||||
|
||||
/* ─── Design-Tokens ──────────────────────────────────────────────────────────
|
||||
Zwei Markenfarben aus den Einstellungen (--brand, --accent), alles andere
|
||||
wird daraus abgeleitet. So passt das Farbschema zu jeder Einrichtung. */
|
||||
wird daraus abgeleitet – auch die dunkle Darstellung. So passt das Farbschema
|
||||
zu jeder Einrichtung. */
|
||||
|
||||
:root {
|
||||
/* Schrift – wird aus den Einstellungen gesetzt (src/routes/+layout.svelte) */
|
||||
--app-font: 'Montserrat Variable';
|
||||
--body-weight: 500;
|
||||
/* Pillenform von Knöpfen und Bereichen; bei „eckig“ kleiner */
|
||||
--radius-pill: 999px;
|
||||
--brand: #2e2672;
|
||||
--accent: #85357c;
|
||||
--bg: #ffffff;
|
||||
|
|
@ -31,13 +41,13 @@
|
|||
}
|
||||
|
||||
:root[data-theme='dark'] {
|
||||
--bg: #131129;
|
||||
--surface: #1b1839;
|
||||
--surface-2: #242050;
|
||||
--ink: #efedfb;
|
||||
--ink-2: #bdb9dc;
|
||||
--ink-3: #a19dc9;
|
||||
--line: #302b63;
|
||||
--bg: color-mix(in oklab, var(--brand) 22%, #0c0c12);
|
||||
--surface: color-mix(in oklab, var(--brand) 26%, #15151d);
|
||||
--surface-2: color-mix(in oklab, var(--brand) 36%, #1b1b25);
|
||||
--ink: color-mix(in oklab, var(--brand) 6%, #f5f5f9);
|
||||
--ink-2: color-mix(in oklab, var(--brand) 16%, #c6c6d4);
|
||||
--ink-3: color-mix(in oklab, var(--brand) 18%, #acacbf);
|
||||
--line: color-mix(in oklab, var(--brand) 45%, #2a2a35);
|
||||
--shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
|
||||
--shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 24px 48px -20px rgb(0 0 0 / 0.75);
|
||||
--brand-soft: color-mix(in oklab, var(--brand) 45%, var(--surface));
|
||||
|
|
@ -50,13 +60,13 @@
|
|||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root[data-theme='system'] {
|
||||
--bg: #131129;
|
||||
--surface: #1b1839;
|
||||
--surface-2: #242050;
|
||||
--ink: #efedfb;
|
||||
--ink-2: #bdb9dc;
|
||||
--ink-3: #a19dc9;
|
||||
--line: #302b63;
|
||||
--bg: color-mix(in oklab, var(--brand) 22%, #0c0c12);
|
||||
--surface: color-mix(in oklab, var(--brand) 26%, #15151d);
|
||||
--surface-2: color-mix(in oklab, var(--brand) 36%, #1b1b25);
|
||||
--ink: color-mix(in oklab, var(--brand) 6%, #f5f5f9);
|
||||
--ink-2: color-mix(in oklab, var(--brand) 16%, #c6c6d4);
|
||||
--ink-3: color-mix(in oklab, var(--brand) 18%, #acacbf);
|
||||
--line: color-mix(in oklab, var(--brand) 45%, #2a2a35);
|
||||
--shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
|
||||
--shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 24px 48px -20px rgb(0 0 0 / 0.75);
|
||||
--brand-soft: color-mix(in oklab, var(--brand) 45%, var(--surface));
|
||||
|
|
@ -68,14 +78,31 @@
|
|||
}
|
||||
}
|
||||
|
||||
/* Rundungen (Einstellungen → Erscheinungsbild). Überschreibt Tailwinds Rundungs-Variablen. */
|
||||
:root[data-radius='eckig'] {
|
||||
--radius-sm: 0.125rem;
|
||||
--radius-md: 0.25rem;
|
||||
--radius-lg: 0.3rem;
|
||||
--radius-xl: 0.375rem;
|
||||
--radius-2xl: 0.5rem;
|
||||
--radius-3xl: 0.625rem;
|
||||
--radius-pill: 0.5rem;
|
||||
}
|
||||
:root[data-radius='sehr-rund'] {
|
||||
--radius-lg: 0.75rem;
|
||||
--radius-xl: 1rem;
|
||||
--radius-2xl: 1.375rem;
|
||||
--radius-3xl: 2rem;
|
||||
}
|
||||
|
||||
/* Schriftgrößen – alles in Tailwind ist rem-basiert und skaliert mit */
|
||||
:root[data-size='m'] { font-size: 100%; }
|
||||
:root[data-size='l'] { font-size: 115%; }
|
||||
:root[data-size='xl'] { font-size: 132%; }
|
||||
|
||||
@theme inline {
|
||||
--font-sans: 'Montserrat Variable', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
|
||||
--font-display: 'Montserrat Variable', ui-sans-serif, system-ui, sans-serif;
|
||||
--font-sans: var(--app-font), ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
|
||||
--font-display: var(--app-font), ui-sans-serif, system-ui, sans-serif;
|
||||
|
||||
--color-bg: var(--bg);
|
||||
--color-surface: var(--surface);
|
||||
|
|
@ -140,7 +167,7 @@
|
|||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-sans);
|
||||
font-weight: 500;
|
||||
font-weight: var(--body-weight);
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
text-rendering: optimizeLegibility;
|
||||
|
|
@ -165,7 +192,7 @@
|
|||
@layer components {
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border-radius: 1rem;
|
||||
border-radius: var(--radius-2xl);
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
.pressable {
|
||||
|
|
@ -182,7 +209,7 @@
|
|||
gap: 0.55rem;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.5rem 1.25rem;
|
||||
border-radius: 999px;
|
||||
border-radius: var(--radius-pill);
|
||||
font-weight: 700;
|
||||
transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
|
||||
white-space: nowrap;
|
||||
|
|
@ -246,11 +273,11 @@
|
|||
--tw-prose-hr: var(--line);
|
||||
font-size: 1.05rem;
|
||||
line-height: 1.75;
|
||||
font-weight: 500;
|
||||
font-weight: var(--body-weight);
|
||||
}
|
||||
.rich :where(h2, h3) { font-family: var(--font-display); font-weight: 700; }
|
||||
.rich :where(strong) { font-weight: 700; }
|
||||
.rich :where(img) { border-radius: 1rem; }
|
||||
.rich :where(img) { border-radius: var(--radius-2xl); }
|
||||
.rich :where(a) { text-underline-offset: 3px; font-weight: 600; }
|
||||
.rich :where(p:first-child) { margin-top: 0; }
|
||||
|
||||
|
|
@ -260,7 +287,7 @@
|
|||
width: 100%;
|
||||
min-height: 2.75rem;
|
||||
padding: 0.6rem 0.95rem;
|
||||
border-radius: 0.75rem;
|
||||
border-radius: var(--radius-xl);
|
||||
border: 1.5px solid var(--line);
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
|
|
@ -300,6 +327,14 @@
|
|||
text-underline-offset: 4px;
|
||||
}
|
||||
|
||||
@utility rounded-pill {
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
@utility rounded-l-pill {
|
||||
border-top-left-radius: var(--radius-pill);
|
||||
border-bottom-left-radius: var(--radius-pill);
|
||||
}
|
||||
|
||||
@utility safe-bottom {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype html>
|
||||
<html lang="de" data-theme="%wa.theme%" data-size="%wa.size%" data-client="%wa.client%">
|
||||
<html lang="de" data-theme="%wa.theme%" data-size="%wa.size%" data-client="%wa.client%" data-preset="%wa.preset%" data-radius="%wa.radius%">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ import { redirect } from '@sveltejs/kit';
|
|||
import { SESSION_COOKIE, ensureInitialAdmin, purgeExpiredSessions, validateSession } from '$lib/server/auth';
|
||||
import { purgeRateLimits } from '$lib/server/ratelimit';
|
||||
import { startPushScheduler } from '$lib/server/push';
|
||||
import { getSettings } from '$lib/server/settings';
|
||||
import { applyInitialSettings, getSettings } from '$lib/server/settings';
|
||||
import { PREFS_COOKIE, parsePrefs } from '$lib/prefs';
|
||||
|
||||
export const init: ServerInit = async () => {
|
||||
applyInitialSettings();
|
||||
await ensureInitialAdmin();
|
||||
const cleanup = () => {
|
||||
purgeExpiredSessions();
|
||||
|
|
@ -72,9 +73,15 @@ export const handle: Handle = async ({ event, resolve }) => {
|
|||
const { theme, size } = event.locals.prefs;
|
||||
// Die nativen Apps melden sich mit „WerkstattApp/…“ im User-Agent (siehe mobile/capacitor.config.ts)
|
||||
const client = event.request.headers.get('user-agent')?.includes('WerkstattApp/') ? 'app' : 'web';
|
||||
const design = getSettings().theme;
|
||||
const response = await resolve(event, {
|
||||
transformPageChunk: ({ html }) =>
|
||||
html.replace('%wa.theme%', theme).replace('%wa.size%', size).replace('%wa.client%', client)
|
||||
html
|
||||
.replace('%wa.theme%', theme)
|
||||
.replace('%wa.size%', size)
|
||||
.replace('%wa.client%', client)
|
||||
.replace('%wa.preset%', design.preset)
|
||||
.replace('%wa.radius%', design.radius)
|
||||
});
|
||||
|
||||
response.headers.set('X-Content-Type-Options', 'nosniff');
|
||||
|
|
|
|||
197
src/lib/admin/DesignSettings.svelte
Normal file
197
src/lib/admin/DesignSettings.svelte
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
<script lang="ts">
|
||||
import Check from '@lucide/svelte/icons/check';
|
||||
import TriangleAlert from '@lucide/svelte/icons/triangle-alert';
|
||||
import { FONTS, PRESETS, RADII, type FontKey, type Preset, type RadiusKey, type Theme } from '$lib/theme';
|
||||
import { contrast, darkenForContrast, isHex, MIN_CONTRAST } from '$lib/color';
|
||||
|
||||
/**
|
||||
* Erscheinungsbild: Vorlage wählen, dann Schrift, Rundungen und Farben anpassen.
|
||||
* Die Farben werden live auf Lesbarkeit (Kontrast zu Weiß) geprüft.
|
||||
*/
|
||||
let { theme, brandColor, accentColor }: { theme: Theme; brandColor: string; accentColor: string } = $props();
|
||||
|
||||
// Startwerte gleich aus den Einstellungen – ein leerer Farbwähler würde sonst #000000 zurückschreiben
|
||||
const initial = () => ({ ...theme, color: brandColor, accent: accentColor });
|
||||
let preset = $state<Preset>(initial().preset);
|
||||
let font = $state<FontKey>(initial().font);
|
||||
let radius = $state<RadiusKey>(initial().radius);
|
||||
let color = $state(initial().color);
|
||||
let accent = $state(initial().accent);
|
||||
// nach dem Speichern mit den gespeicherten Werten abgleichen
|
||||
$effect.pre(() => {
|
||||
preset = theme.preset;
|
||||
font = theme.font;
|
||||
radius = theme.radius;
|
||||
color = brandColor;
|
||||
accent = accentColor;
|
||||
});
|
||||
|
||||
/** Vorlage wählen übernimmt die empfohlene Schrift und Rundung – beides bleibt änderbar */
|
||||
function choose(p: Preset) {
|
||||
preset = p;
|
||||
font = PRESETS[p].font;
|
||||
radius = PRESETS[p].radius;
|
||||
}
|
||||
|
||||
// Farbpaare aus Hauptfarbe (Schrift, Buttons) und Akzent (Kreis, Hervorhebungen) –
|
||||
// alle mit mindestens 4,5:1 zu Weiß
|
||||
const pairs = [
|
||||
['#2e2672', '#85357c'],
|
||||
['#0f4c5c', '#b3470f'],
|
||||
['#1d3557', '#c0262f'],
|
||||
['#264027', '#8a5a14'],
|
||||
['#3a2e39', '#13705f'],
|
||||
['#12355b', '#8f6400'],
|
||||
['#4a1d5c', '#b0306e'],
|
||||
['#1f2a44', '#2f6f4f']
|
||||
] as const;
|
||||
|
||||
const ratio = (c: string) => (isHex(c) ? contrast(c, '#ffffff') : 0);
|
||||
const fmt = (r: number) => r.toFixed(1).replace('.', ',');
|
||||
|
||||
const radiusPx: Record<RadiusKey, string> = { eckig: '4px', rund: '10px', 'sehr-rund': '18px' };
|
||||
</script>
|
||||
|
||||
{#snippet preview(p: Preset)}
|
||||
<!-- Schematische Mini-Vorschau der Startseite -->
|
||||
<span class="block aspect-[4/3] rounded-lg bg-white overflow-hidden border border-line p-1.5 space-y-1" aria-hidden="true">
|
||||
{#if p === 'kreis'}
|
||||
<span class="relative block h-[42%] rounded-md overflow-hidden bg-[#c9c3d9]">
|
||||
<span class="absolute -right-3 -bottom-4 size-10 rounded-full" style="background:{accent}"></span>
|
||||
</span>
|
||||
<span class="grid grid-cols-2 gap-1">
|
||||
{#each [1, 2, 3, 4] as i (i)}<span class="h-2.5 rounded-full bg-[#ece9f3]"></span>{/each}
|
||||
</span>
|
||||
<span class="block h-[22%] rounded-md" style="background:{color}"></span>
|
||||
{:else if p === 'klar'}
|
||||
<span class="relative block h-[42%] rounded-sm bg-[#c9c3d9]">
|
||||
<span class="absolute left-1 bottom-1 h-1.5 w-1/2 rounded-sm bg-white"></span>
|
||||
</span>
|
||||
<span class="grid grid-cols-2 gap-1">
|
||||
{#each [1, 2, 3, 4] as i (i)}<span class="h-3 rounded-sm border border-[#d9d6e2] flex items-center px-0.5"><span class="size-1.5 rounded-[1px]" style="background:{color}"></span></span>{/each}
|
||||
</span>
|
||||
<span class="block space-y-0.5">
|
||||
<span class="block h-1 w-3/4 rounded-sm bg-[#d9d6e2]"></span>
|
||||
<span class="block h-1 w-1/2 rounded-sm bg-[#d9d6e2]"></span>
|
||||
</span>
|
||||
{:else}
|
||||
<span class="block h-[26%] rounded-md" style="background:{color}"></span>
|
||||
<span class="grid grid-cols-3 gap-1">
|
||||
{#each [1, 2, 3, 4, 5, 6] as i (i)}<span class="aspect-square rounded-md bg-[#ece9f3] grid place-items-center"><span class="size-2 rounded-[3px]" style="background:{color}"></span></span>{/each}
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
{/snippet}
|
||||
|
||||
{#snippet colorCheck(value: string, label: string, set: (v: string) => void)}
|
||||
{@const r = ratio(value)}
|
||||
{#if !isHex(value)}
|
||||
<p class="text-sm font-semibold text-danger" role="status">Bitte als #rrggbb angeben.</p>
|
||||
{:else if r >= MIN_CONTRAST}
|
||||
<p class="text-sm text-ink-2 flex items-center gap-1.5" role="status">
|
||||
<span class="tone-emerald grid place-items-center size-5 rounded-full bg-tone-soft text-tone-ink shrink-0"><Check class="size-3.5" strokeWidth={3} /></span>Kontrast {fmt(r)} : 1 – gut lesbar
|
||||
</p>
|
||||
{:else}
|
||||
<div class="rounded-xl bg-danger/10 p-3 text-sm space-y-2" role="status">
|
||||
<p class="flex gap-1.5 font-semibold text-danger">
|
||||
<TriangleAlert class="size-4 shrink-0 mt-0.5" />{label}: Kontrast nur {fmt(r)} : 1 (nötig sind {fmt(MIN_CONTRAST)} : 1). Weiße Schrift darauf ist schlecht lesbar.
|
||||
</p>
|
||||
<button type="button" class="btn btn-soft btn-sm" onclick={() => set(darkenForContrast(value))}>
|
||||
<span class="size-4 rounded-full border border-line" style="background:{darkenForContrast(value)}" aria-hidden="true"></span>
|
||||
Farbe anpassen ({darkenForContrast(value)})
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
<div class="space-y-7">
|
||||
<!-- Vorlage -->
|
||||
<fieldset>
|
||||
<legend class="label">Vorlage</legend>
|
||||
<div class="grid sm:grid-cols-3 gap-3">
|
||||
{#each Object.entries(PRESETS) as [key, p] (key)}
|
||||
<label class="relative block cursor-pointer rounded-2xl border-2 p-2.5 transition has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-brand/25 {preset === key ? 'border-brand bg-brand-soft' : 'border-line hover:border-brand/40'}">
|
||||
<input type="radio" name="themePreset" value={key} checked={preset === key} onchange={() => choose(key as Preset)} class="sr-only" />
|
||||
{@render preview(key as Preset)}
|
||||
<span class="flex items-center justify-between gap-2 mt-2">
|
||||
<span class="font-bold">{p.label}</span>
|
||||
{#if preset === key}<span class="grid place-items-center size-5 rounded-full bg-brand text-on-brand"><Check class="size-3.5" strokeWidth={3} /></span>{/if}
|
||||
</span>
|
||||
<span class="block text-sm text-ink-2 leading-snug mt-0.5">{p.description}</span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
<p class="hint">Eine Vorlage setzt passende Schrift und Rundungen – beides lässt sich danach ändern.</p>
|
||||
</fieldset>
|
||||
|
||||
<!-- Farben -->
|
||||
<fieldset class="space-y-3">
|
||||
<legend class="label">Farben</legend>
|
||||
<div class="flex flex-wrap gap-2" role="group" aria-label="Fertige Farbpaare">
|
||||
{#each pairs as [p, a] (p)}
|
||||
<button
|
||||
type="button"
|
||||
class="flex rounded-pill overflow-hidden ring-offset-2 ring-offset-surface transition {color.toLowerCase() === p && accent.toLowerCase() === a ? 'ring-3 ring-ink' : 'hover:scale-105'}"
|
||||
aria-label="Farbpaar {p} und {a}"
|
||||
aria-pressed={color.toLowerCase() === p && accent.toLowerCase() === a}
|
||||
onclick={() => {
|
||||
color = p;
|
||||
accent = a;
|
||||
}}
|
||||
>
|
||||
<span class="size-8" style="background:{p}"></span><span class="size-8" style="background:{a}"></span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="grid sm:grid-cols-2 gap-4">
|
||||
<div class="space-y-2">
|
||||
<label class="label mb-0" for="brandColor">Hauptfarbe</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" bind:value={color} class="size-10 shrink-0 rounded-lg border border-line cursor-pointer bg-transparent" aria-label="Hauptfarbe wählen" />
|
||||
<input id="brandColor" name="brandColor" bind:value={color} class="field font-mono text-sm px-2" maxlength="7" aria-describedby="brand-hint" />
|
||||
</div>
|
||||
<p id="brand-hint" class="hint mt-0">Für Überschriften, Buttons und Flächen.</p>
|
||||
{@render colorCheck(color, 'Hauptfarbe', (v) => (color = v))}
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="label mb-0" for="accentColor">Akzent</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" bind:value={accent} class="size-10 shrink-0 rounded-lg border border-line cursor-pointer bg-transparent" aria-label="Akzentfarbe wählen" />
|
||||
<input id="accentColor" name="accentColor" bind:value={accent} class="field font-mono text-sm px-2" maxlength="7" aria-describedby="accent-hint" />
|
||||
</div>
|
||||
<p id="accent-hint" class="hint mt-0">Für Kreis, Hervorhebungen und Hinweise.</p>
|
||||
{@render colorCheck(accent, 'Akzent', (v) => (accent = v))}
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Schrift -->
|
||||
<fieldset>
|
||||
<legend class="label">Schrift</legend>
|
||||
<div class="grid sm:grid-cols-2 gap-2.5">
|
||||
{#each Object.entries(FONTS) as [key, f] (key)}
|
||||
<label class="flex items-start gap-3 cursor-pointer rounded-xl border-2 px-3.5 py-3 transition has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-brand/25 {font === key ? 'border-brand bg-brand-soft' : 'border-line hover:border-brand/40'}">
|
||||
<input type="radio" name="themeFont" value={key} bind:group={font} class="mt-1.5 size-4 accent-[var(--brand)]" />
|
||||
<span class="min-w-0">
|
||||
<span class="block text-lg font-bold leading-tight" style="font-family:{f.family}">{f.label}</span>
|
||||
<span class="block text-sm text-ink-2 leading-snug" style="font-family:{f.family};font-weight:{f.body}">{f.hint}</span>
|
||||
</span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Rundungen -->
|
||||
<fieldset>
|
||||
<legend class="label">Ecken</legend>
|
||||
<div class="flex flex-wrap gap-2.5">
|
||||
{#each Object.entries(RADII) as [key, r] (key)}
|
||||
<label class="flex items-center gap-2.5 cursor-pointer rounded-xl border-2 px-3.5 py-2.5 transition has-[:focus-visible]:ring-4 has-[:focus-visible]:ring-brand/25 {radius === key ? 'border-brand bg-brand-soft' : 'border-line hover:border-brand/40'}">
|
||||
<input type="radio" name="themeRadius" value={key} bind:group={radius} class="sr-only" />
|
||||
<span class="size-7 border-[3px] border-b-0 border-r-0" style="border-color:{color};border-top-left-radius:{radiusPx[key as RadiusKey]}" aria-hidden="true"></span>
|
||||
<span class="font-bold">{r.label}</span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<input type="hidden" name="icon" value={icon} />
|
||||
<input type="hidden" name="color" value={color} />
|
||||
|
||||
<div class="flex items-center gap-4 rounded-full bg-surface-2 pl-2 pr-5 py-2 max-w-sm">
|
||||
<div class="flex items-center gap-4 rounded-pill bg-surface-2 pl-2 pr-5 py-2 max-w-sm">
|
||||
<span class="grid place-items-center size-12 rounded-full bg-surface text-brand-ink"><Icon name={icon} class="size-[1.35rem]" /></span>
|
||||
<span class="font-bold text-brand-ink truncate">{label || 'Vorschau'}</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte';
|
||||
let { title = '', description = '', children }: { title?: string; description?: string; children: Snippet } = $props();
|
||||
let { title = '', description = '', id, children }: { title?: string; description?: string; id?: string; children: Snippet } = $props();
|
||||
</script>
|
||||
|
||||
<section class="card p-5 sm:p-6 space-y-5">
|
||||
<section {id} class="card p-5 sm:p-6 space-y-5 scroll-mt-24">
|
||||
{#if title}
|
||||
<header>
|
||||
<h2 class="font-display text-lg font-bold">{title}</h2>
|
||||
|
|
|
|||
59
src/lib/admin/SetupChecklist.svelte
Normal file
59
src/lib/admin/SetupChecklist.svelte
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<script lang="ts">
|
||||
import { enhance } from '$app/forms';
|
||||
import Check from '@lucide/svelte/icons/check';
|
||||
import ChevronRight from '@lucide/svelte/icons/chevron-right';
|
||||
import Rocket from '@lucide/svelte/icons/rocket';
|
||||
import type { SetupStep } from '$lib/server/setup';
|
||||
|
||||
/** Checkliste „Erste Schritte“ für neue Einrichtungen im Dashboard */
|
||||
let { steps }: { steps: SetupStep[] } = $props();
|
||||
|
||||
const required = $derived(steps.filter((s) => !s.optional));
|
||||
const optional = $derived(steps.filter((s) => s.optional));
|
||||
const done = $derived(required.filter((s) => s.done).length);
|
||||
const complete = $derived(done === required.length);
|
||||
</script>
|
||||
|
||||
{#snippet item(s: SetupStep)}
|
||||
<li>
|
||||
<a href={s.href} class="group flex items-center gap-3 py-2.5 rounded-lg hover:text-brand-ink">
|
||||
{#if s.done}
|
||||
<span class="tone-emerald grid place-items-center size-7 rounded-full bg-tone-soft text-tone-ink shrink-0"><Check class="size-4" strokeWidth={3} /></span>
|
||||
{:else}
|
||||
<span class="size-7 rounded-full border-2 border-dashed border-ink-3 shrink-0" aria-hidden="true"></span>
|
||||
{/if}
|
||||
<span class="flex-1 min-w-0">
|
||||
<span class="block font-semibold {s.done ? 'text-ink-2' : ''}">{s.label}<span class="sr-only">{s.done ? ' – erledigt' : ' – offen'}</span></span>
|
||||
{#if !s.done}<span class="block text-sm text-ink-3">{s.hint}</span>{/if}
|
||||
</span>
|
||||
<ChevronRight class="size-4 text-ink-3 shrink-0 transition-transform group-hover:translate-x-0.5" />
|
||||
</a>
|
||||
</li>
|
||||
{/snippet}
|
||||
|
||||
<section class="card p-5 mb-6" aria-labelledby="erste-schritte">
|
||||
<div class="flex flex-wrap items-start gap-4 mb-4">
|
||||
<span class="grid place-items-center size-11 rounded-full bg-brand text-on-brand shrink-0" aria-hidden="true"><Rocket class="size-5" /></span>
|
||||
<div class="flex-1 min-w-48">
|
||||
<h2 id="erste-schritte" class="text-lg font-bold">{complete ? 'Alles eingerichtet!' : 'Erste Schritte'}</h2>
|
||||
<p class="text-sm text-ink-3">
|
||||
{complete ? 'Die App ist startklar. Die Liste kann jetzt weg.' : `${done} von ${required.length} erledigt – danach ist die App startklar.`}
|
||||
</p>
|
||||
</div>
|
||||
<form method="POST" action="?/hideSetup" use:enhance>
|
||||
<button class="btn {complete ? 'btn-primary' : 'btn-ghost'} btn-sm">Ausblenden</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="h-2 rounded-pill bg-surface-2 overflow-hidden mb-3" role="progressbar" aria-label="Fortschritt der Einrichtung" aria-valuemin={0} aria-valuemax={required.length} aria-valuenow={done}>
|
||||
<div class="h-full rounded-pill bg-brand transition-all" style="width:{(done / required.length) * 100}%"></div>
|
||||
</div>
|
||||
<ul class="grid md:grid-cols-2 gap-x-8 divide-y divide-line md:divide-y-0">
|
||||
{#each required as s (s.key)}{@render item(s)}{/each}
|
||||
</ul>
|
||||
{#if optional.length}
|
||||
<h3 class="text-sm font-bold text-ink-2 mt-4 mb-1">Optional</h3>
|
||||
<ul class="grid md:grid-cols-2 gap-x-8 divide-y divide-line md:divide-y-0">
|
||||
{#each optional as s (s.key)}{@render item(s)}{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</section>
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
type="button"
|
||||
role="radio"
|
||||
aria-checked={status === s}
|
||||
class="tone-{STATUS_TONE[s]} inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm font-bold border-2 transition {status === s ? 'border-tone bg-tone-soft text-tone-ink' : 'border-line text-ink-2 hover:border-ink-3'}"
|
||||
class="tone-{STATUS_TONE[s]} inline-flex items-center gap-1.5 rounded-pill px-3 py-1.5 text-sm font-bold border-2 transition {status === s ? 'border-tone bg-tone-soft text-tone-ink' : 'border-line text-ink-2 hover:border-ink-3'}"
|
||||
onclick={() => (status = s)}
|
||||
>
|
||||
<span class="size-2 rounded-full bg-tone" aria-hidden="true"></span>{EDITORIAL_STATUS[s]}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<button type="button" class="font-semibold text-left hover:underline underline-offset-2" onclick={() => onopen(r)}>{r.title}</button>
|
||||
</td>
|
||||
<td class="px-3 py-2.5">
|
||||
<span class="tone-{STATUS_TONE[r.status]} inline-flex items-center gap-1.5 rounded-full bg-tone-soft text-tone-ink px-2.5 py-0.5 text-xs font-bold whitespace-nowrap">
|
||||
<span class="tone-{STATUS_TONE[r.status]} inline-flex items-center gap-1.5 rounded-pill bg-tone-soft text-tone-ink px-2.5 py-0.5 text-xs font-bold whitespace-nowrap">
|
||||
<span class="size-1.5 rounded-full bg-tone" aria-hidden="true"></span>{EDITORIAL_STATUS[r.status]}
|
||||
</span>
|
||||
</td>
|
||||
|
|
|
|||
44
src/lib/color.ts
Normal file
44
src/lib/color.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/** Farb-Hilfen für die Kontrastprüfung nach WCAG 2.x */
|
||||
|
||||
const toRgb = (hex: string) => {
|
||||
const n = parseInt(hex.slice(1), 16);
|
||||
return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
|
||||
};
|
||||
const toHex = (rgb: number[]) => '#' + rgb.map((v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, '0')).join('');
|
||||
|
||||
export const isHex = (v: string) => /^#[0-9a-f]{6}$/i.test(v);
|
||||
|
||||
export function luminance(hex: string) {
|
||||
const [r, g, b] = toRgb(hex).map((v) => {
|
||||
const c = v / 255;
|
||||
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
||||
});
|
||||
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||
}
|
||||
|
||||
/** Kontrastverhältnis zweier Farben (1 bis 21) */
|
||||
export function contrast(a: string, b: string) {
|
||||
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
||||
return (hi + 0.05) / (lo + 0.05);
|
||||
}
|
||||
|
||||
/** Mindestkontrast für normale Schrift (WCAG AA) */
|
||||
export const MIN_CONTRAST = 4.5;
|
||||
|
||||
/**
|
||||
* Dunkelt eine Farbe in kleinen Schritten ab, bis weiße Schrift darauf (und die
|
||||
* Farbe als Schrift auf Weiß) mindestens 4,5:1 erreicht. Der Farbton bleibt erhalten.
|
||||
*/
|
||||
export function darkenForContrast(hex: string, min = MIN_CONTRAST): string {
|
||||
let rgb = toRgb(hex);
|
||||
for (let i = 0; i < 60 && contrast(toHex(rgb), '#ffffff') < min; i++) rgb = rgb.map((v) => v * 0.96);
|
||||
return toHex(rgb);
|
||||
}
|
||||
|
||||
/** Prüft die Markenfarben: beide werden als Schrift auf Weiß und als Fläche unter weißer Schrift genutzt */
|
||||
export function checkBrandColors(brand: string, accent: string) {
|
||||
const problems: string[] = [];
|
||||
if (contrast(brand, '#ffffff') < MIN_CONTRAST) problems.push('brand');
|
||||
if (contrast(accent, '#ffffff') < MIN_CONTRAST) problems.push('accent');
|
||||
return problems as ('brand' | 'accent')[];
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
const tel = $derived(contact.phone.replace(/[^\d+]/g, ''));
|
||||
</script>
|
||||
|
||||
<div class="rounded-[1.5rem] bg-surface-2 p-4 flex gap-4">
|
||||
<div class="rounded-3xl bg-surface-2 p-4 flex gap-4">
|
||||
{#if contact.photo}
|
||||
<img src={contact.photo.thumb} alt="" class="size-16 rounded-full object-cover shrink-0" loading="lazy" />
|
||||
{:else}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
let { title, children, icon }: { title: string; children?: Snippet; icon?: Snippet } = $props();
|
||||
</script>
|
||||
|
||||
<div class="rounded-[1.75rem] bg-surface-2 p-10 text-center flex flex-col items-center gap-3">
|
||||
<div class="rounded-3xl bg-surface-2 p-10 text-center flex flex-col items-center gap-3">
|
||||
{#if icon}<div class="grid place-items-center size-14 rounded-full bg-surface text-brand-ink">{@render icon()}</div>{/if}
|
||||
<p class="font-bold text-lg text-brand-ink">{title}</p>
|
||||
{#if children}<div class="text-ink-2 max-w-sm">{@render children()}</div>{/if}
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@
|
|||
class="shrink-0 grid place-items-center content-center size-[4.5rem] rounded-full text-center leading-none {closure ? 'bg-accent text-white' : 'bg-surface-2 text-brand-ink'}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span class="text-[0.65rem] font-semibold uppercase tracking-[0.15em] opacity-75">{weekday(event.startDate)}</span>
|
||||
<span class="text-[0.65rem] font-semibold uppercase tracking-[0.15em]">{weekday(event.startDate)}</span>
|
||||
<span class="text-2xl font-bold my-0.5">{dayOfMonth(event.startDate)}</span>
|
||||
<span class="text-[0.7rem] font-semibold uppercase tracking-wider opacity-75">{monthAbbr(event.startDate)}</span>
|
||||
<span class="text-[0.7rem] font-semibold uppercase tracking-wider">{monthAbbr(event.startDate)}</span>
|
||||
</div>
|
||||
<div class="min-w-0 pt-1">
|
||||
{#if closure}
|
||||
|
|
|
|||
47
src/lib/components/HeroKacheln.svelte
Normal file
47
src/lib/components/HeroKacheln.svelte
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<script lang="ts">
|
||||
import Search from '@lucide/svelte/icons/search';
|
||||
import Megaphone from '@lucide/svelte/icons/megaphone';
|
||||
import ArrowRight from '@lucide/svelte/icons/arrow-right';
|
||||
import type { MediaItem } from '$lib/types';
|
||||
|
||||
type Highlight = { eyebrow: string; title: string; text: string; href: string };
|
||||
let {
|
||||
image,
|
||||
headline,
|
||||
intro,
|
||||
org,
|
||||
highlight
|
||||
}: { image: MediaItem | null; headline: string; intro: string; org: string; highlight: Highlight | null } = $props();
|
||||
</script>
|
||||
|
||||
<!-- Vorlage „Kacheln“: kompakter Kopfbereich mit Suche, Bild daneben -->
|
||||
<div class="space-y-3">
|
||||
<section class="rounded-3xl bg-brand text-on-brand p-6 sm:p-8 lg:p-10 grid gap-6 lg:gap-10 {image ? 'lg:grid-cols-[1.3fr_1fr] items-center' : ''}">
|
||||
<div class="space-y-3 min-w-0">
|
||||
<p class="eyebrow !text-on-brand/80">{org}</p>
|
||||
<h1 class="font-bold text-3xl sm:text-4xl leading-tight">{headline}</h1>
|
||||
{#if intro}<p class="text-on-brand/85 max-w-xl">{intro}</p>{/if}
|
||||
<form action="/suche" role="search" class="pt-2 max-w-xl">
|
||||
<label class="flex items-center gap-2 rounded-pill bg-surface text-ink pl-4 pr-1.5 h-13 focus-within:ring-4 focus-within:ring-white/40 transition">
|
||||
<Search class="size-5 text-ink-3 shrink-0" />
|
||||
<span class="sr-only">Suchen</span>
|
||||
<input name="q" type="search" placeholder="Was suchst du?" class="flex-1 min-w-0 bg-transparent outline-none h-full placeholder:text-ink-3" />
|
||||
<button class="btn btn-primary btn-sm">Suchen</button>
|
||||
</label>
|
||||
</form>
|
||||
</div>
|
||||
{#if image}
|
||||
<img src={image.url} alt={image.alt} class="hidden sm:block w-full aspect-[4/3] object-cover rounded-2xl" fetchpriority="high" />
|
||||
{/if}
|
||||
</section>
|
||||
{#if highlight}
|
||||
<a href={highlight.href} class="group flex items-center gap-4 rounded-2xl bg-accent-soft text-accent-ink p-4">
|
||||
<span class="grid place-items-center size-11 rounded-xl bg-accent text-white shrink-0" aria-hidden="true"><Megaphone class="size-5" /></span>
|
||||
<span class="flex-1 min-w-0">
|
||||
<span class="block text-xs font-bold uppercase tracking-widest">{highlight.eyebrow}</span>
|
||||
<span class="block font-bold text-ink">{highlight.title}</span>
|
||||
</span>
|
||||
<ArrowRight class="size-5 shrink-0 transition-transform group-hover:translate-x-0.5" />
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
40
src/lib/components/HeroKlar.svelte
Normal file
40
src/lib/components/HeroKlar.svelte
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<script lang="ts">
|
||||
import ImageIcon from '@lucide/svelte/icons/image';
|
||||
import ArrowRight from '@lucide/svelte/icons/arrow-right';
|
||||
import type { MediaItem } from '$lib/types';
|
||||
|
||||
type Highlight = { eyebrow: string; title: string; text: string; href: string };
|
||||
let { image, headline, org, highlight }: { image: MediaItem | null; headline: string; org: string; highlight: Highlight | null } = $props();
|
||||
</script>
|
||||
|
||||
<!-- Vorlage „Klar“: Foto mit Überschrift unten links -->
|
||||
{#if image}
|
||||
<section class="relative -mx-4 -mt-6 lg:mx-0 lg:mt-0 lg:rounded-3xl overflow-hidden bg-ink">
|
||||
<img src={image.url} alt={image.alt} class="absolute inset-0 size-full object-cover object-[50%_35%]" fetchpriority="high" />
|
||||
<div aria-hidden="true" class="absolute inset-0 bg-gradient-to-t from-black/75 via-black/25 to-transparent"></div>
|
||||
<div class="relative min-h-[24rem] sm:min-h-[28rem] lg:min-h-[32rem] flex flex-col justify-end gap-4 p-5 sm:p-8 lg:p-12 text-white">
|
||||
<p class="eyebrow !text-white/85">{org}</p>
|
||||
<h1 class="font-bold text-[2.2rem] sm:text-5xl leading-[1.1] max-w-3xl">{headline}</h1>
|
||||
{#if highlight}
|
||||
<a href={highlight.href} class="group inline-flex flex-wrap items-center gap-x-3 gap-y-1 self-start rounded-pill bg-white text-ink pl-4 pr-3 py-2 max-w-full">
|
||||
<span class="text-xs font-bold uppercase tracking-widest text-accent-ink">{highlight.eyebrow}</span>
|
||||
<span class="font-semibold truncate max-w-[60vw] sm:max-w-md">{highlight.title}</span>
|
||||
<ArrowRight class="size-4 shrink-0 transition-transform group-hover:translate-x-0.5" />
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{:else}
|
||||
<section class="rounded-3xl bg-surface-2 p-6 sm:p-10 lg:p-12 space-y-4">
|
||||
<p data-nicht-vorlesen class="inline-flex items-center gap-2 text-xs font-semibold text-ink-3"><ImageIcon class="size-4" /> Platzhalter für das Titelbild</p>
|
||||
<p class="eyebrow">{org}</p>
|
||||
<h1 class="font-bold text-[2.2rem] sm:text-5xl leading-[1.1] text-brand-ink max-w-3xl">{headline}</h1>
|
||||
{#if highlight}
|
||||
<a href={highlight.href} class="group inline-flex flex-wrap items-center gap-x-3 gap-y-1 rounded-pill bg-surface border border-line pl-4 pr-3 py-2 max-w-full">
|
||||
<span class="text-xs font-bold uppercase tracking-widest text-accent-ink">{highlight.eyebrow}</span>
|
||||
<span class="font-semibold">{highlight.title}</span>
|
||||
<ArrowRight class="size-4 shrink-0 transition-transform group-hover:translate-x-0.5" />
|
||||
</a>
|
||||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
|
|
@ -11,14 +11,14 @@
|
|||
}: { image: MediaItem | null; headline: string; tagline: string; highlight: Highlight | null } = $props();
|
||||
</script>
|
||||
|
||||
<section class="relative -mx-4 -mt-6 lg:mx-0 lg:mt-0 lg:rounded-[1.75rem] overflow-hidden bg-brand">
|
||||
<section class="relative -mx-4 -mt-6 lg:mx-0 lg:mt-0 lg:rounded-3xl overflow-hidden bg-brand">
|
||||
<div class="relative h-[31rem] sm:h-[34rem] lg:h-[38rem]">
|
||||
{#if image}
|
||||
<img src={image.url} alt={image.alt} class="absolute inset-0 size-full object-cover object-[50%_30%]" fetchpriority="high" />
|
||||
{:else}
|
||||
<!-- Platzhalter, bis in den Einstellungen ein Titelbild gewählt ist -->
|
||||
<div class="absolute inset-0 bg-[linear-gradient(135deg,var(--brand)_0%,color-mix(in_oklab,var(--brand)_60%,var(--accent))_100%)]">
|
||||
<p data-nicht-vorlesen class="absolute left-5 top-5 lg:left-8 lg:top-7 inline-flex items-center gap-2 rounded-full bg-white/10 px-3 py-1.5 text-xs font-semibold text-white/75">
|
||||
<p data-nicht-vorlesen class="absolute left-5 top-5 lg:left-8 lg:top-7 inline-flex items-center gap-2 rounded-pill bg-white/10 px-3 py-1.5 text-xs font-semibold text-white/75">
|
||||
<ImageIcon class="size-4" /> Platzhalter für das Titelbild
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
{#if highlight}
|
||||
<a
|
||||
href={highlight.href}
|
||||
class="absolute right-0 top-16 lg:top-8 max-w-[80%] sm:max-w-md rounded-l-[2rem] bg-surface-2/95 backdrop-blur-sm pl-6 pr-5 lg:pr-8 py-3 sm:py-4 text-right shadow-float hover:bg-surface transition-colors"
|
||||
class="absolute right-0 top-16 lg:top-8 max-w-[80%] sm:max-w-md rounded-l-3xl bg-surface-2/95 backdrop-blur-sm pl-6 pr-5 lg:pr-8 py-3 sm:py-4 text-right shadow-float hover:bg-surface transition-colors"
|
||||
>
|
||||
<span class="eyebrow block">{highlight.eyebrow}</span>
|
||||
<span class="block font-bold sm:text-lg text-brand-ink leading-snug mt-1 line-clamp-2">{highlight.title}</span>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<div
|
||||
role="region"
|
||||
aria-label="Vorlesen"
|
||||
class="fixed inset-x-3 bottom-[5.5rem] lg:bottom-6 z-40 mx-auto max-w-md rounded-full bg-brand text-on-brand shadow-float pl-5 pr-2 py-2 flex items-center gap-1"
|
||||
class="fixed inset-x-3 bottom-[5.5rem] lg:bottom-6 z-40 mx-auto max-w-md rounded-pill bg-brand text-on-brand shadow-float pl-5 pr-2 py-2 flex items-center gap-1"
|
||||
data-nicht-vorlesen
|
||||
>
|
||||
<p class="flex-1 min-w-0 text-sm font-semibold leading-tight" aria-live="polite">
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
</script>
|
||||
|
||||
{#if available}
|
||||
<div class="bg-accent-soft text-accent-ink rounded-[1.5rem] pl-4 pr-5 py-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm font-semibold">
|
||||
<div class="bg-accent-soft text-accent-ink rounded-3xl pl-4 pr-5 py-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm font-semibold">
|
||||
{#if mode === 'auto' || mode === 'pending'}<Sparkles class="size-5 shrink-0" aria-hidden="true" />{:else}<BookHeart class="size-5 shrink-0" aria-hidden="true" />{/if}
|
||||
<span class="flex-1 min-w-48">
|
||||
{#if mode === 'manual'}
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
{/if}
|
||||
|
||||
{#if mode === 'pending' && status === 'loading'}
|
||||
<div class="rounded-[1.5rem] border-2 border-dashed border-accent/40 p-5" aria-busy="true">
|
||||
<div class="rounded-3xl border-2 border-dashed border-accent/40 p-5" aria-busy="true">
|
||||
<p class="flex items-center gap-2 text-sm font-semibold text-accent-ink"><LoaderCircle class="size-4 animate-spin" aria-hidden="true" />Bitte kurz warten.</p>
|
||||
{#if liveText}<p class="mt-3 text-[1.15rem] leading-relaxed whitespace-pre-line">{liveText}</p>{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,29 +1,62 @@
|
|||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import ChevronRight from '@lucide/svelte/icons/chevron-right';
|
||||
import ArrowUpRight from '@lucide/svelte/icons/arrow-up-right';
|
||||
import Icon from './Icon.svelte';
|
||||
import type { Preset } from '$lib/theme';
|
||||
|
||||
/** Bereichs-Link: ruhige Pille mit Symbol – führt zu einer Seite, einem Bereich oder einer Website. */
|
||||
/**
|
||||
* Bereichs-Link – Aussehen je nach Design-Vorlage:
|
||||
* Kreis = ruhige Pille, Klar = schlichte Karte, Kacheln = quadratische Kachel.
|
||||
*/
|
||||
let { href, label, icon, sub = '' }: { href: string; label: string; icon: string; sub?: string } = $props();
|
||||
const external = $derived(/^https?:\/\//.test(href));
|
||||
const preset = $derived((page.data.brand?.theme?.preset ?? 'kreis') as Preset);
|
||||
</script>
|
||||
|
||||
<a
|
||||
{href}
|
||||
target={external ? '_blank' : undefined}
|
||||
rel={external ? 'noopener' : undefined}
|
||||
class="group flex items-center gap-4 rounded-full bg-surface-2 hover:bg-brand-soft pl-1.5 pr-4 py-1.5 min-h-14 transition-colors"
|
||||
>
|
||||
<span class="grid place-items-center size-11 rounded-full bg-surface text-brand-ink shrink-0 transition-colors group-hover:bg-brand group-hover:text-on-brand">
|
||||
<Icon name={icon} class="size-5" strokeWidth={2.1} />
|
||||
</span>
|
||||
<span class="flex-1 min-w-0 py-1">
|
||||
<span class="block font-bold text-brand-ink leading-snug hyphens-auto" lang="de">{label}</span>
|
||||
{#if sub}<span class="block text-sm text-ink-2 leading-snug mt-0.5 line-clamp-2">{sub}</span>{/if}
|
||||
</span>
|
||||
{#if external}
|
||||
<ArrowUpRight class="size-5 text-ink-3 shrink-0" />
|
||||
{:else}
|
||||
<ChevronRight class="size-5 text-ink-3 shrink-0 transition-transform group-hover:translate-x-0.5" />
|
||||
{/if}
|
||||
</a>
|
||||
{#if preset === 'kacheln'}
|
||||
<a
|
||||
{href}
|
||||
target={external ? '_blank' : undefined}
|
||||
rel={external ? 'noopener' : undefined}
|
||||
class="group flex flex-col items-center justify-center gap-3 text-center rounded-3xl bg-surface-2 hover:bg-brand-soft p-4 aspect-square sm:aspect-[5/4] transition-colors"
|
||||
>
|
||||
<span class="grid place-items-center size-14 rounded-2xl bg-brand text-on-brand transition-transform group-hover:scale-105">
|
||||
<Icon name={icon} class="size-7" strokeWidth={2} />
|
||||
</span>
|
||||
<span class="font-bold text-brand-ink leading-tight hyphens-auto" lang="de">{label}</span>
|
||||
{#if external}<span class="sr-only">(öffnet eine andere Website)</span>{/if}
|
||||
</a>
|
||||
{:else if preset === 'klar'}
|
||||
<a
|
||||
{href}
|
||||
target={external ? '_blank' : undefined}
|
||||
rel={external ? 'noopener' : undefined}
|
||||
class="group flex items-center gap-4 rounded-2xl border border-line bg-surface hover:border-brand/40 hover:shadow-card px-4 py-3.5 min-h-16 transition"
|
||||
>
|
||||
<span class="grid place-items-center size-11 rounded-xl bg-brand-soft text-brand-ink shrink-0">
|
||||
<Icon name={icon} class="size-5" strokeWidth={2.1} />
|
||||
</span>
|
||||
<span class="flex-1 min-w-0">
|
||||
<span class="block font-bold text-brand-ink leading-snug hyphens-auto" lang="de">{label}</span>
|
||||
{#if sub}<span class="block text-sm text-ink-2 leading-snug mt-0.5 line-clamp-2">{sub}</span>{/if}
|
||||
</span>
|
||||
{#if external}<ArrowUpRight class="size-5 text-ink-3 shrink-0" aria-label="öffnet eine andere Website" />{:else}<ChevronRight class="size-5 text-ink-3 shrink-0 transition-transform group-hover:translate-x-0.5" />{/if}
|
||||
</a>
|
||||
{:else}
|
||||
<a
|
||||
{href}
|
||||
target={external ? '_blank' : undefined}
|
||||
rel={external ? 'noopener' : undefined}
|
||||
class="group flex items-center gap-4 rounded-pill bg-surface-2 hover:bg-brand-soft pl-1.5 pr-4 py-1.5 min-h-14 transition-colors"
|
||||
>
|
||||
<span class="grid place-items-center size-11 rounded-full bg-surface text-brand-ink shrink-0 transition-colors group-hover:bg-brand group-hover:text-on-brand">
|
||||
<Icon name={icon} class="size-5" strokeWidth={2.1} />
|
||||
</span>
|
||||
<span class="flex-1 min-w-0 py-1">
|
||||
<span class="block font-bold text-brand-ink leading-snug hyphens-auto" lang="de">{label}</span>
|
||||
{#if sub}<span class="block text-sm text-ink-2 leading-snug mt-0.5 line-clamp-2">{sub}</span>{/if}
|
||||
</span>
|
||||
{#if external}<ArrowUpRight class="size-5 text-ink-3 shrink-0" aria-label="öffnet eine andere Website" />{:else}<ChevronRight class="size-5 text-ink-3 shrink-0 transition-transform group-hover:translate-x-0.5" />{/if}
|
||||
</a>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { db } from './db';
|
||||
import { settings } from './db/schema';
|
||||
import { DEFAULT_SETTINGS, type AppSettings } from '$lib/settings';
|
||||
import { cleanTheme } from '$lib/theme';
|
||||
import { darkenForContrast } from '$lib/color';
|
||||
|
||||
const KEY = 'app';
|
||||
let cache: AppSettings | null = null;
|
||||
|
|
@ -15,7 +17,8 @@ export function getSettings(): AppSettings {
|
|||
...stored,
|
||||
legal: { ...DEFAULT_SETTINGS.legal, ...(stored.legal ?? {}) },
|
||||
a11y: { ...DEFAULT_SETTINGS.a11y, ...(stored.a11y ?? {}) },
|
||||
apps: { ...DEFAULT_SETTINGS.apps, ...(stored.apps ?? {}) }
|
||||
apps: { ...DEFAULT_SETTINGS.apps, ...(stored.apps ?? {}) },
|
||||
theme: cleanTheme(stored.theme)
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
|
|
@ -29,3 +32,24 @@ export function saveSettings(patch: Partial<AppSettings>) {
|
|||
cache = next;
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Beim allerersten Start Name und Farben aus der Umgebung übernehmen (APP_NAME,
|
||||
* ORG_NAME, BRAND_COLOR, ACCENT_COLOR) – praktisch für eine neue Einrichtung je Kunde.
|
||||
* Danach gilt nur noch, was in den Einstellungen steht.
|
||||
*/
|
||||
export function applyInitialSettings() {
|
||||
if (db.select().from(settings).all().some((r) => r.key === KEY)) return;
|
||||
const env = process.env;
|
||||
// zu helle Farben werden so weit abgedunkelt, dass weiße Schrift darauf lesbar bleibt
|
||||
const hex = (v?: string) => (v && /^#[0-9a-f]{6}$/i.test(v) ? darkenForContrast(v.toLowerCase()) : undefined);
|
||||
const patch: Partial<AppSettings> = {};
|
||||
if (env.APP_NAME) patch.appName = env.APP_NAME.slice(0, 40);
|
||||
if (env.ORG_NAME) patch.orgName = env.ORG_NAME.slice(0, 120);
|
||||
if (hex(env.BRAND_COLOR)) patch.brandColor = hex(env.BRAND_COLOR);
|
||||
if (hex(env.ACCENT_COLOR)) patch.accentColor = hex(env.ACCENT_COLOR);
|
||||
if (Object.keys(patch).length) {
|
||||
saveSettings(patch);
|
||||
console.log('[setup] Startwerte aus der Umgebung übernommen.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
108
src/lib/server/setup.ts
Normal file
108
src/lib/server/setup.ts
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import { sql } from 'drizzle-orm';
|
||||
import { db } from './db';
|
||||
import { posts, tiles } from './db/schema';
|
||||
import { getSettings } from './settings';
|
||||
import { mailConfigured } from './mail';
|
||||
import { DEFAULT_SETTINGS } from '$lib/settings';
|
||||
import { DEFAULT_THEME } from '$lib/theme';
|
||||
|
||||
/**
|
||||
* Checkliste „Erste Schritte“ für eine neue Einrichtung. Jeder Punkt wird aus dem
|
||||
* aktuellen Stand abgeleitet – erledigt ist, was tatsächlich eingetragen ist.
|
||||
*/
|
||||
|
||||
export type SetupStep = { key: string; label: string; hint: string; href: string; done: boolean; optional?: boolean };
|
||||
|
||||
const count = (table: typeof posts | typeof tiles) => db.select({ n: sql<number>`count(*)` }).from(table).get()?.n ?? 0;
|
||||
|
||||
export function setupSteps(user: { totpEnabled: boolean }): SetupStep[] {
|
||||
const s = getSettings();
|
||||
const d = DEFAULT_SETTINGS;
|
||||
const origin = process.env.ORIGIN ?? '';
|
||||
const t = s.theme;
|
||||
const designChanged =
|
||||
s.brandColor !== d.brandColor || s.accentColor !== d.accentColor ||
|
||||
t.preset !== DEFAULT_THEME.preset || t.font !== DEFAULT_THEME.font || t.radius !== DEFAULT_THEME.radius;
|
||||
|
||||
return [
|
||||
{
|
||||
key: 'name',
|
||||
label: 'Name und Logo eintragen',
|
||||
hint: 'Name der App, der Einrichtung und das Logo (wird auch zum App-Symbol).',
|
||||
href: '/admin/einstellungen',
|
||||
done: s.orgName !== d.orgName && s.appName !== d.appName && !!s.logoId
|
||||
},
|
||||
{
|
||||
key: 'design',
|
||||
label: 'Erscheinungsbild wählen',
|
||||
hint: 'Vorlage und Hausfarben – passend zur eigenen Website.',
|
||||
href: '/admin/einstellungen#erscheinungsbild',
|
||||
done: designChanged
|
||||
},
|
||||
{
|
||||
key: 'legal',
|
||||
label: 'Anbieterangaben ausfüllen',
|
||||
hint: 'Name, Anschrift und E-Mail des Trägers für Impressum und Datenschutz.',
|
||||
href: '/admin/einstellungen#rechtliches',
|
||||
done: !!(s.legal.name && s.legal.street && s.legal.city && s.legal.email)
|
||||
},
|
||||
{
|
||||
key: 'texts',
|
||||
label: 'Impressum und Datenschutz erzeugen',
|
||||
hint: 'Mit „Impressum & Datenschutz aus Vorlage erzeugen“ vorbereiten und danach prüfen.',
|
||||
href: '/admin/einstellungen#rechtliches',
|
||||
done: s.imprint !== d.imprint && s.privacy !== d.privacy
|
||||
},
|
||||
{
|
||||
key: 'contact',
|
||||
label: 'Kontakt-E-Mail hinterlegen',
|
||||
hint: 'Hierhin gehen Nachrichten aus dem Kontaktformular.',
|
||||
href: '/admin/einstellungen#kontakt',
|
||||
done: !!s.contactEmail
|
||||
},
|
||||
{
|
||||
key: 'tiles',
|
||||
label: 'Bereiche auf der Startseite anlegen',
|
||||
hint: 'Die Kacheln, über die Leser zu den wichtigsten Seiten kommen.',
|
||||
href: '/admin/kacheln',
|
||||
done: count(tiles) > 0
|
||||
},
|
||||
{
|
||||
key: 'post',
|
||||
label: 'Erste Meldung veröffentlichen',
|
||||
hint: 'Zum Beispiel: „Unsere neue App ist da“.',
|
||||
href: '/admin/meldungen/neu',
|
||||
done: count(posts) > 0
|
||||
},
|
||||
{
|
||||
key: '2fa',
|
||||
label: 'Zwei-Faktor-Anmeldung einrichten',
|
||||
hint: 'Schützt den Redaktionszugang zusätzlich mit einer Authenticator-App.',
|
||||
href: '/admin/konto',
|
||||
done: user.totpEnabled
|
||||
},
|
||||
{
|
||||
key: 'server',
|
||||
label: 'Server fertig einrichten',
|
||||
hint: 'ORIGIN mit https:// und SMTP für „Passwort vergessen“ in der .env setzen (Technik).',
|
||||
href: '/admin/einstellungen',
|
||||
done: origin.startsWith('https://') && mailConfigured()
|
||||
},
|
||||
{
|
||||
key: 'ai',
|
||||
label: 'Leichte Sprache per KI',
|
||||
hint: 'Anbieter wählen und Schlüssel eintragen.',
|
||||
href: '/admin/einstellungen#ki',
|
||||
done: s.aiEnabled,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
key: 'apps',
|
||||
label: 'Apps für iPhone und Android',
|
||||
hint: 'App-ID und Store-Links eintragen, sobald die Apps veröffentlicht sind.',
|
||||
href: '/admin/einstellungen#apps',
|
||||
done: !!(s.apps.appStoreUrl || s.apps.playStoreUrl),
|
||||
optional: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
/** KI-Anbieter für die automatische Leichte Sprache */
|
||||
import { DEFAULT_THEME, type Theme } from './theme';
|
||||
|
||||
/** region: wo der Anbieter sitzt – für die Datenschutz-Vorlage (eu, us, cn, eigener Server) */
|
||||
export const AI_PROVIDERS = {
|
||||
anthropic: { label: 'Anthropic (Claude)', defaultModel: 'claude-opus-5', defaultBaseUrl: '', needsKey: true, region: 'us' },
|
||||
|
|
@ -55,6 +57,8 @@ export type AppSettings = {
|
|||
greeting: string;
|
||||
/** Kurzer Text unter der Begrüßung */
|
||||
intro: string;
|
||||
/** Design-Vorlage, Schrift, Rundungen */
|
||||
theme: Theme;
|
||||
/** Markenfarbe (Schrift, Buttons) als Hex-Wert */
|
||||
brandColor: string;
|
||||
/** Akzentfarbe (Kreis auf der Startseite, Hervorhebungen) */
|
||||
|
|
@ -73,7 +77,6 @@ export type AppSettings = {
|
|||
legal: LegalInfo;
|
||||
apps: AppsInfo;
|
||||
a11y: A11yInfo;
|
||||
/** Wie viele Meldungen/Termine die Startseite zeigt */
|
||||
/** Administratoren müssen die Zwei-Faktor-Anmeldung einrichten */
|
||||
require2faAdmins: boolean;
|
||||
/** Leichte Sprache per KI eingeschaltet */
|
||||
|
|
@ -88,8 +91,11 @@ export type AppSettings = {
|
|||
aiDailyLimit: number;
|
||||
/** Anrede in den Texten in Leichter Sprache */
|
||||
easyAddress: 'du' | 'Sie';
|
||||
/** Wie viele Meldungen/Termine die Startseite zeigt */
|
||||
homeNewsCount: number;
|
||||
homeEventsCount: number;
|
||||
/** Checkliste „Erste Schritte“ im Dashboard ausgeblendet */
|
||||
setupHidden: boolean;
|
||||
};
|
||||
|
||||
export const DEFAULT_SETTINGS: AppSettings = {
|
||||
|
|
@ -97,6 +103,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
|||
orgName: 'Unsere Werkstätten',
|
||||
greeting: 'Willkommen in deiner Werkstatt!',
|
||||
intro: 'Hier findest du Neuigkeiten, Termine und alles Wichtige rund um deine Werkstatt.',
|
||||
theme: DEFAULT_THEME,
|
||||
brandColor: '#2e2672',
|
||||
accentColor: '#85357c',
|
||||
logoId: null,
|
||||
|
|
@ -131,6 +138,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
|||
enforcement: ''
|
||||
},
|
||||
require2faAdmins: false,
|
||||
setupHidden: false,
|
||||
aiEnabled: false,
|
||||
aiMode: 'review',
|
||||
aiProvider: 'anthropic',
|
||||
|
|
|
|||
61
src/lib/theme.ts
Normal file
61
src/lib/theme.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* Erscheinungsbild: fertige Design-Vorlagen plus Feinschliff (Schrift, Rundungen).
|
||||
* Farben kommen aus brandColor/accentColor. Alles wird als CSS-Variable bzw.
|
||||
* data-Attribut an <html> gesetzt (siehe src/routes/+layout.svelte).
|
||||
*/
|
||||
|
||||
export const PRESETS = {
|
||||
kreis: {
|
||||
label: 'Kreis',
|
||||
description: 'Großes Titelbild mit Akzentkreis, Bereiche als Pillen, Termine als Farbfläche.',
|
||||
font: 'montserrat',
|
||||
radius: 'rund'
|
||||
},
|
||||
klar: {
|
||||
label: 'Klar',
|
||||
description: 'Ruhig und sachlich: Foto mit Überschrift, Bereiche als schlichte Karten.',
|
||||
font: 'source',
|
||||
radius: 'eckig'
|
||||
},
|
||||
kacheln: {
|
||||
label: 'Kacheln',
|
||||
description: 'Freundlich und übersichtlich: kompakter Kopfbereich, Bereiche als Kachelraster.',
|
||||
font: 'atkinson',
|
||||
radius: 'sehr-rund'
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const FONTS = {
|
||||
montserrat: { label: 'Montserrat', family: "'Montserrat Variable'", body: 500, hint: 'geometrisch, markant' },
|
||||
atkinson: { label: 'Atkinson Hyperlegible', family: "'Atkinson Hyperlegible Next Variable'", body: 400, hint: 'für Menschen mit Sehschwäche entwickelt – am besten lesbar' },
|
||||
lexend: { label: 'Lexend', family: "'Lexend Variable'", body: 400, hint: 'entwickelt, um Lesen leichter zu machen' },
|
||||
source: { label: 'Source Sans', family: "'Source Sans 3 Variable'", body: 400, hint: 'neutral, sehr gut lesbar' }
|
||||
} as const;
|
||||
|
||||
export const RADII = {
|
||||
eckig: { label: 'Eckig' },
|
||||
rund: { label: 'Rund' },
|
||||
'sehr-rund': { label: 'Sehr rund' }
|
||||
} as const;
|
||||
|
||||
export type Preset = keyof typeof PRESETS;
|
||||
export type FontKey = keyof typeof FONTS;
|
||||
export type RadiusKey = keyof typeof RADII;
|
||||
export type Theme = { preset: Preset; font: FontKey; radius: RadiusKey };
|
||||
|
||||
export const DEFAULT_THEME: Theme = { preset: 'kreis', font: 'montserrat', radius: 'rund' };
|
||||
|
||||
export function cleanTheme(t: Partial<Record<keyof Theme, unknown>> | undefined): Theme {
|
||||
return {
|
||||
preset: typeof t?.preset === 'string' && t.preset in PRESETS ? (t.preset as Preset) : DEFAULT_THEME.preset,
|
||||
font: typeof t?.font === 'string' && t.font in FONTS ? (t.font as FontKey) : DEFAULT_THEME.font,
|
||||
radius: typeof t?.radius === 'string' && t.radius in RADII ? (t.radius as RadiusKey) : DEFAULT_THEME.radius
|
||||
};
|
||||
}
|
||||
|
||||
/** Raster für Bereiche je Vorlage (als feste Zeichenketten, damit Tailwind sie findet) */
|
||||
export const TILE_GRID: Record<Preset, string> = {
|
||||
kreis: 'grid sm:grid-cols-2 lg:grid-cols-3 gap-2.5',
|
||||
klar: 'grid sm:grid-cols-2 lg:grid-cols-3 gap-3',
|
||||
kacheln: 'grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3'
|
||||
};
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
aria-current={isActive(item.href) ? 'page' : undefined}
|
||||
>
|
||||
{item.label}
|
||||
{#if isActive(item.href)}<span class="absolute inset-x-0 -bottom-0.5 h-0.5 rounded-full bg-accent"></span>{/if}
|
||||
{#if isActive(item.href)}<span class="absolute inset-x-0 -bottom-0.5 h-0.5 rounded-pill bg-accent"></span>{/if}
|
||||
</a>
|
||||
{/each}
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@
|
|||
import Search from '@lucide/svelte/icons/search';
|
||||
import CalendarPlus from '@lucide/svelte/icons/calendar-plus';
|
||||
import HomeHero from '$lib/components/HomeHero.svelte';
|
||||
import HeroKlar from '$lib/components/HeroKlar.svelte';
|
||||
import HeroKacheln from '$lib/components/HeroKacheln.svelte';
|
||||
import EventRow from '$lib/components/EventRow.svelte';
|
||||
import { TILE_GRID } from '$lib/theme';
|
||||
import Tile from '$lib/components/Tile.svelte';
|
||||
import PostCard from '$lib/components/PostCard.svelte';
|
||||
import { dayOfMonth, eventWhen, monthAbbr, weekday } from '$lib/dates';
|
||||
|
||||
let { data } = $props();
|
||||
const preset = $derived(data.brand.theme.preset);
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
|
@ -15,20 +20,26 @@
|
|||
</svelte:head>
|
||||
|
||||
<div class="space-y-14 lg:space-y-20">
|
||||
{#if data.heroEnabled}
|
||||
<HomeHero image={data.hero} headline={data.greeting} tagline={data.heroTagline} highlight={data.highlight} />
|
||||
{:else}
|
||||
<!-- Kopfbereich je Design-Vorlage -->
|
||||
{#if preset === 'kacheln'}
|
||||
<HeroKacheln image={data.heroEnabled ? data.hero : null} headline={data.greeting} intro={data.intro} org={data.brand.orgName} highlight={data.highlight} />
|
||||
{:else if !data.heroEnabled}
|
||||
<h1 class="font-bold text-3xl sm:text-4xl text-brand-ink pt-4">{data.greeting}</h1>
|
||||
{:else if preset === 'klar'}
|
||||
<HeroKlar image={data.hero} headline={data.greeting} org={data.brand.orgName} highlight={data.highlight} />
|
||||
{:else}
|
||||
<HomeHero image={data.hero} headline={data.greeting} tagline={data.heroTagline} highlight={data.highlight} />
|
||||
{/if}
|
||||
|
||||
<!-- Einleitung & Suche -->
|
||||
<!-- Einleitung & Suche (bei „Kacheln“ steckt beides im Kopfbereich) -->
|
||||
{#if preset !== 'kacheln'}
|
||||
<section class="grid lg:grid-cols-2 gap-6 lg:gap-16 items-end [&>*]:min-w-0">
|
||||
<div class="space-y-3">
|
||||
<p class="eyebrow eyebrow-rule">{data.brand.orgName}</p>
|
||||
{#if data.intro}<p class="text-lg text-ink-2 max-w-xl">{data.intro}</p>{/if}
|
||||
</div>
|
||||
<form action="/suche" role="search">
|
||||
<label class="flex items-center gap-3 rounded-full bg-surface-2 pl-5 pr-1.5 h-15 focus-within:ring-4 focus-within:ring-brand/15 transition">
|
||||
<label class="flex items-center gap-3 rounded-pill bg-surface-2 pl-5 pr-1.5 h-15 focus-within:ring-4 focus-within:ring-brand/15 transition">
|
||||
<Search class="size-5 text-brand-ink shrink-0" strokeWidth={2.4} />
|
||||
<span class="sr-only">Suchen</span>
|
||||
<input name="q" type="search" placeholder="Was suchst du?" class="flex-1 min-w-0 bg-transparent outline-none h-full font-semibold placeholder:text-ink-3 placeholder:font-medium" />
|
||||
|
|
@ -36,6 +47,7 @@
|
|||
</label>
|
||||
</form>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
<!-- Bereiche -->
|
||||
{#if data.tiles.length}
|
||||
|
|
@ -44,7 +56,7 @@
|
|||
<p class="eyebrow eyebrow-rule">Bereiche</p>
|
||||
<h2 id="bereiche" class="text-2xl sm:text-3xl text-brand-ink">Was möchtest du wissen?</h2>
|
||||
</div>
|
||||
<div class="grid sm:grid-cols-2 lg:grid-cols-3 gap-2.5">
|
||||
<div class={TILE_GRID[preset]}>
|
||||
{#each data.tiles as t (t.id)}
|
||||
<Tile href={t.href} label={t.label} icon={t.icon} />
|
||||
{/each}
|
||||
|
|
@ -72,8 +84,28 @@
|
|||
{/if}
|
||||
</section>
|
||||
|
||||
{#if preset !== 'kreis'}
|
||||
<!-- Termine als Liste -->
|
||||
<section aria-labelledby="termine" class="space-y-5">
|
||||
<div class="flex items-end justify-between gap-4">
|
||||
<div class="space-y-2">
|
||||
<p class="eyebrow eyebrow-rule">Termine</p>
|
||||
<h2 id="termine" class="text-2xl sm:text-3xl text-brand-ink">Was steht an?</h2>
|
||||
</div>
|
||||
<a href="/termine" class="btn btn-soft btn-sm shrink-0">Alle <ArrowRight class="size-4" /></a>
|
||||
</div>
|
||||
{#if data.events.length}
|
||||
<div class="grid lg:grid-cols-2 gap-x-6 divide-y divide-line lg:divide-y-0">
|
||||
{#each data.events as e (e.id)}<EventRow event={e} />{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="text-ink-3">Gerade sind keine Termine geplant.</p>
|
||||
{/if}
|
||||
<a href="/termine.ics" class="btn btn-ghost btn-sm"><CalendarPlus class="size-4" />Kalender abonnieren</a>
|
||||
</section>
|
||||
{:else}
|
||||
<!-- Termine als Farbblock -->
|
||||
<section aria-labelledby="termine" class="relative -mx-4 lg:mx-0 lg:rounded-[1.75rem] overflow-hidden bg-brand text-on-brand">
|
||||
<section aria-labelledby="termine" class="relative -mx-4 lg:mx-0 lg:rounded-3xl overflow-hidden bg-brand text-on-brand">
|
||||
<div aria-hidden="true" class="absolute -right-32 -bottom-40 size-[26rem] rounded-full bg-accent"></div>
|
||||
<div class="relative px-5 py-10 sm:px-8 lg:px-12 lg:py-14 grid lg:grid-cols-[1fr_1.4fr] gap-8 lg:gap-14">
|
||||
<div class="space-y-4">
|
||||
|
|
@ -96,7 +128,7 @@
|
|||
</span>
|
||||
<span class="min-w-0">
|
||||
{#if e.kind === 'closure'}
|
||||
<span class="inline-block rounded-full bg-accent px-2.5 py-0.5 text-[0.7rem] font-bold uppercase tracking-wider mb-1">Geschlossen</span>
|
||||
<span class="inline-block rounded-pill bg-accent px-2.5 py-0.5 text-[0.7rem] font-bold uppercase tracking-wider mb-1">Geschlossen</span>
|
||||
{/if}
|
||||
<span class="block font-bold text-lg leading-snug">{e.title}</span>
|
||||
<span class="block text-sm text-on-brand/75">{eventWhen(e)}{e.location ? ` · ${e.location}` : ''}</span>
|
||||
|
|
@ -109,4 +141,5 @@
|
|||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<div class="mt-6">
|
||||
{#if form?.sent}
|
||||
<div class="rounded-[1.5rem] bg-surface-2 p-6 flex items-start gap-4" role="status">
|
||||
<div class="rounded-3xl bg-surface-2 p-6 flex items-start gap-4" role="status">
|
||||
<CircleCheck class="size-7 text-brand-ink shrink-0" />
|
||||
<div>
|
||||
<p class="font-bold text-lg">Danke für deine Meldung!</p>
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
{:else}
|
||||
<form
|
||||
method="POST"
|
||||
class="rounded-[1.5rem] bg-surface-2 p-5 sm:p-6 space-y-4"
|
||||
class="rounded-3xl bg-surface-2 p-5 sm:p-6 space-y-4"
|
||||
use:enhance={() => {
|
||||
sending = true;
|
||||
return async ({ update }) => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import Tile from '$lib/components/Tile.svelte';
|
||||
import { TILE_GRID } from '$lib/theme';
|
||||
import ArticleActions from '$lib/components/ArticleActions.svelte';
|
||||
import RichContent from '$lib/components/RichContent.svelte';
|
||||
import Attachments from '$lib/components/Attachments.svelte';
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
{#if p.children.length}
|
||||
<section class="space-y-3">
|
||||
{#if hasText}<h2 class="eyebrow">Bitte wähle aus</h2>{/if}
|
||||
<div class="grid sm:grid-cols-2 gap-3">
|
||||
<div class={TILE_GRID[data.brand.theme.preset]}>
|
||||
{#each p.children as c (c.id)}
|
||||
<Tile href="/s/{c.slug}" label={c.title} icon={c.icon} sub={c.teaser} />
|
||||
{/each}
|
||||
|
|
@ -58,7 +59,7 @@
|
|||
{#if p.contacts.length}
|
||||
<section class="space-y-2">
|
||||
<h2 class="eyebrow">Ansprechpartner</h2>
|
||||
<div class="grid sm:grid-cols-2 gap-3">
|
||||
<div class={TILE_GRID[data.brand.theme.preset]}>
|
||||
{#each p.contacts as c (c.id)}<ContactCard contact={c} />{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ export const load = ({ locals }) => {
|
|||
// numerische App-Store-ID für das Smart-App-Banner in Safari
|
||||
appStoreId: s.apps.appStoreUrl.match(/\/id(\d+)/)?.[1] ?? '',
|
||||
appStoreUrl: s.apps.appStoreUrl,
|
||||
playStoreUrl: s.apps.playStoreUrl
|
||||
playStoreUrl: s.apps.playStoreUrl,
|
||||
theme: s.theme
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import '../app.css';
|
||||
import { prefs } from '$lib/prefs.svelte';
|
||||
import { untrack } from 'svelte';
|
||||
import { FONTS } from '$lib/theme';
|
||||
|
||||
let { data, children } = $props();
|
||||
|
||||
|
|
@ -12,7 +13,7 @@
|
|||
<svelte:head>
|
||||
<meta name="theme-color" content={data.brand.color} />
|
||||
{#if data.brand.appStoreId}<meta name="apple-itunes-app" content="app-id={data.brand.appStoreId}" />{/if}
|
||||
{@html `<style>:root{--brand:${data.brand.color};--accent:${data.brand.accent}}</style>`}
|
||||
{@html `<style>html:root{--brand:${data.brand.color};--accent:${data.brand.accent};--app-font:${FONTS[data.brand.theme.font].family};--body-weight:${FONTS[data.brand.theme.font].body}}</style>`}
|
||||
</svelte:head>
|
||||
|
||||
{@render children()}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
<item.icon class="size-[1.15rem]" />
|
||||
<span class="flex-1">{item.label}</span>
|
||||
{#if 'badge' in item && item.badge}
|
||||
<span class="min-w-5 h-5 px-1.5 rounded-full bg-brand text-white text-xs grid place-items-center">{item.badge}</span>
|
||||
<span class="min-w-5 h-5 px-1.5 rounded-pill bg-brand text-white text-xs grid place-items-center">{item.badge}</span>
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -3,11 +3,16 @@ import { db } from '$lib/server/db';
|
|||
import { events, messages, pages, posts, media } from '$lib/server/db/schema';
|
||||
import { upcomingEvents } from '$lib/server/content';
|
||||
import { myTasks } from '$lib/server/editorial';
|
||||
import { setupSteps } from '$lib/server/setup';
|
||||
import { getSettings, saveSettings } from '$lib/server/settings';
|
||||
import { requireAdmin } from '$lib/server/forms';
|
||||
|
||||
const count = (table: typeof posts | typeof pages | typeof events | typeof media) =>
|
||||
db.select({ n: sql<number>`count(*)` }).from(table).get()?.n ?? 0;
|
||||
|
||||
export const load = ({ locals }) => ({
|
||||
// Checkliste nur für Admins, solange sie nicht ausgeblendet wurde
|
||||
setup: locals.user!.role === 'admin' && !getSettings().setupHidden ? setupSteps(locals.user!) : null,
|
||||
tasks: myTasks(locals.user!.id),
|
||||
stats: {
|
||||
posts: count(posts),
|
||||
|
|
@ -24,3 +29,10 @@ export const load = ({ locals }) => ({
|
|||
nextEvents: upcomingEvents({ limit: 5 }),
|
||||
messages: db.select().from(messages).where(eq(messages.read, false)).orderBy(desc(messages.id)).limit(3).all()
|
||||
});
|
||||
|
||||
export const actions = {
|
||||
hideSetup: ({ locals }) => {
|
||||
requireAdmin(locals.user);
|
||||
saveSettings({ setupHidden: true });
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
import ArrowRight from '@lucide/svelte/icons/arrow-right';
|
||||
import Inbox from '@lucide/svelte/icons/inbox';
|
||||
import PageHeader from '$lib/admin/PageHeader.svelte';
|
||||
import SetupChecklist from '$lib/admin/SetupChecklist.svelte';
|
||||
import CalendarRange from '@lucide/svelte/icons/calendar-range';
|
||||
import AlarmClock from '@lucide/svelte/icons/alarm-clock';
|
||||
import { formatShort, relative, eventWhen } from '$lib/dates';
|
||||
|
|
@ -29,6 +30,8 @@
|
|||
{/snippet}
|
||||
</PageHeader>
|
||||
|
||||
{#if data.setup}<SetupChecklist steps={data.setup} />{/if}
|
||||
|
||||
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3 mb-8">
|
||||
{#each stats as s (s.label)}
|
||||
<a href={s.href} class="card pressable p-4">
|
||||
|
|
@ -59,7 +62,7 @@
|
|||
<ul class="divide-y divide-line">
|
||||
{#each data.tasks as t (t.id)}
|
||||
<li class="flex flex-wrap items-center gap-x-3 gap-y-1 py-2.5">
|
||||
<span class="tone-{STATUS_TONE[t.status]} inline-flex items-center gap-1.5 rounded-full bg-tone-soft text-tone-ink px-2.5 py-0.5 text-xs font-bold">
|
||||
<span class="tone-{STATUS_TONE[t.status]} inline-flex items-center gap-1.5 rounded-pill bg-tone-soft text-tone-ink px-2.5 py-0.5 text-xs font-bold">
|
||||
<span class="size-1.5 rounded-full bg-tone" aria-hidden="true"></span>{EDITORIAL_STATUS[t.status]}
|
||||
</span>
|
||||
<a href="/admin/redaktion?monat={(t.date || t.dueDate || '').slice(0, 7)}" class="flex-1 min-w-0 font-semibold truncate hover:text-brand-ink">{t.title}</a>
|
||||
|
|
@ -89,7 +92,7 @@
|
|||
<li>
|
||||
<a href="/admin/meldungen/{p.id}" class="flex items-center gap-3 py-2.5 hover:text-brand-ink">
|
||||
<span class="flex-1 font-semibold truncate">{p.title}</span>
|
||||
{#if !p.published}<span class="text-xs font-bold px-2 py-0.5 rounded-full bg-surface-2 text-ink-3">Entwurf</span>{/if}
|
||||
{#if !p.published}<span class="text-xs font-bold px-2 py-0.5 rounded-pill bg-surface-2 text-ink-3">Entwurf</span>{/if}
|
||||
<span class="text-sm text-ink-3 shrink-0">{relative(p.publishedAt.toISOString())}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
{#if c.email}<Mail class="size-4" />{/if}
|
||||
{#if c.phone}<Phone class="size-4" />{/if}
|
||||
</span>
|
||||
{#if !c.listed}<span class="text-xs font-bold px-2.5 py-1 rounded-full bg-surface-2 text-ink-3 inline-flex items-center gap-1"><EyeOff class="size-3" />Nicht im Verzeichnis</span>{/if}
|
||||
{#if !c.listed}<span class="text-xs font-bold px-2.5 py-1 rounded-pill bg-surface-2 text-ink-3 inline-flex items-center gap-1"><EyeOff class="size-3" />Nicht im Verzeichnis</span>{/if}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
<legend class="label">An wen?</legend>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{#each [...pushTopicKeys, 'all'] as t (t)}
|
||||
<label class="inline-flex items-center gap-2 rounded-full border-2 border-line px-3 py-1.5 text-sm font-semibold cursor-pointer has-[:checked]:border-brand has-[:checked]:bg-brand-soft">
|
||||
<label class="inline-flex items-center gap-2 rounded-pill border-2 border-line px-3 py-1.5 text-sm font-semibold cursor-pointer has-[:checked]:border-brand has-[:checked]:bg-brand-soft">
|
||||
<input type="radio" name="topic" value={t} checked={t === 'news'} class="accent-[var(--brand)]" />
|
||||
{topicLabel(t)}
|
||||
<span class="text-ink-3 font-medium">({t === 'all' ? data.counts.total : data.counts.byTopic[t as keyof typeof data.counts.byTopic]})</span>
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
<span class="hidden sm:inline-flex items-center gap-1 text-xs font-bold text-ink-2" title="Zwei-Faktor-Anmeldung aktiv"><Smartphone class="size-3.5" aria-hidden="true" />2FA<span class="sr-only"> aktiv</span></span>
|
||||
{/if}
|
||||
{#if u.role === 'admin'}
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-full bg-brand-soft text-brand-ink inline-flex items-center gap-1"><ShieldCheck class="size-3.5" />Admin</span>
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-pill bg-brand-soft text-brand-ink inline-flex items-center gap-1"><ShieldCheck class="size-3.5" />Admin</span>
|
||||
{:else}
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-full bg-surface-2 text-ink-3">Redakteur</span>
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-pill bg-surface-2 text-ink-3">Redakteur</span>
|
||||
{/if}
|
||||
<Pencil class="size-4 text-ink-3" />
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import { aiReady, keyHint, saveKey } from '$lib/server/ai';
|
|||
import { dailyUsage } from '$lib/server/easy-auto';
|
||||
import { FcmConfigError, saveServiceAccount, serviceAccountInfo } from '$lib/server/fcm';
|
||||
import { AI_PROVIDERS, type AiProvider } from '$lib/settings';
|
||||
import { cleanTheme } from '$lib/theme';
|
||||
import { checkBrandColors, darkenForContrast } from '$lib/color';
|
||||
|
||||
export const load = ({ locals }) => {
|
||||
requireAdmin(locals.user);
|
||||
|
|
@ -24,6 +26,11 @@ function read(form: FormData): Partial<AppSettings> | string {
|
|||
const accentColor = f.str('accentColor', 7);
|
||||
if (!appName) return 'Die App braucht einen Namen.';
|
||||
if (![brandColor, accentColor].every((c) => /^#[0-9a-f]{6}$/i.test(c))) return 'Eine der Farben ist ungültig.';
|
||||
// Weiße Schrift auf den Markenfarben muss lesbar bleiben (WCAG AA)
|
||||
for (const which of checkBrandColors(brandColor, accentColor)) {
|
||||
const c = which === 'brand' ? brandColor : accentColor;
|
||||
return `Die ${which === 'brand' ? 'Hauptfarbe' : 'Akzentfarbe'} ${c} ist zu hell – weiße Schrift darauf ist schlecht lesbar. Vorschlag: ${darkenForContrast(c)}.`;
|
||||
}
|
||||
const website = f.str('website', 300);
|
||||
if (website && !/^https?:\/\//.test(website)) return 'Die Website muss mit https:// beginnen.';
|
||||
const a11yStatus = f.str('a11yStatus');
|
||||
|
|
@ -36,6 +43,7 @@ function read(form: FormData): Partial<AppSettings> | string {
|
|||
intro: f.str('intro', 400),
|
||||
brandColor,
|
||||
accentColor,
|
||||
theme: cleanTheme({ preset: f.str('themePreset'), font: f.str('themeFont'), radius: f.str('themeRadius') }),
|
||||
logoId: f.int('logoId'),
|
||||
heroEnabled: f.bool('heroEnabled'),
|
||||
heroImageId: f.int('heroImageId'),
|
||||
|
|
@ -46,6 +54,7 @@ function read(form: FormData): Partial<AppSettings> | string {
|
|||
imprint: cleanHtml(f.html('imprint')),
|
||||
privacy: cleanHtml(f.html('privacy')),
|
||||
require2faAdmins: f.bool('require2faAdmins'),
|
||||
setupHidden: !f.bool('setupShown'),
|
||||
easyAddress: f.str('easyAddress') === 'Sie' ? 'Sie' : 'du',
|
||||
aiEnabled: f.bool('aiEnabled'),
|
||||
aiMode: f.str('aiMode') === 'auto' ? 'auto' : 'review',
|
||||
|
|
|
|||
|
|
@ -7,28 +7,13 @@
|
|||
import Switch from '$lib/admin/Switch.svelte';
|
||||
import AiSettings from '$lib/admin/AiSettings.svelte';
|
||||
import AppsSettings from '$lib/admin/AppsSettings.svelte';
|
||||
import DesignSettings from '$lib/admin/DesignSettings.svelte';
|
||||
|
||||
let { data } = $props();
|
||||
const s = $derived(data.settings);
|
||||
let color = $state('');
|
||||
let accent = $state('');
|
||||
$effect.pre(() => {
|
||||
color = s.brandColor;
|
||||
accent = s.accentColor;
|
||||
});
|
||||
|
||||
// Paare aus Hauptfarbe (Schrift, Buttons) und Akzent (Kreis, Hervorhebungen)
|
||||
const presets = [
|
||||
['#2e2672', '#85357c'],
|
||||
['#0f4c5c', '#e36414'],
|
||||
['#1d3557', '#e63946'],
|
||||
['#264027', '#b5853f'],
|
||||
['#3a2e39', '#1e8a78'],
|
||||
['#12355b', '#d4a017']
|
||||
];
|
||||
</script>
|
||||
|
||||
<PageHeader title="Einstellungen" description="Name, Aussehen und rechtliche Texte der App." />
|
||||
<PageHeader title="Einstellungen" description="Name, Erscheinungsbild und rechtliche Texte der App." />
|
||||
|
||||
<EditForm>
|
||||
<Panel title="App & Einrichtung">
|
||||
|
|
@ -47,6 +32,11 @@
|
|||
<input id="website" name="website" class="field" value={s.website} placeholder="https://…" />
|
||||
</div>
|
||||
</div>
|
||||
<Switch name="setupShown" checked={!s.setupHidden} label="Checkliste „Erste Schritte“ im Dashboard zeigen" hint="Hilft beim Einrichten einer neuen App" />
|
||||
</Panel>
|
||||
|
||||
<Panel id="erscheinungsbild" title="Erscheinungsbild" description="Vorlage, Farben und Schrift – so passt die App zu eurem Haus.">
|
||||
<DesignSettings theme={s.theme} brandColor={s.brandColor} accentColor={s.accentColor} />
|
||||
</Panel>
|
||||
|
||||
<Panel title="Startseite">
|
||||
|
|
@ -83,7 +73,7 @@
|
|||
</div>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Kontaktformular">
|
||||
<Panel id="kontakt" title="Kontaktformular">
|
||||
<div>
|
||||
<label class="label" for="contactIntro">Text über dem Formular</label>
|
||||
<textarea id="contactIntro" name="contactIntro" rows="2" class="field">{s.contactIntro}</textarea>
|
||||
|
|
@ -95,11 +85,11 @@
|
|||
</div>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Leichte Sprache mit KI" description="Überträgt Texte ohne eigene Fassung automatisch für Leser in Leichte Sprache. Eigene Fassungen aus der Redaktion haben immer Vorrang.">
|
||||
<Panel id="ki" title="Leichte Sprache mit KI" description="Überträgt Texte ohne eigene Fassung automatisch für Leser in Leichte Sprache. Eigene Fassungen aus der Redaktion haben immer Vorrang.">
|
||||
<AiSettings {s} ai={data.ai} />
|
||||
</Panel>
|
||||
|
||||
<Panel title="Apps (iOS und Android)" description="Für Push-Nachrichten an die Apps, Links, die direkt die App öffnen, und Hinweise auf die Stores.">
|
||||
<Panel id="apps" title="Apps (iOS und Android)" description="Für Push-Nachrichten an die Apps, Links, die direkt die App öffnen, und Hinweise auf die Stores.">
|
||||
<AppsSettings apps={s.apps} fcm={data.fcm} />
|
||||
</Panel>
|
||||
|
||||
|
|
@ -112,7 +102,7 @@
|
|||
/>
|
||||
</Panel>
|
||||
|
||||
<Panel title="Angaben zur Einrichtung" description="Daraus erzeugt die App Impressum und Datenschutzerklärung. Die Vorlagen beschreiben genau, was diese App verarbeitet – bitte trotzdem rechtlich prüfen lassen.">
|
||||
<Panel id="rechtliches" title="Angaben zur Einrichtung" description="Daraus erzeugt die App Impressum und Datenschutzerklärung. Die Vorlagen beschreiben genau, was diese App verarbeitet – bitte trotzdem rechtlich prüfen lassen.">
|
||||
<div class="grid sm:grid-cols-2 gap-4">
|
||||
<div class="sm:col-span-2">
|
||||
<label class="label" for="legalName">Name der Einrichtung / des Trägers (mit Rechtsform)</label>
|
||||
|
|
@ -211,46 +201,7 @@
|
|||
</Panel>
|
||||
|
||||
{#snippet aside()}
|
||||
<Panel title="Aussehen">
|
||||
<div>
|
||||
<span class="label">Farbpaar</span>
|
||||
<div class="flex flex-wrap gap-2 mb-4">
|
||||
{#each presets as [p, a] (p)}
|
||||
<button
|
||||
type="button"
|
||||
class="flex rounded-full overflow-hidden ring-offset-2 ring-offset-surface transition {color.toLowerCase() === p && accent.toLowerCase() === a ? 'ring-3 ring-ink' : 'hover:scale-105'}"
|
||||
aria-label="Farbpaar {p} und {a}"
|
||||
onclick={() => {
|
||||
color = p;
|
||||
accent = a;
|
||||
}}
|
||||
>
|
||||
<span class="size-8" style="background:{p}"></span><span class="size-8" style="background:{a}"></span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<div>
|
||||
<label class="label" for="brandColor">Hauptfarbe</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" bind:value={color} class="size-10 shrink-0 rounded-lg border border-line cursor-pointer bg-transparent" aria-label="Hauptfarbe wählen" />
|
||||
<input id="brandColor" name="brandColor" bind:value={color} class="field font-mono text-sm px-2" maxlength="7" />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="label" for="accentColor">Akzent</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<input type="color" bind:value={accent} class="size-10 shrink-0 rounded-lg border border-line cursor-pointer bg-transparent" aria-label="Akzentfarbe wählen" />
|
||||
<input id="accentColor" name="accentColor" bind:value={accent} class="field font-mono text-sm px-2" maxlength="7" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hint">Die Hauptfarbe sollte dunkel sein, weil Schrift und Buttons sie verwenden.</p>
|
||||
<div class="mt-3 relative overflow-hidden rounded-2xl p-4 h-24 text-white font-bold" style="background:{color}">
|
||||
<span class="relative z-10">Vorschau</span>
|
||||
<span class="absolute -right-6 -bottom-10 size-28 rounded-full" style="background:{accent}"></span>
|
||||
</div>
|
||||
</div>
|
||||
<Panel title="Logo">
|
||||
<ImageField name="logoId" value={data.logo} label="Logo" aspect="aspect-[3/1]" />
|
||||
<p class="hint -mt-3">Am besten ein PNG mit transparentem Hintergrund. Wird auch als App-Symbol verwendet.</p>
|
||||
</Panel>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
{#if data.tiles.length}
|
||||
<ul class="grid sm:grid-cols-2 xl:grid-cols-3 gap-3">
|
||||
{#each data.tiles as t, i (t.id)}
|
||||
<li class="flex items-center gap-3 rounded-full bg-surface-2 pl-2 pr-2 py-2">
|
||||
<li class="flex items-center gap-3 rounded-pill bg-surface-2 pl-2 pr-2 py-2">
|
||||
<span class="grid place-items-center size-12 rounded-full bg-surface text-brand-ink shrink-0"><Icon name={t.icon} class="size-[1.35rem]" /></span>
|
||||
<span class="flex-1 min-w-0">
|
||||
<span class="block font-bold text-brand-ink leading-tight truncate">{t.label}</span>
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@
|
|||
<span class="hidden sm:inline-flex items-center gap-1 text-xs font-bold text-ink-3" title="Push-Benachrichtigung gesendet"><BellRing class="size-4" aria-hidden="true" />gesendet<span class="sr-only">: Push-Benachrichtigung</span></span>
|
||||
{/if}
|
||||
{#if !p.published}
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-full bg-surface-2 text-ink-3">Entwurf</span>
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-pill bg-surface-2 text-ink-3">Entwurf</span>
|
||||
{:else if p.scheduled}
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-full tone-amber bg-tone-soft text-tone-ink">Geplant</span>
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-pill tone-amber bg-tone-soft text-tone-ink">Geplant</span>
|
||||
{:else}
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-full tone-emerald bg-tone-soft text-tone-ink">Online</span>
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-pill tone-emerald bg-tone-soft text-tone-ink">Online</span>
|
||||
<a href="/meldungen/{p.slug}" target="_blank" class="btn btn-ghost btn-icon btn-sm hidden sm:inline-flex" aria-label="In der App ansehen"><ExternalLink class="size-4" /></a>
|
||||
{/if}
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<span class="flex-1 min-w-0">
|
||||
<span class="flex items-center gap-2 {m.read ? 'font-semibold' : 'font-extrabold'}">
|
||||
{m.name}
|
||||
{#if m.kind === 'barrier'}<span class="rounded-full bg-accent-soft text-accent-ink px-2 py-0.5 text-[0.7rem] font-bold uppercase tracking-wider">Barriere</span>{/if}
|
||||
{#if m.kind === 'barrier'}<span class="rounded-pill bg-accent-soft text-accent-ink px-2 py-0.5 text-[0.7rem] font-bold uppercase tracking-wider">Barriere</span>{/if}
|
||||
</span>
|
||||
<span class="block text-sm text-ink-3 truncate">{m.message}</span>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@
|
|||
|
||||
<!-- Werkzeugleiste -->
|
||||
<div class="flex flex-wrap items-center gap-3 mb-6">
|
||||
<nav aria-label="Ansicht" class="inline-flex rounded-full bg-surface-2 p-1">
|
||||
<nav aria-label="Ansicht" class="inline-flex rounded-pill bg-surface-2 p-1">
|
||||
{#each views as v (v.value)}
|
||||
<a
|
||||
href="?{new URLSearchParams({ ...Object.fromEntries(page.url.searchParams), ansicht: v.value })}"
|
||||
class="inline-flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-sm font-bold transition {data.view === v.value ? 'bg-surface text-brand-ink shadow-card' : 'text-ink-2 hover:text-ink'}"
|
||||
class="inline-flex items-center gap-1.5 rounded-pill px-3.5 py-1.5 text-sm font-bold transition {data.view === v.value ? 'bg-surface text-brand-ink shadow-card' : 'text-ink-2 hover:text-ink'}"
|
||||
aria-current={data.view === v.value ? 'page' : undefined}
|
||||
data-sveltekit-noscroll
|
||||
>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<span class="font-semibold truncate block">{p.title}</span>
|
||||
</a>
|
||||
{#if !p.published}
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-full bg-surface-2 text-ink-3 inline-flex items-center gap-1"><EyeOff class="size-3" />Versteckt</span>
|
||||
<span class="text-xs font-bold px-2.5 py-1 rounded-pill bg-surface-2 text-ink-3 inline-flex items-center gap-1"><EyeOff class="size-3" />Versteckt</span>
|
||||
{:else}
|
||||
<a href="/s/{p.slug}" target="_blank" class="btn btn-ghost btn-icon btn-sm" aria-label="In der App ansehen"><ExternalLink class="size-4" /></a>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
</span>
|
||||
<span class="text-sm text-ink-3">{eventWhen(e)}{e.location ? ` · ${e.location}` : ''}</span>
|
||||
</span>
|
||||
{#if !e.published}<span class="text-xs font-bold px-2.5 py-1 rounded-full bg-surface-2 text-ink-3 inline-flex items-center gap-1"><EyeOff class="size-3" />Versteckt</span>{/if}
|
||||
{#if !e.published}<span class="text-xs font-bold px-2.5 py-1 rounded-pill bg-surface-2 text-ink-3 inline-flex items-center gap-1"><EyeOff class="size-3" />Versteckt</span>{/if}
|
||||
</a>
|
||||
</li>
|
||||
{/each}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue