Commit Graph

4447 Commits

Author SHA1 Message Date
Alex Gleason a3b2fbdf19 Merge branch 'main' of gitlab.com:soapbox-pub/ditto-mew 2026-02-26 18:09:48 -06:00
Chad Curtis fb9064cb0e Add pull-to-refresh to notifications; simplify Android notifications to use 'Someone' instead of fetching kind 0 metadata 2026-02-26 18:06:53 -06:00
Chad Curtis 223849070c fix: deduplicate browser PWA notifications to prevent showing twice
Remove nostr from useEffect dependencies (replacing with a ref) so the
subscription is not torn down and re-opened on every render cycle.
Add a seenIds Set to guard against the same event ID firing multiple
notifications even if the relay delivers it more than once.
2026-02-26 18:06:53 -06:00
Alex Gleason be6980359f Eliminate duplicated schema by deriving DittoConfigSchema from AppConfigSchema
Delete the separate config/schema.ts that duplicated every Zod schema.
DittoConfigSchema is now simply AppConfigSchema.partial().strict(),
defined in src/lib/schemas.ts alongside everything else. vite.config.ts
imports it directly via a relative path.
2026-02-26 17:57:55 -06:00
Alex Gleason 3eb92f472c Support build-time ditto.json config file
Read an optional ditto.json (or CONFIG_FILE env) at build time, validate
it with Zod, and inject the result via Vite's define. At runtime the
build-time values are merged between the hardcoded defaults and user
localStorage, giving precedence: user > build-time > hardcoded.

