Compare commits
2
Commits
20c17cbf81
...
9d12e4ab33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d12e4ab33 | ||
|
|
74f3ed6e31 |
+101
-44
@@ -32,10 +32,51 @@
|
|||||||
font-display: swap;
|
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 {
|
html {
|
||||||
--avatar-sm: 50px; /* Größe des Byline-Avatars; halbiert = Position des Thread-Strichs */
|
--avatar-sm: 50px; /* Größe des Byline-Avatars; halbiert = Position des Thread-Strichs */
|
||||||
--line-w: 3px; /* Dicke 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-family: "EB Garamond", serif;
|
||||||
font-optical-sizing: auto;
|
font-optical-sizing: auto;
|
||||||
}
|
}
|
||||||
@@ -46,14 +87,14 @@ body {
|
|||||||
|
|
||||||
/* --- Kopf --- */
|
/* --- Kopf --- */
|
||||||
header {
|
header {
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 0.5rem 0;
|
padding: 0.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "zurück zum Feed" unter dem Titel, auf allen Seiten außer dem Feed. */
|
/* "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. */
|
/* Klick auf die Überschrift führt zurück zum Feed. */
|
||||||
#topbar > a {
|
#topbar > a {
|
||||||
@@ -62,14 +103,14 @@ header {
|
|||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-family: "Cheltenham Classic", serif;
|
font-family: "Cheltenham Classic", serif;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0.2rem auto;
|
margin: 0.2rem auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-family: "Cheltenham Classic", serif;
|
font-family: "Cheltenham Classic", serif;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0 0.3rem;
|
padding: 0 0.3rem;
|
||||||
}
|
}
|
||||||
@@ -78,7 +119,7 @@ h2 {
|
|||||||
.tagline {
|
.tagline {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: black;
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reihe anarchistischer Sigillen im Kopf der Beitragsordnung (Easter Egg).
|
/* Reihe anarchistischer Sigillen im Kopf der Beitragsordnung (Easter Egg).
|
||||||
@@ -119,8 +160,8 @@ h2 {
|
|||||||
padding: 0.4rem;
|
padding: 0.4rem;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
color: black;
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar {
|
#sidebar {
|
||||||
@@ -131,8 +172,8 @@ h2 {
|
|||||||
z-index: 30;
|
z-index: 30;
|
||||||
width: 15rem;
|
width: 15rem;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
border-right: 1px solid black;
|
border-right: 1px solid var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar ul {
|
#sidebar ul {
|
||||||
@@ -142,7 +183,7 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#sidebar ul + ul {
|
#sidebar ul + ul {
|
||||||
border-top: 1px solid black;
|
border-top: 1px solid var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar a,
|
#sidebar a,
|
||||||
@@ -157,8 +198,8 @@ h2 {
|
|||||||
border: none;
|
border: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: black;
|
color: var(--ink);
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar button span {
|
#sidebar button span {
|
||||||
@@ -173,8 +214,8 @@ h2 {
|
|||||||
/* Aktuelles Ziel invertiert (NavLink setzt .active). */
|
/* Aktuelles Ziel invertiert (NavLink setzt .active). */
|
||||||
#sidebar a.active,
|
#sidebar a.active,
|
||||||
#tabbar a.active {
|
#tabbar a.active {
|
||||||
background-color: black;
|
background-color: var(--ink);
|
||||||
color: white;
|
color: var(--paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
#tabbar {
|
#tabbar {
|
||||||
@@ -184,8 +225,8 @@ h2 {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
border-top: 1px solid black;
|
border-top: 1px solid var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
#tabbar a {
|
#tabbar a {
|
||||||
@@ -199,7 +240,7 @@ h2 {
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
z-index: 25;
|
z-index: 25;
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: var(--shade);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 899px) {
|
@media (max-width: 899px) {
|
||||||
@@ -208,7 +249,7 @@ h2 {
|
|||||||
top: 0;
|
top: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border-bottom: 1px solid black;
|
border-bottom: 1px solid var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
#headerbar { padding-bottom: 0.3rem; }
|
#headerbar { padding-bottom: 0.3rem; }
|
||||||
@@ -290,7 +331,7 @@ main > section,
|
|||||||
main > div,
|
main > div,
|
||||||
main > h2,
|
main > h2,
|
||||||
main > p {
|
main > p {
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
main > section {
|
main > section {
|
||||||
@@ -312,7 +353,7 @@ span, a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: black;
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
@@ -322,12 +363,12 @@ a:hover {
|
|||||||
/* --- Buttons --- */
|
/* --- Buttons --- */
|
||||||
a.button, button {
|
a.button, button {
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
border: 1px solid black;
|
border: 1px solid var(--ink);
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
color: black;
|
color: var(--ink);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
font-family: "EB Garamond", serif;
|
font-family: "EB Garamond", serif;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -341,14 +382,14 @@ a.button:hover, button:hover {
|
|||||||
.card {
|
.card {
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:hover {
|
.card:hover {
|
||||||
background-color: #f7f7f5;
|
background-color: var(--hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card .content {
|
.card .content {
|
||||||
@@ -379,11 +420,11 @@ a.button:hover, button:hover {
|
|||||||
.link-preview {
|
.link-preview {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid black;
|
border: 1px solid var(--ink);
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
margin: 0 0 0.5rem;
|
margin: 0 0 0.5rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: black;
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
.link-preview:hover .link-preview-title {
|
.link-preview:hover .link-preview-title {
|
||||||
@@ -398,7 +439,7 @@ a.button:hover, button:hover {
|
|||||||
aspect-ratio: 16 / 9;
|
aspect-ratio: 16 / 9;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-right: 1px solid black;
|
border-right: 1px solid var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
.link-preview-text {
|
.link-preview-text {
|
||||||
@@ -419,7 +460,7 @@ a.button:hover, button:hover {
|
|||||||
|
|
||||||
.link-preview-site {
|
.link-preview-site {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
color: gray;
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- Avatare --- */
|
/* --- Avatare --- */
|
||||||
@@ -428,7 +469,7 @@ img.avatar {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
background-color: #eee;
|
background-color: var(--avatar-bg);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
max-width: none;
|
max-width: none;
|
||||||
}
|
}
|
||||||
@@ -463,7 +504,7 @@ img.avatar-sm { width: var(--avatar-sm); height: var(--avatar-sm); }
|
|||||||
|
|
||||||
.profile-header {
|
.profile-header {
|
||||||
aspect-ratio: 3 / 1;
|
aspect-ratio: 3 / 1;
|
||||||
background-color: black;
|
background-color: var(--bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-header img {
|
.profile-header img {
|
||||||
@@ -488,8 +529,8 @@ img.avatar-sm { width: var(--avatar-sm); height: var(--avatar-sm); }
|
|||||||
img.avatar-xl {
|
img.avatar-xl {
|
||||||
width: var(--avatar-xl);
|
width: var(--avatar-xl);
|
||||||
height: var(--avatar-xl);
|
height: var(--avatar-xl);
|
||||||
border: 4px solid white;
|
border: 4px solid var(--paper);
|
||||||
outline: 1px solid black;
|
outline: 1px solid var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
#profile-name {
|
#profile-name {
|
||||||
@@ -509,7 +550,7 @@ img.avatar-xl {
|
|||||||
|
|
||||||
/* Bearbeiten-Bereich des Eigentümers unter dem Profilkopf. */
|
/* Bearbeiten-Bereich des Eigentümers unter dem Profilkopf. */
|
||||||
.profile-edit {
|
.profile-edit {
|
||||||
border-top: 1px solid black;
|
border-top: 1px solid var(--ink);
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,7 +590,7 @@ img.avatar-xl {
|
|||||||
Antworten ohne Kette sind nur eingerückt. */
|
Antworten ohne Kette sind nur eingerückt. */
|
||||||
#ancestors .threadline,
|
#ancestors .threadline,
|
||||||
.chain > :not(:last-child) .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
|
/* "k weitere Beiträge" unterbricht den Strich: der Button steht bündig mit
|
||||||
@@ -565,7 +606,7 @@ img.avatar-xl {
|
|||||||
width: 0;
|
width: 0;
|
||||||
height: 0.6rem;
|
height: 0.6rem;
|
||||||
margin-left: calc(var(--avatar-sm) / 2 - var(--line-w));
|
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
|
/* 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). */
|
/* Repost-Button: im Cooldown gesperrt (gilt pro Beitrag für alle). */
|
||||||
.bump:disabled {
|
.bump:disabled {
|
||||||
color: gray;
|
color: var(--muted);
|
||||||
border-color: #ccc;
|
border-color: var(--faint);
|
||||||
cursor: default;
|
cursor: default;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
@@ -593,14 +634,21 @@ img.avatar-xl {
|
|||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted { color: gray; }
|
.muted { color: var(--muted); }
|
||||||
.muted a { color: gray; font-size: 1rem; }
|
.muted a { color: var(--muted); font-size: 1rem; }
|
||||||
.ghost.selected { font-weight: bold; }
|
.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; }
|
.msg { color: red; }
|
||||||
|
|
||||||
/* --- Formulare --- */
|
/* --- Formulare --- */
|
||||||
form {
|
form {
|
||||||
background-color: white;
|
background-color: var(--paper);
|
||||||
margin: auto;
|
margin: auto;
|
||||||
padding: 0.5rem 0;
|
padding: 0.5rem 0;
|
||||||
}
|
}
|
||||||
@@ -608,6 +656,8 @@ form {
|
|||||||
form input,
|
form input,
|
||||||
form textarea {
|
form textarea {
|
||||||
font-family: "EB Garamond", serif;
|
font-family: "EB Garamond", serif;
|
||||||
|
color: var(--ink);
|
||||||
|
background-color: var(--paper);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
@@ -616,7 +666,7 @@ form textarea {
|
|||||||
form textarea {
|
form textarea {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 0;
|
border: 0;
|
||||||
outline: 1px solid black;
|
outline: 1px solid var(--ink);
|
||||||
resize: vertical;
|
resize: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,6 +703,13 @@ form input[type="file"] {
|
|||||||
.chart-wide {
|
.chart-wide {
|
||||||
display: none;
|
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). */
|
/* Senkrechte Markierung des Tages unter dem Zeiger (Liniendiagramme). */
|
||||||
.chart g:hover .mark {
|
.chart g:hover .mark {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
|
|||||||
@@ -12,8 +12,13 @@ import { ResetPage } from "./pages/ResetPage";
|
|||||||
import { MePage, Placeholder } from "./pages/Placeholder";
|
import { MePage, Placeholder } from "./pages/Placeholder";
|
||||||
import { DocPage } from "./pages/DocPage";
|
import { DocPage } from "./pages/DocPage";
|
||||||
import { SettingsPage } from "./pages/SettingsPage";
|
import { SettingsPage } from "./pages/SettingsPage";
|
||||||
|
import { applyTheme, loadTheme } from "./theme";
|
||||||
import "./app.css";
|
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({
|
const queryClient = new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
|
|||||||
@@ -1,19 +1,54 @@
|
|||||||
|
import { useState } from "react";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { useAuthChanged, useMe } from "../auth";
|
import { useAuthChanged, useMe } from "../auth";
|
||||||
import { useFormAction } from "../useFormAction";
|
import { useFormAction } from "../useFormAction";
|
||||||
import { AuthBox } from "../components/AuthBox";
|
import { AuthBox } from "../components/AuthBox";
|
||||||
|
import { loadTheme, saveTheme, type Theme } from "../theme";
|
||||||
|
|
||||||
// SettingsPage: Kontoeinstellungen (Name, Passwort, Löschen). Profilbild, Header und
|
// SettingsPage: Darstellung (auch ohne Konto) und Kontoeinstellungen (Name,
|
||||||
// Beschreibung bearbeitet man auf dem eigenen Profil.
|
// Passwort, Löschen). Profilbild, Header und Beschreibung bearbeitet man auf
|
||||||
|
// dem eigenen Profil.
|
||||||
export function SettingsPage() {
|
export function SettingsPage() {
|
||||||
const me = useMe();
|
const me = useMe();
|
||||||
if (!me.isSuccess) return null;
|
return (
|
||||||
if (!me.data) return <AuthBox />;
|
<>
|
||||||
return <Settings />;
|
<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 qc = useQueryClient();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const authChanged = useAuthChanged();
|
const authChanged = useAuthChanged();
|
||||||
@@ -38,9 +73,7 @@ function Settings() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="settings">
|
<>
|
||||||
<h2>Einstellungen</h2>
|
|
||||||
|
|
||||||
<h3>Name ändern</h3>
|
<h3>Name ändern</h3>
|
||||||
<form id="rename-form" onSubmit={rename.onSubmit}>
|
<form id="rename-form" onSubmit={rename.onSubmit}>
|
||||||
<input name="user" type="text" placeholder="Neuer Nutzername" autoComplete="username" />{" "}
|
<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>
|
<button type="submit" disabled={del.busy}>Konto endgültig löschen</button>
|
||||||
</form>
|
</form>
|
||||||
<p className="msg" id="delete-msg">{del.msg}</p>
|
<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/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/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/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/useFormAction.ts` | Formular-POST mit Fehlermeldung (Profil, Einstellungen) |
|
||||||
| `src/components/*` | Feed, Beitragskarte, Votes, Repost, Login, Beitrag verfassen |
|
| `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
|
`/datenschutz`, `/beitragsordnung`) müssen
|
||||||
auch in `pageRoutes()` (`internal/httpapi/server.go`) stehen, sonst liefert ein direkter Aufruf 404.
|
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
|
## Navigation
|
||||||
|
|
||||||
Ab 900 px Fensterbreite steht links die Seitenleiste mit allen Zielen (Icon +
|
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