From 5288f8293e7282e1a4ae08b80446d4aa8206c58b Mon Sep 17 00:00:00 2001 From: Heidi Date: Mon, 22 Jun 2026 22:25:34 +0100 Subject: [PATCH] ai generated solutions to our ai generated problems --- frontend/src/App.jsx | 381 +++++++++++++++++++------------------------ 1 file changed, 171 insertions(+), 210 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 55964fb..7a67560 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -3271,25 +3271,79 @@ function SettingsPage({ theme, onThemeChange, customColor, onCustomColorChange, setDraftColor('#e82517') } + const hasAnyCustomColor = customColor || Object.keys(customColors).length > 0 + + function resetAllColors() { + onCustomColorChange('') + setDraftColor('#e82517') + onCustomColorsChange({}) + } + + const allColorDefs = [ + { + id: 'accent', + label: 'Accent', + desc: 'Links, highlights, interactive elements', + getValue: () => draftColor, + getDisplayVal: () => draftColor, + isCustom: () => !!customColor, + onChange: handleColorPickerChange, + onReset: resetToDefault, + }, + ...advancedColorDefs.map(({ field, label, desc, defaults }) => ({ + id: field, + label, + desc, + getValue: () => customColors[field] || '', + getDisplayVal: () => customColors[field] || defaults[theme] || defaults.dark, + isCustom: () => !!customColors[field], + onChange: (val) => onCustomColorsChange({ ...customColors, [field]: val }), + onReset: () => { + const next = { ...customColors } + delete next[field] + onCustomColorsChange(next) + }, + })), + ] + return ( -
+
-

Preferences

-

Settings

-

- Customise the look and feel of the site. Your choices are saved in cookies and local storage. +

Settings

+

+ Your choices are saved locally and persist across visits.

- {/* Appearance */}
+ {/* Appearance */}
-

Appearance

-

Choose a base theme and accent colour.

+

Appearance

- {/* Theme presets */} + {/* Light / Dark toggle */} +
+ Base mode +
+ + +
+
+ + {/* Presets */}
-

Theme presets

+

Presets

{accentPresets.map((preset) => { const isActive = activePresetId === preset.id @@ -3298,27 +3352,22 @@ function SettingsPage({ theme, onThemeChange, customColor, onCustomColorChange, key={preset.id} type="button" onClick={() => handlePreset(preset)} - className={`flex items-center gap-2 rounded-full border px-3 py-1.5 text-sm font-semibold transition ${isActive + className={`flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-semibold transition ${isActive ? 'border-fury-cyan bg-fury-cyan text-bg' : 'border-border bg-surface text-text hover:border-ring hover:bg-surface-alt' }`} > - {preset.color ? ( - - ) : ( - - )} + {preset.label} ) @@ -3326,176 +3375,89 @@ function SettingsPage({ theme, onThemeChange, customColor, onCustomColorChange,
- {/* Light / Dark toggle */} -
-

Base mode:

-
- - -
-
- - {/* Custom colour picker */} -
-

Custom accent colour

-
- {/* Colour wheel trigger */} - - - {/* Hex input */} -
- # - handleColorInput('#' + e.target.value.replace(/[^0-9a-fA-F]/g, ''))} - className="w-20 bg-transparent text-sm font-mono font-semibold text-text outline-none" - placeholder="e82517" - spellCheck={false} - /> -
- - {/* Live preview swatch */} -
- - Preview - -
- - {/* Reset button */} - {customColor ? ( + {/* Colour grid */} +
+
+

Colours

+ {hasAnyCustomColor && ( - ) : null} + )}
-

- Changes all accent highlights, links, and interactive elements across the site. -

-
-
- - {/* Advanced colours */} -
-

Advanced colours

-

Override individual colours for the current theme. Each resets independently.

- -
- {advancedColorDefs.map(({ field, label, desc, defaults }) => { - const defaultVal = defaults[theme] ?? defaults.dark - const currentVal = customColors[field] || '' - const displayVal = currentVal || defaultVal - return ( -
-
- {/* Cookie & Analytics */} + {/* Analytics */}
-

Cookie & analytics settings

-

- We use a necessary cookie to remember these choices. You can also allow analytics for the public viewers page and choose which details are included. +

Analytics & cookies

+

+ A necessary cookie stores these preferences. You can allow analytics for the viewers page and control what's included.

-
+
updateDraft('analytics', value)} /> - updateDraft('device', value)} - /> - updateDraft('display', value)} - /> - updateDraft('locale', value)} - /> - updateDraft('referrer', value)} - /> - updateDraft('diagnostics', value)} - /> + {draft.analytics && ( +
+ updateDraft('device', value)} + /> + updateDraft('display', value)} + /> + updateDraft('locale', value)} + /> + updateDraft('referrer', value)} + /> + updateDraft('diagnostics', value)} + /> +
+ )}
@@ -3551,7 +3512,7 @@ function SettingsPage({ theme, onThemeChange, customColor, onCustomColorChange, onClick={() => onAnalyticsChoose({ ...defaultAnalyticsPreferences, chosen: true })} className="rounded-md border border-border px-4 py-2 text-sm font-semibold text-text-soft transition hover:bg-surface hover:text-text" > - Decline all analytics + Decline all