Extract canonical Zod schemas into config/schema.ts (no path aliases)
so they can be imported from both vite.config.ts and runtime code.
Move AppConfigSchema out of AppProvider into src/lib/schemas.ts to
eliminate duplication.
2026-02-26 17:53:54 -06:00
Alex Gleason d45adf604a Route all light/dark theme resolution through resolveThemeConfig()
Every place that previously read builtinThemes directly for light/dark
mode now calls resolveThemeConfig(), which checks config.themes first
and falls back to builtinThemes. This ensures configured themes are
actually used for colors, fonts, and backgrounds in all code paths:
AppProvider, useTheme, ThemeSelector, ThemeBuilderPage, ProfilePage.
2026-02-26 17:41:31 -06:00
Alex Gleason 6b0972945e Update theme kind numbers in code: 33891 -> 36767, 11667 -> 16767 2026-02-26 17:32:33 -06:00
Alex Gleason 97f873118e Add themes config to AppConfig for configurable light/dark themes
Allow self-hosters to override the builtin light/dark themes by setting
a themes field in AppConfig with full ThemeConfig objects (colors, fonts,
backgrounds) for each mode.
2026-02-26 17:29:54 -06:00
Alex Gleason ee3374a762 Make "system" the default theme 2026-02-26 16:44:12 -06:00
Alex Gleason a03d8454e3 Apply background image from profile theme when viewing other users' profiles 2026-02-26 16:35:25 -06:00
Alex Gleason 92c1d98fe2 Merge branch 'main' of gitlab.com:soapbox-pub/ditto-mew 2026-02-26 16:22:53 -06:00
Alex Gleason dd2f7af3d3 Don't put black overlay over color picker items 2026-02-26 16:22:39 -06:00
Alex Gleason 01e689a3b5 Only show custom font/background in pickers when theme is 'custom'
When switching to builtin themes (Light/Dark/System), setTheme doesn't
clear customTheme, so the FontPicker and BackgroundPicker were still
showing the previous preset's font/background. Now they check that the
active theme is 'custom' before displaying the current selection.
2026-02-26 16:17:16 -06:00
Alex Gleason cd6d5f7a7c Replace Comic Neue with Comic Relief in bundled fonts 2026-02-26 16:15:09 -06:00
Alex Gleason 3247624600 Fix font not updating when switching between presets
Use primitive fontFamily/fontUrl strings as effect dependencies instead
of the font object reference, matching the same fix applied to
background handling.
2026-02-26 16:13:51 -06:00
Alex Gleason 4be0c49aa5 Remove White, Black, Midnight, and Ocean preset themes 2026-02-26 16:12:22 -06:00
Alex Gleason 724df5e5d9 Fix background not clearing when switching to a preset without one
Use primitive bgUrl/bgMode strings as effect dependencies instead of
the background object reference, ensuring React detects the change
when switching between presets with and without backgrounds.
2026-02-26 16:03:15 -06:00
Alex Gleason 0211648162 Show background image in theme preset preview tiles 2026-02-26 15:58:41 -06:00
Alex Gleason 1a2ada9942 Add cherry blossom background to Pink preset, pass background through all preset application sites 2026-02-26 15:56:32 -06:00
Alex Gleason 0af913c6ab Actually, only put background on center column 2026-02-26 15:54:34 -06:00
Alex Gleason 0b7928d38b Apply background color to main layout 2026-02-26 15:32:34 -06:00
Alex Gleason b5a59ac9a6 Remove 'contain' background mode from NIP.md and codebase, keep only cover and tile 2026-02-26 15:22:35 -06:00
Alex Gleason 78169c62d3 Add background image picker to theme settings
Upload images via Blossom, store in ThemeConfig.background, and apply
as a fixed CSS background on <body>. Supports cover/tile/contain modes.
Background picker sits in the consolidated customize card between the
font picker and the share toggle.
2026-02-26 15:14:00 -06:00
Alex Gleason 3487d87e5e Consolidate colors, font, and share toggle into a single card on theme settings 2026-02-26 15:08:33 -06:00
Alex Gleason 108c4139ca Add font pairings to theme presets (Pink/Comfortaa, Toxic/JetBrains Mono, Sunset/Lora)
Also fix all preset application sites (ThemeSelector, SidebarThemeDropdown,
LeftSidebar, InitialSyncGate) to pass the font along with colors when
selecting a preset.
2026-02-26 15:05:58 -06:00
Chad Curtis fa250e6a19 Wire notifications toggle to encrypted settings; add PWA browser notification support
- Add notificationsEnabled to EncryptedSettings schema and interface
- NotificationSettings now persists the toggle to encrypted settings (synced across devices) instead of ephemeral local state
- useNativeNotifications: Capacitor path skips DittoNotification.configure when notificationsEnabled is false
- useNativeNotifications: web/PWA path opens a live Nostr req subscription and fires browser Notification API events when permission is granted and the setting is enabled
2026-02-26 15:05:47 -06:00
Alex Gleason 2acabeb833 Move FontPicker into ThemeSelector, below colors and above share toggle 2026-02-26 15:01:02 -06:00
Alex Gleason 1555fe342b Add FontPicker to theme builder page below the colors section 2026-02-26 14:59:33 -06:00
Alex Gleason bc4cc80581 Simplify theme fonts to a single font (remove heading/body roles)
Reduce font complexity from two-role (title/body) to a single font
that applies globally to all text. Updates NIP.md f tag format from
["f", family, role, url] to ["f", family, url], removes ThemeFonts
wrapper in favor of a single ThemeFont on ThemeConfig.font, and
simplifies FontPicker to a single dropdown.
2026-02-26 14:57:41 -06:00
Alex Gleason fbcd40e164 Fix share toggle to include fonts/background in active profile theme
ThemeSelector was constructing a new ThemeConfig with only colors when
sharing, discarding the fonts and background from the customTheme.
Now passes the full customTheme (which already is a ThemeConfig).
2026-02-26 14:50:20 -06:00
Alex Gleason 3b15044919 Implement ThemeConfig type system with bundled fonts and NIP.md-compliant event parsing
- Add ThemeConfig wrapper type (colors + fonts + background) replacing bare CoreThemeColors
- Sync theme event parsing/building with NIP.md spec: colors in c tags (hex), fonts in f tags, background in bg tags (imeta-style), empty content field
- Legacy backward compat: parse old JSON-in-content format and bare CoreThemeColors in localStorage/encrypted settings
- Bundle 10 curated fonts via fontsource (Inter, DM Sans, Outfit, Montserrat, Lora, Merriweather, Playfair Display, JetBrains Mono, Comfortaa, Comic Neue) with lazy dynamic imports
- Create font loader (src/lib/fontLoader.ts) for @font-face injection from remote URLs and CSS override application for title/body roles
- Rewrite FontPicker as dual title/body picker using bundled fonts instead of Google Fonts CDN
- Remove Google Fonts integration (useGoogleFont.ts, GoogleFontLoader.tsx)
- Resolve bundled font family names to CDN URLs when publishing to Nostr
- Apply profile theme fonts when visiting other users' profiles
- Update all consumers: AppProvider, useTheme, usePublishTheme, useEncryptedSettings, ThemeSelector, ThemeBuilderPage, ProfilePage, EditProfileForm, InitialSyncGate, NostrSync
2026-02-26 14:46:30 -06:00
Alex Gleason 8b98154361 Add dynamic Google Font picker for per-user custom base font
Loads any Google Font on demand, applies it site-wide via injected
stylesheet, and persists the selection in localStorage. Available
in Settings > Theme alongside the existing color theme selector.
2026-02-26 12:57:05 -06:00
Alex Gleason 1a17a3a068 Show pencil icon on color swatches always, not just on hover 2026-02-26 11:59:13 -06:00
Alex Gleason 970c0119b1 Replace hint text with pencil overlay on color swatches for intuitive editability 2026-02-26 11:53:59 -06:00
Alex Gleason 1c8761440c Improve theme color editor discoverability with circle swatches and hint text 2026-02-26 11:51:15 -06:00
Alex Gleason 3e46966457 Add interaction buttons to threaded ancestor posts in thread view 2026-02-26 11:45:49 -06:00
Alex Gleason 30328c77d4 Add relay hints to kind 1 posts we create 2026-02-26 11:16:00 -06:00
Chad Curtis 1dd795845e fix: remove unused variables to resolve ESLint errors 2026-02-26 06:51:49 -06:00
Chad Curtis d42ca5f300 feat: add 'Set as theme' button to color moment palettes with WCAG-enforced color mapping 2026-02-26 06:10:33 -06:00
Chad Curtis 01e190476b fix: theme page mobile layout, remove white from quick theme toggle, use SwatchBook icon for theme nav item 2026-02-26 06:02:39 -06:00
Chad Curtis 82b465836b feat: split search and trends into separate pages, prefill accounts with follows, hide bottom nav items from mobile drawer 2026-02-26 05:57:26 -06:00
Chad Curtis ea3c488918 fix: always show edit sidebar in more menu, hide divider when no hidden items 2026-02-26 05:46:00 -06:00
Chad Curtis 04b601c646 feat: rename lavender preset to white, place before black 2026-02-26 05:43:04 -06:00
Chad Curtis 7f0614f36a feat: primary-colored active nav links, primary-tinted borders, lavender as default light theme 2026-02-26 05:41:21 -06:00
Chad Curtis 8e5b59c44e feat: use planet icon for feed nav item 2026-02-26 05:37:19 -06:00
Chad Curtis 79c143fab1 fix: replace image URLs with newline in disableEmbeds preview mode 2026-02-26 05:37:01 -06:00
Chad Curtis 0576775a57 fix: suppress image URLs in triple-dot menu post preview
When disableEmbeds is true, image-embed tokens now return null instead of
rendering the raw URL as a link. This fixes the triple-dot (more menu)
preview showing bare blossom/image URLs instead of clean post text.
2026-02-26 05:36:27 -06:00
Chad Curtis 6f5a07c0a9 Render images inline at their position in post content
- Images now render inline via NoteContent at the position of their URL
  rather than collected into a gallery block below the text
- Clicking an inline image opens a full lightbox with navigation across
  all images in the post; lightbox index is tracked by position so
  duplicate URLs open at the correct index
- Removed separate ImageGallery/extractImages from NoteCard,
  PostDetailPage, and ComposeBox to prevent double-rendering
- Added disableEmbeds to NoteMoreMenu clamped preview to avoid block
  embeds inside a line-clamp-3 container
- Fixed hasPreviewableContent in ComposeBox to detect image-only posts
  so the Preview tab appears correctly
- Removed mp3/ogg/wav/pdf from MEDIA_URL_REGEX suppression list; those
  URLs now render as clickable links instead of being silently dropped
- Added avif to IMAGE_URL_REGEX; added cursor-pointer to InlineImage
2026-02-26 04:35:03 -06:00
Alex Gleason f5ee5f0d02 Nudge notification dot upward in mobile bottom nav 2026-02-26 04:18:46 -06:00
Alex Gleason 65fe8bdabf Nudge notification dot slightly upward in sidebar 2026-02-26 04:16:49 -06:00