Repository navigation
Support multiple templates, a templates list and a sent emails log - #63
Merged
Merged
Conversation
The sandboxed iframe (sandbox="", no referrer, srcdoc) moves into its own component. The preview keeps its height; the frame's border and white background move with it.
Syncs src/api with the backend's multi-template contract. Tree, elements and generate calls take the template id first and go to /templates/:templateId/...; new client functions cover templates, sending and the sent-emails log. The editor moves to /templates/[id] and passes the id to the tree, the elements panel, the AI tools and the chat (remounted per template, so a chat never spans two templates). The home page redirects to /templates. E2E specs open /templates/t1.
/templates lists the templates in a table: the name opens the editor, and each row can be renamed or deleted (with confirmation). "New template" asks for a name, creates it and opens it. With no templates the table offers to create the first one. The sidebar now has Templates and Sent emails; the current section is highlighted from the path (the editor counts as Templates). The disabled "coming soon" entry and the separate Editor item are gone.
A table of sent emails, newest first: when, template, recipients (three, then +N), subject
and status ("Logged": delivery is not configured yet). The template column filters on the
client. The subject or the row opens a drawer that loads the email and shows its HTML in the
same sandboxed EmailFrame as the editor's preview.
The editor loads the template for its heading, with a link back to the list. A template that does not exist (404 from the template or its tree) shows "Template not found" instead of error toasts. "Send email" (disabled while the tree is empty) opens a dialog for recipients (tags, checked as email addresses, at most 50) and a subject prefilled with the template's name. Sending records the email in the log; the success message says delivery is not configured yet and links to Sent emails.
clearOnDestroy cleared the form on StrictMode's simulated unmount, after initialValues had been applied, so in next dev the rename dialog opened empty and the subject was blank. The dialogs are destroyed when hidden and own their form store, so each opening starts fresh without it. Tests now render these dialogs in StrictMode. Also use Select's suffix prop (suffixIcon is deprecated in antd 6).
templates.spec: / redirects to the list, a new template opens in the editor with its name, and an unknown template shows "Template not found". sent.spec: Send email from the editor, then open the log from the success message and view the email in its sandboxed frame.
…late API AGENTS.md: directory map (app routes, src/templates, src/sent, SendEmailModal, EmailFrame, e2e/backend.ts), client components, the backend routes under /templates/:templateId and /sent-emails. docs/AI_AGENT.md: pages, data flow with templateId, file roles, one chat per template. README: the three pages, diagrams and layout. Skills and docs/playwright.md: how to mock the API in unit and e2e tests now.
The new pages, dialogs and API functions come with tests: statements 84.9 → 90.1 %, branches 77.6 → 79.5 %, functions 80.5 → 88.4 %, lines 86.6 → 91.8 %.
The template name and back link now share a row with the toolbar, so the preview height (calc(100vh - 160px)) is right again and the editor column no longer scrolls for the header. Padding and the header gap are shared variables for all pages. The 404 page offers a primary Back to templates button.
Tables scroll inside their own container on narrow screens, row actions are small link buttons, the status tag explains that nothing was delivered, the drawer lists every recipient as a tag, and the send dialog says delivery is not configured.
5 tasks done
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/now redirects to the templates list:/templateslists the templates and lets you create, rename and delete them./templates/[id]is the editor for one template. It shows the template's name and a "Send email" button. An unknown id shows "Template not found"./sentis the log of sent emails. You can filter it by template, and clicking a row opens the email in a drawer, rendered in a sandboxedEmailFrame.templateId.listTemplates,createTemplate,getTemplate,renameTemplate,deleteTemplate,sendEmail,listSentEmails,getSentEmail.PreviewintoEmailFrame. Both the preview and the sent-emails drawer use it.templates.spec.tsandsent.spec.ts. The coverage thresholds went up. AGENTS.md, docs/AI_AGENT.md, README and the skills are updated.Why
The editor supported only one template. Now you can keep several templates, see them in a list, and see the emails you sent. Real delivery (SMTP) is out of scope; for now, sending only adds an entry to the log.
Depends on LLazyEmail/email-template-editor-nodejs#7, which moves the routes under
/templates/:templateId. Merge the backend first, then runnpm run api:syncto confirmsrc/api/openapi.jsonmatches the backend'smain.How to verify
npm run lint,npm run typecheck,npm run format:check,npm run test:coverage(149 tests),npm run buildandnpm run test:e2e(16/16) all pass.db.json:/sent, and the drawer renders the HTML.Checklist
npm run lint,npm run typecheck,npm run format:checkpassnpm run test:coveragepasses; new behavior has a testnpm run test:e2epasses if a user flow changedsrc/security/contentSecurityPolicy.ts), if any (none, same backend origin)AGENTS.md,docs/AI_AGENT.mdor a skill updated if conventions or file layout changed