-
Notifications
You must be signed in to change notification settings - Fork 428
Email themes UI fixes #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements significant changes to the email themes UI and its underlying architecture. The key changes include:
- Migration from role-based thread messages to a more flexible message format by removing the ThreadMessageRole enum and role column
- Implementing proper message persistence with new save/load functionality
- Improving the email theme preview system with better async handling and loading states
- Enhancing the UI with a new grid-based theme selection layout and improved navigation
- Adding support for raw HTML rendering in email previews
- Implementing proper chat message history and tool call handling
These changes collectively improve the email themes system's robustness and user experience, particularly around theme previews and AI assistant interactions.
Confidence score: 3 /5
- This PR is moderately safe to merge but requires careful testing of the chat and preview functionality
- The score is 3 because while most changes are well-structured, the removal of ThreadMessageRole is a breaking change that could affect existing data
- Files needing attention:
- apps/backend/prisma/migrations/20250715181353_remove_msg_role/migration.sql (data loss risk)
- apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/email-templates/[type]/new/page.tsx (type safety issues)
18 files reviewed, 12 comments
Edit PR Review Bot Settings | Greptile
packages/template/src/lib/stack-app/apps/interfaces/admin-app.ts
Outdated
Show resolved
Hide resolved
packages/template/src/lib/stack-app/apps/interfaces/admin-app.ts
Outdated
Show resolved
Hide resolved
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/email-themes/page-client.tsx
Show resolved
Hide resolved
...ashboard/src/app/(main)/(protected)/projects/[projectId]/email-templates/[type]/new/page.tsx
Outdated
Show resolved
Hide resolved
...ashboard/src/app/(main)/(protected)/projects/[projectId]/email-templates/[type]/new/page.tsx
Outdated
Show resolved
Hide resolved
✨ No issues found! Your code is sparkling clean! ✨ 🗒️ View all ignored comments in this repo
Need help? Join our Discord for support! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing to add besides the AI changes!
https://www.loom.com/share/b43b8fc7dfc947ab88d3cf709d2a167e?sid=d6e635ce-ab0f-4e86-887b-373632996cea <!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Refactor vibe coding components and add basic email template configurations, including new components and schema updates. > > - **Email Templates**: > - Adds `route.tsx` in `api/latest/internal/email-templates` to handle GET requests for email templates. > - Introduces `useNewEmailTemplates()` in `admin-app-impl.ts` to fetch new email templates. > - Adds `listInternalEmailTemplatesNew()` in `admin-interface.ts` to list new email templates. > - **Components**: > - Adds `VibeCodeEditor`, `VibePreviewPanel`, `VibeAssistantChat`, and `VibeCodeEditorLayout` in `vibe-coding` for email template editing and preview. > - Refactors `page-client.tsx` in `email-templates-new` to use new components for template editing. > - Updates `page-client.tsx` in `email-themes` to use new vibe coding components. > - **Schema and Config**: > - Adds `emailTemplateListSchema` in `schema-fields.ts` for email template validation. > - Updates `emails.ts` to include `DEFAULT_EMAIL_TEMPLATES`. > - Modifies `schema.ts` to include `templateList` in email configurations. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for 18fdae9. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> --------- Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
apps/backend/src/app/api/latest/auth/password/sign-up/route.tsx
Outdated
Show resolved
Hide resolved
This reverts commit a887d05.
https://www.loom.com/share/acaea08979274fc194357a5359f0938a?sid=6b5a2ac0-1f87-4311-8b40-0c2e22cd965d <!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > This PR adds support for email templates, refactors chat handling, and updates UI components for enhanced email and chat functionalities. > > - **Behavior**: > - Adds support for rendering emails with either `theme_id` or `template_id` in `render-email/route.tsx`. > - Introduces `ai-chat/[threadId]/route.tsx` for handling chat messages with context types `email-theme` and `email-template`. > - Adds PATCH and GET routes for `email-templates/[templateId]/route.tsx` to update and retrieve email templates. > - **Adapters**: > - Adds `emailTemplateAdapter` and `emailThemeAdapter` in `adapter-registry.ts` for chat context handling. > - Implements `renderEmailWithTemplate` in `email-themes.tsx` for rendering emails with templates. > - **UI Components**: > - Updates `page-client.tsx` for email templates and themes to use `VibeCodeLayout` with `AssistantChat` and `CodeEditor`. > - Adds `ThemePreview` component to handle email preview rendering with error boundaries. > - **Misc**: > - Renames `OPENAI_API_KEY` to `STACK_OPENAI_API_KEY` in `.env.development`. > - Refactors `chat-adapters.ts` to handle tool calls and chat message history. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for df210b8. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> --------- Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
https://www.loom.com/share/7947d3baf6664b298a5e04214b37c11e
Important
This PR updates email themes and templates, including UI enhancements, backend API routes, and database schema changes, to improve email customization capabilities.
role
column fromThreadMessage
table and dropThreadMessageRole
enum inmigration.sql
.GET
route inemail-templates/route.tsx
to fetch email templates.GET
,PATCH
, andPOST
routes inemail-themes/[id]/route.tsx
andemail-themes/chat/route.tsx
for email theme management.vibe-coding
for email template and theme editing, includingVibeCodeEditor
,VibeAssistantChat
, andVibePreviewPanel
.email-templates-new
andemail-themes
pages to use new components for editing and previewing.schema.prisma
to removeThreadMessageRole
enum.emailTemplateListSchema
toschema-fields.ts
for email template validation.config/schema.ts
to includetemplateList
in email configuration.helpers/emails.ts
.admin-interface.ts
andadmin-app-impl.ts
to support new email template and theme functionalities.This description was created by
for 6fb7614. You can customize this summary. It will automatically update as commits are pushed.