Compare commits
2
Commits
20c17cbf81
...
9d12e4ab33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d12e4ab33 | ||
|
|
74f3ed6e31 |
+101
-44
@@ -32,10 +32,51 @@
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
/* --- Farben ---
|
||||
Hell: Schwarz auf Weiß. Dunkel (experimentell): dieselben Flächen
|
||||
invertiert, nur per Schalter in den Einstellungen (data-theme="dark" auf
|
||||
<html>, src/theme.ts) -- bewusst nicht per prefers-color-scheme. */
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--ink: black; /* Text, Linien, Rahmen */
|
||||
--paper: white; /* Flächen */
|
||||
--muted: gray; /* Nebentext, Thread-Strich */
|
||||
--faint: #ccc; /* gesperrte Rahmen */
|
||||
--hover: #f7f7f5; /* Karte unter dem Zeiger */
|
||||
--avatar-bg: #eee; /* Avatar, solange das Bild lädt */
|
||||
--shade: rgba(0, 0, 0, 0.4); /* hinter der Schublade */
|
||||
--texture: url("/static/assets/concrete/Concrete012_1024p_Color.jpg");
|
||||
--texture-tint: transparent; /* Schleier über der Textur */
|
||||
--bar: black; /* Profil ohne Header-Bild */
|
||||
--chart-grid: #ddd;
|
||||
--chart-a: #444;
|
||||
--chart-b: #aaa;
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
color-scheme: dark;
|
||||
--ink: white;
|
||||
--paper: black;
|
||||
--muted: #999;
|
||||
--faint: #444;
|
||||
--hover: #161616;
|
||||
--avatar-bg: #222;
|
||||
--shade: rgba(0, 0, 0, 0.6);
|
||||
--texture: url("/static/assets/asphalt/black_concrete_5_1024p.jpg");
|
||||
--texture-tint: rgba(0, 0, 0, 0.35);
|
||||
--bar: #222;
|
||||
--chart-grid: #333;
|
||||
--chart-a: #ccc;
|
||||
--chart-b: #666;
|
||||
}
|
||||
|
||||
html {
|
||||
--avatar-sm: 50px; /* Größe des Byline-Avatars; halbiert = Position des Thread-Strichs */
|
||||
--line-w: 3px; /* Dicke des Thread-Strichs */
|
||||
background-image: url("/static/assets/concrete/Concrete012_1024p_Color.jpg");
|
||||
color: var(--ink);
|
||||
background-color: var(--paper);
|
||||
/* Hell Beton, dunkel Asphalt unter einem Schleier. */
|
||||
background-image: linear-gradient(var(--texture-tint), var(--texture-tint)), var(--texture);
|
||||
font-family: "EB Garamond", serif;
|
||||
font-optical-sizing: auto;
|
||||
}
|
||||
@@ -46,14 +87,14 @@ body {
|
||||
|
||||
/* --- Kopf --- */
|
||||
header {
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
|
||||
/* "zurück zum Feed" unter dem Titel, auf allen Seiten außer dem Feed. */
|
||||
#headerbar a { background-color: white; }
|
||||
#headerbar a { background-color: var(--paper); }
|
||||
|
||||
/* Klick auf die Überschrift führt zurück zum Feed. */
|
||||
#topbar > a {
|
||||
@@ -62,14 +103,14 @@ header {
|
||||
|
||||
h1 {
|
||||
font-family: "Cheltenham Classic", serif;
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
display: inline-block;
|
||||
margin: 0.2rem auto;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: "Cheltenham Classic", serif;
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
display: inline-block;
|
||||
padding: 0 0.3rem;
|
||||
}
|
||||
@@ -78,7 +119,7 @@ h2 {
|
||||
.tagline {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
color: black;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
/* Reihe anarchistischer Sigillen im Kopf der Beitragsordnung (Easter Egg).
|
||||
@@ -119,8 +160,8 @@ h2 {
|
||||
padding: 0.4rem;
|
||||
margin: 0;
|
||||
border: none;
|
||||
background-color: white;
|
||||
color: black;
|
||||
background-color: var(--paper);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
@@ -131,8 +172,8 @@ h2 {
|
||||
z-index: 30;
|
||||
width: 15rem;
|
||||
overflow-y: auto;
|
||||
background-color: white;
|
||||
border-right: 1px solid black;
|
||||
background-color: var(--paper);
|
||||
border-right: 1px solid var(--ink);
|
||||
}
|
||||
|
||||
#sidebar ul {
|
||||
@@ -142,7 +183,7 @@ h2 {
|
||||
}
|
||||
|
||||
#sidebar ul + ul {
|
||||
border-top: 1px solid black;
|
||||
border-top: 1px solid var(--ink);
|
||||
}
|
||||
|
||||
#sidebar a,
|
||||
@@ -157,8 +198,8 @@ h2 {
|
||||
border: none;
|
||||
text-align: left;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
background-color: white;
|
||||
color: var(--ink);
|
||||
background-color: var(--paper);
|
||||
}
|
||||
|
||||
#sidebar button span {
|
||||
@@ -173,8 +214,8 @@ h2 {
|
||||
/* Aktuelles Ziel invertiert (NavLink setzt .active). */
|
||||
#sidebar a.active,
|
||||
#tabbar a.active {
|
||||
background-color: black;
|
||||
color: white;
|
||||
background-color: var(--ink);
|
||||
color: var(--paper);
|
||||
}
|
||||
|
||||
#tabbar {
|
||||
@@ -184,8 +225,8 @@ h2 {
|
||||
bottom: 0;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
background-color: white;
|
||||
border-top: 1px solid black;
|
||||
background-color: var(--paper);
|
||||
border-top: 1px solid var(--ink);
|
||||
}
|
||||
|
||||
#tabbar a {
|
||||
@@ -199,7 +240,7 @@ h2 {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 25;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
background-color: var(--shade);
|
||||
}
|
||||
|
||||
@media (max-width: 899px) {
|
||||
@@ -208,7 +249,7 @@ h2 {
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
padding: 0;
|
||||
border-bottom: 1px solid black;
|
||||
border-bottom: 1px solid var(--ink);
|
||||
}
|
||||
|
||||
#headerbar { padding-bottom: 0.3rem; }
|
||||
@@ -290,7 +331,7 @@ main > section,
|
||||
main > div,
|
||||
main > h2,
|
||||
main > p {
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
}
|
||||
|
||||
main > section {
|
||||
@@ -312,7 +353,7 @@ span, a {
|
||||
}
|
||||
|
||||
a {
|
||||
color: black;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
@@ -322,12 +363,12 @@ a:hover {
|
||||
/* --- Buttons --- */
|
||||
a.button, button {
|
||||
padding: 4px 8px;
|
||||
border: 1px solid black;
|
||||
border: 1px solid var(--ink);
|
||||
margin: 2px 0;
|
||||
display: inline-block;
|
||||
color: black;
|
||||
color: var(--ink);
|
||||
text-decoration: none;
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
font-family: "EB Garamond", serif;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
@@ -341,14 +382,14 @@ a.button:hover, button:hover {
|
||||
.card {
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
margin-bottom: 0;
|
||||
font-size: 1.2rem;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
background-color: #f7f7f5;
|
||||
background-color: var(--hover);
|
||||
}
|
||||
|
||||
.card .content {
|
||||
@@ -379,11 +420,11 @@ a.button:hover, button:hover {
|
||||
.link-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
border: 1px solid var(--ink);
|
||||
background-color: var(--paper);
|
||||
margin: 0 0 0.5rem;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.link-preview:hover .link-preview-title {
|
||||
@@ -398,7 +439,7 @@ a.button:hover, button:hover {
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
margin: 0;
|
||||
border-right: 1px solid black;
|
||||
border-right: 1px solid var(--ink);
|
||||
}
|
||||
|
||||
.link-preview-text {
|
||||
@@ -419,7 +460,7 @@ a.button:hover, button:hover {
|
||||
|
||||
.link-preview-site {
|
||||
font-size: 0.9rem;
|
||||
color: gray;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* --- Avatare --- */
|
||||
@@ -428,7 +469,7 @@ img.avatar {
|
||||
vertical-align: middle;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
background-color: #eee;
|
||||
background-color: var(--avatar-bg);
|
||||
margin: 0;
|
||||
max-width: none;
|
||||
}
|
||||
@@ -463,7 +504,7 @@ img.avatar-sm { width: var(--avatar-sm); height: var(--avatar-sm); }
|
||||
|
||||
.profile-header {
|
||||
aspect-ratio: 3 / 1;
|
||||
background-color: black;
|
||||
background-color: var(--bar);
|
||||
}
|
||||
|
||||
.profile-header img {
|
||||
@@ -488,8 +529,8 @@ img.avatar-sm { width: var(--avatar-sm); height: var(--avatar-sm); }
|
||||
img.avatar-xl {
|
||||
width: var(--avatar-xl);
|
||||
height: var(--avatar-xl);
|
||||
border: 4px solid white;
|
||||
outline: 1px solid black;
|
||||
border: 4px solid var(--paper);
|
||||
outline: 1px solid var(--ink);
|
||||
}
|
||||
|
||||
#profile-name {
|
||||
@@ -509,7 +550,7 @@ img.avatar-xl {
|
||||
|
||||
/* Bearbeiten-Bereich des Eigentümers unter dem Profilkopf. */
|
||||
.profile-edit {
|
||||
border-top: 1px solid black;
|
||||
border-top: 1px solid var(--ink);
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
@@ -549,7 +590,7 @@ img.avatar-xl {
|
||||
Antworten ohne Kette sind nur eingerückt. */
|
||||
#ancestors .threadline,
|
||||
.chain > :not(:last-child) .threadline {
|
||||
border-right: var(--line-w) solid gray;
|
||||
border-right: var(--line-w) solid var(--muted);
|
||||
}
|
||||
|
||||
/* "k weitere Beiträge" unterbricht den Strich: der Button steht bündig mit
|
||||
@@ -565,7 +606,7 @@ img.avatar-xl {
|
||||
width: 0;
|
||||
height: 0.6rem;
|
||||
margin-left: calc(var(--avatar-sm) / 2 - var(--line-w));
|
||||
border-left: var(--line-w) solid gray;
|
||||
border-left: var(--line-w) solid var(--muted);
|
||||
}
|
||||
|
||||
/* Interaktionsleiste: Antworten-Button links, Vote-Buttons mittig, Repost
|
||||
@@ -581,8 +622,8 @@ img.avatar-xl {
|
||||
|
||||
/* Repost-Button: im Cooldown gesperrt (gilt pro Beitrag für alle). */
|
||||
.bump:disabled {
|
||||
color: gray;
|
||||
border-color: #ccc;
|
||||
color: var(--muted);
|
||||
border-color: var(--faint);
|
||||
cursor: default;
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -593,14 +634,21 @@ img.avatar-xl {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.muted { color: gray; }
|
||||
.muted a { color: gray; font-size: 1rem; }
|
||||
.muted { color: var(--muted); }
|
||||
.muted a { color: var(--muted); font-size: 1rem; }
|
||||
.ghost.selected { font-weight: bold; }
|
||||
|
||||
/* Umschalter (z. B. Darstellung): die gewählte Option invertiert wie das
|
||||
aktuelle Ziel in der Navigation. */
|
||||
button[aria-pressed="true"] {
|
||||
background-color: var(--ink);
|
||||
color: var(--paper);
|
||||
}
|
||||
.msg { color: red; }
|
||||
|
||||
/* --- Formulare --- */
|
||||
form {
|
||||
background-color: white;
|
||||
background-color: var(--paper);
|
||||
margin: auto;
|
||||
padding: 0.5rem 0;
|
||||
}
|
||||
@@ -608,6 +656,8 @@ form {
|
||||
form input,
|
||||
form textarea {
|
||||
font-family: "EB Garamond", serif;
|
||||
color: var(--ink);
|
||||
background-color: var(--paper);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin: 4px 0;
|
||||
@@ -616,7 +666,7 @@ form textarea {
|
||||
form textarea {
|
||||
padding: 5px;
|
||||
border: 0;
|
||||
outline: 1px solid black;
|
||||
outline: 1px solid var(--ink);
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
@@ -653,6 +703,13 @@ form input[type="file"] {
|
||||
.chart-wide {
|
||||
display: none;
|
||||
}
|
||||
/* Die SVGs färben per Präsentationsattribut (fill="black" ...); CSS geht vor
|
||||
und biegt die festen Farben auf die Farbvariablen um. */
|
||||
.chart svg { fill: var(--ink); }
|
||||
.chart [stroke="black"] { stroke: var(--ink); }
|
||||
.chart [stroke="#ddd"] { stroke: var(--chart-grid); }
|
||||
.chart [fill="#444"] { fill: var(--chart-a); }
|
||||
.chart [fill="#aaa"] { fill: var(--chart-b); }
|
||||
/* Senkrechte Markierung des Tages unter dem Zeiger (Liniendiagramme). */
|
||||
.chart g:hover .mark {
|
||||
visibility: visible;
|
||||
|
||||
@@ -12,8 +12,13 @@ import { ResetPage } from "./pages/ResetPage";
|
||||
import { MePage, Placeholder } from "./pages/Placeholder";
|
||||
import { DocPage } from "./pages/DocPage";
|
||||
import { SettingsPage } from "./pages/SettingsPage";
|
||||
import { applyTheme, loadTheme } from "./theme";
|
||||
import "./app.css";
|
||||
|
||||
// Vor dem ersten Rendern, damit nichts in der falschen Darstellung aufblitzt.
|
||||
// (Kein Inline-Skript in index.html: die CSP erlaubt nur 'self'.)
|
||||
applyTheme(loadTheme());
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
|
||||
@@ -1,19 +1,54 @@
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useAuthChanged, useMe } from "../auth";
|
||||
import { useFormAction } from "../useFormAction";
|
||||
import { AuthBox } from "../components/AuthBox";
|
||||
import { loadTheme, saveTheme, type Theme } from "../theme";
|
||||
|
||||
// SettingsPage: Kontoeinstellungen (Name, Passwort, Löschen). Profilbild, Header und
|
||||
// Beschreibung bearbeitet man auf dem eigenen Profil.
|
||||
// SettingsPage: Darstellung (auch ohne Konto) und Kontoeinstellungen (Name,
|
||||
// Passwort, Löschen). Profilbild, Header und Beschreibung bearbeitet man auf
|
||||
// dem eigenen Profil.
|
||||
export function SettingsPage() {
|
||||
const me = useMe();
|
||||
if (!me.isSuccess) return null;
|
||||
if (!me.data) return <AuthBox />;
|
||||
return <Settings />;
|
||||
return (
|
||||
<>
|
||||
<section id="settings">
|
||||
<h2>Einstellungen</h2>
|
||||
<Appearance />
|
||||
{me.data && <AccountSettings />}
|
||||
</section>
|
||||
{me.isSuccess && !me.data && <AuthBox />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Settings() {
|
||||
const themes: { value: Theme; label: string }[] = [
|
||||
{ value: "light", label: "Hell" },
|
||||
{ value: "dark", label: "Dunkel (experimentell)" },
|
||||
];
|
||||
|
||||
function Appearance() {
|
||||
const [theme, setTheme] = useState(loadTheme);
|
||||
const pick = (t: Theme) => {
|
||||
saveTheme(t);
|
||||
setTheme(t);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<h3>Darstellung</h3>
|
||||
<div className="row" role="group" aria-label="Darstellung">
|
||||
{themes.map((t) => (
|
||||
<button key={t.value} aria-pressed={theme === t.value} onClick={() => pick(t.value)}>
|
||||
{t.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function AccountSettings() {
|
||||
const qc = useQueryClient();
|
||||
const navigate = useNavigate();
|
||||
const authChanged = useAuthChanged();
|
||||
@@ -38,9 +73,7 @@ function Settings() {
|
||||
});
|
||||
|
||||
return (
|
||||
<section id="settings">
|
||||
<h2>Einstellungen</h2>
|
||||
|
||||
<>
|
||||
<h3>Name ändern</h3>
|
||||
<form id="rename-form" onSubmit={rename.onSubmit}>
|
||||
<input name="user" type="text" placeholder="Neuer Nutzername" autoComplete="username" />{" "}
|
||||
@@ -72,6 +105,6 @@ function Settings() {
|
||||
<button type="submit" disabled={del.busy}>Konto endgültig löschen</button>
|
||||
</form>
|
||||
<p className="msg" id="delete-msg">{del.msg}</p>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// Darstellung: hell (Standard) oder dunkel über data-theme auf <html> (Farben
|
||||
// in app.css, Abschnitt Farben). Dunkel ist experimentell und nur per
|
||||
// Schalter erreichbar, nicht über die System-Einstellung. Gespeichert wird nur
|
||||
// im Browser; ohne Storage gilt eben hell.
|
||||
export type Theme = "light" | "dark";
|
||||
|
||||
const key = "kver.theme";
|
||||
|
||||
export function loadTheme(): Theme {
|
||||
try {
|
||||
const v = localStorage.getItem(key);
|
||||
return v === "dark" ? v : "light";
|
||||
} catch {
|
||||
return "light";
|
||||
}
|
||||
}
|
||||
|
||||
export function applyTheme(t: Theme) {
|
||||
const root = document.documentElement;
|
||||
if (t === "light") delete root.dataset.theme;
|
||||
else root.dataset.theme = t;
|
||||
}
|
||||
|
||||
export function saveTheme(t: Theme) {
|
||||
applyTheme(t);
|
||||
try {
|
||||
if (t === "light") localStorage.removeItem(key);
|
||||
else localStorage.setItem(key, t);
|
||||
} catch {
|
||||
// egal, siehe oben
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ githooks` läuft das nach jedem Commit automatisch im Hintergrund (Log:
|
||||
| `src/Nav.tsx` | Seitenleiste (alle Ziele) und mobile TabBar (fünf wichtigste); Icons von lucide-react, die Rechtstexte ohne Icon |
|
||||
| `src/docs/*.html` | Rechtstexte (Impressum, Datenschutz, Beitragsordnung) |
|
||||
| `src/pages/*` | Startseite, Thread, Profil (Header, Beschreibung, Bearbeiten für den Eigentümer), Einstellungen (Name, Passwort, Konto löschen), Statistik, Rechtstexte (`DocPage.tsx`); `Placeholder.tsx` für Suche, Benachrichtigungen, Chats und die Profil-Weiche `/me` |
|
||||
| `src/theme.ts` | Darstellung hell/dunkel (experimentell) |
|
||||
| `src/useFormAction.ts` | Formular-POST mit Fehlermeldung (Profil, Einstellungen) |
|
||||
| `src/components/*` | Feed, Beitragskarte, Votes, Repost, Login, Beitrag verfassen |
|
||||
|
||||
@@ -57,6 +58,17 @@ Seitenrouten des Clients (`/`, `/e/:pid`, `/u/:username`, `/stats`, `/reset`,
|
||||
`/datenschutz`, `/beitragsordnung`) müssen
|
||||
auch in `pageRoutes()` (`internal/httpapi/server.go`) stehen, sonst liefert ein direkter Aufruf 404.
|
||||
|
||||
## Darstellung (hell/dunkel)
|
||||
|
||||
Alle Farben sind Variablen in `app.css` (Abschnitt Farben): `--ink` (bisher
|
||||
Schwarz), `--paper` (bisher Weiß), dazu Grautöne, Textur und Diagrammfarben.
|
||||
Dunkel ist experimentell (reines Invertieren reicht noch nicht) und nur über
|
||||
den Schalter in den Einstellungen erreichbar (auch ohne Konto), bewusst nicht
|
||||
über `prefers-color-scheme`: `src/theme.ts` setzt `data-theme="dark"` auf
|
||||
`<html>` aus dem `localStorage` (`kver.theme`). Neue Farben bitte nur
|
||||
als Variable, sonst fehlen sie im Dunkeln. Die Diagramm-SVGs behalten ihre
|
||||
festen Farben; `app.css` biegt sie per Attribut-Selektor um.
|
||||
|
||||
## Navigation
|
||||
|
||||
Ab 900 px Fensterbreite steht links die Seitenleiste mit allen Zielen (Icon +
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 449 KiB |
Reference in New Issue
Block a user