feat: a slider darkens the wallpaper, the dots and the fade are gone
images / check (push) Successful in 28s
images / image (push) Successful in 24s

This commit is contained in:
2026-11-18 17:06:40 +01:00
parent 7798432de6
commit 4b9690e064
10 changed files with 769 additions and 25 deletions
+54 -5
View File
@@ -92,6 +92,9 @@ function Settings() {
const file = useRef<HTMLInputElement>(null)
const [status, setStatus] = useState<"idle" | "saving" | "saved">("idle")
const [error, setError] = useState("")
// follows the slider at once, the save comes a moment later
const [dim, setDim] = useState(data.wallpaperDim)
const dimSave = useRef<ReturnType<typeof setTimeout>>(undefined)
// Every control saves on its own. `action` returns a message when it failed.
const run = async (action: () => Promise<string | void>) => {
@@ -106,6 +109,7 @@ function Settings() {
title?: string
searchEngine?: Engine
wallpaperUrl?: string | null
wallpaperDim?: number
clockFont?: ClockFont
clockStyle?: ClockStyle
}) => run(() => saveSettings({ data: patch }))
@@ -339,11 +343,18 @@ function Settings() {
</SettingsSectionHeader>
<SettingsRow stacked>
<div className="flex flex-wrap items-start gap-x-6 gap-y-4">
<img
src={data.wallpaperUrl ?? DEFAULT_WALLPAPER}
alt="Current wallpaper"
className="aspect-video w-60 flex-none rounded-xl border border-line object-cover"
/>
<div className="relative w-60 flex-none overflow-hidden rounded-xl border border-line">
<img
src={data.wallpaperUrl ?? DEFAULT_WALLPAPER}
alt="Current wallpaper"
className="aspect-video w-full object-cover"
/>
{/* as dark as on the dashboard */}
<div
className="absolute inset-0 bg-black"
style={{ opacity: dim / 100 }}
/>
</div>
<div className="flex min-w-0 flex-[1_1_260px] flex-col gap-3.5">
<Field>
<FieldLabel>Image address</FieldLabel>
@@ -407,6 +418,44 @@ function Settings() {
</div>
</div>
</SettingsRow>
<SettingsRow>
<SettingsRowText>
<SettingsRowLabel htmlFor="settings-dim">
Darken
</SettingsRowLabel>
<SettingsRowDescription>
How much the wallpaper is darkened, so that the text on it
stays readable.
</SettingsRowDescription>
</SettingsRowText>
<SettingsRowControl className="flex items-center gap-3">
<input
id="settings-dim"
type="range"
min={0}
max={100}
step={5}
value={dim}
onChange={(e) => {
const wallpaperDim = Number(e.target.value)
setDim(wallpaperDim)
// one save when the slider rests, not one per step
clearTimeout(dimSave.current)
dimSave.current = setTimeout(
() => save({ wallpaperDim }),
400
)
}}
className="w-48 accent-accent scheme-dark"
/>
<output
htmlFor="settings-dim"
className="w-10 text-right text-sm text-fg-subtle tabular-nums"
>
{dim}%
</output>
</SettingsRowControl>
</SettingsRow>
</SettingsSection>
<SettingsSection id="account" className={section}>