MA
Feat/shadcn themes
Mail-0/Zero#912

Description

This pull request introduces a custom theming system, fulfilling the requirements outlined in /claim #883.

Users can now create, customize, manage, and apply detailed themes to personalize their mail client experience via the /settings/themes page. Themes are persisted to the database and can be applied to the active connection. When a connection is active, its associated theme (if any) is loaded automatically.

Key features include:

  • Database schema and server actions for theme CRUD operations, user/connection association, and public sharing status.
  • A theme editor with live preview for customizing colors, fonts, spacing, shadows, corner radius, and backgrounds (color, gradient, image).
  • A management UI to view, create, edit, delete, and apply themes.
  • A CustomThemeProvider to dynamically load themes and inject CSS variables.
  • Several preset themes (Light, Dark, Sunset Horizon, Cyberpunk, Amber Minimal, Amethyst Haze, Bold Tech, Bubblegum, Caffeine) with light/dark variants, addable via a button in settings.
  • Fixes for previous issues where UI elements (main layout, sidebar, compose button/dialog, mail panels) did not respect theme changes.
  • Resolution of client-side build errors related to server-only code imports.

Type of Change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature with breaking changes)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • 🔒 Security enhancement
  • ⚡ Performance improvement

Areas Affected

Please check all that apply:

  • Email Integration (Gmail, IMAP, etc.)
  • User Interface/Experience
  • Authentication/Authorization (Server actions check session)
  • Data Storage/Management (New theme table, ThemeSettings type)
  • API Endpoints (Via Next.js Server Actions)
  • Documentation
  • Testing Infrastructure
  • Development Workflow
  • Deployment/Infrastructure

Testing Done

Describe the tests you’ve done:

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed:
    • Verified theme creation, editing (with live preview), and deletion in /settings/themes.
    • Tested applying various themes (presets, custom, light/dark) and confirmed immediate UI updates for sidebar, main mail layout, mail list/view panels, compose button/dialog.
    • Confirmed “Add Preset Themes” button adds missing themes correctly.
    • Tested theme persistence across page reloads/sessions.
    • Verified “Reset to Default” functionality.
    • Confirmed build errors related to tls are resolved.
  • Cross-browser testing (if UI changes) - (Please specify browsers tested if applicable)
  • Mobile responsiveness verified (if UI changes) - (Theme settings page/editor might need specific mobile testing)

Security Considerations

For changes involving data or authentication:

  • No sensitive data is exposed (Theme settings are generally cosmetic)
  • Authentication checks are in place (Server actions verify user session before performing theme operations)
  • Input validation is implemented (Basic validation via types, further sanitization might be needed for image URLs/gradients)
  • Rate limiting is considered (if applicable) - (Not implemented, potentially needed for public theme creation/sharing)

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project’s style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in complex areas
  • I have updated the documentation - (Documentation needs update for the new theme system)
  • My changes generate no new warnings
  • I have added tests that prove my fix/feature works - (No automated tests added)
  • All tests pass locally - (Assuming manual tests pass)
  • Any dependent changes are merged and published

Additional Notes

  • This implementation adds theme selection/application primarily through the /settings/themes page for the active connection. The original requirement to add theme selection directly to the connection setup screen is not included here and could be a separate enhancement.
  • The system currently uses general theme colors (muted, accent, etc.) for the sidebar. If independent sidebar theming is desired in the future, the ThemeSettings schema and CustomThemeProvider will need updates to handle specific --sidebar-* variables.

Screenshots/Recordings

https://github.com/user-attachments/assets/23d7d5a4-c984-412e-b377-e3112fc67adc


By submitting this pull request, I confirm that my contribution is made under the terms of the project’s license.

Claim

Total prize pool $750
Total paid $0
Status Pending
Submitted May 08, 2025
Last updated May 08, 2025

Contributors

UM

umar

@umarhadi

100%

Sponsors

ZE

Zero

@Mail-0

$750