Files
warmbly/internal/notify/templates/welcome.go
T
Matthew Meszaros f04bd26b44 feat: comprehensive unibox + WS latency + dashboard-style transactional emails
User: "inbox is really really bad. So I want all possible ways to
search for an email that we can do... realtime for everything and the
dashboard to show our latency... show how much unread emails." Plus a
follow-up: "I don't like how the emails looks like because they have
that blue gradient, I want dashboard style good one."

Inbox:
- Wired the backend search endpoint (GET /unibox with from/subject/
  unseen/since/until/cursor/limit) — was implemented server-side but
  the frontend was never calling it. Inbox now actually reflects
  server data.
- New UniboxSearchParams model + searchIncoming client + infinite
  useUniboxSearch hook that drops null rows defensively.
- ConversationList: SearchInput (subject substring) + quick-filter
  strip (All / Unread / Today / This week). Unread count surfaces
  in the SectionBar header AND on the Unread chip. Skeleton +
  explicit error block with retry; "Load more · N shown" when more
  pages are available.
- UniboxFilterSheet (advanced filters in the right-side panel):
  free-text query, sender substring, account picker pulled from
  the user's connected mailboxes, status toggle (Any/Unread/Read),
  since/until date pickers with toggle, newest/oldest sort. Draft
  state mirrors parent until Apply.

LivePanel telemetry (sidebar):
- Real WS roundtrip latency. SocketProvider stamps performance.now()
  per heartbeat ref; phoenix phx_reply with that ref computes the
  delta and publishes via setWsLatencyMs. LivePanel colour-codes
  the latency text: <100ms emerald, <300ms amber, ≥300ms red, "—"
  when disconnected.
- Unread count row reads from useAppStore.unseenCount.
- Status label: OFFLINE / CONNECTING / LIVE (with pulse) / IDLE,
  tied to connectionStatus + active mailbox count.

Transactional emails (no more blue gradient):
- base.go rewritten as dashboard chrome: cream #f5f6f8 background,
  white card with hairline #e2e8f0 border, 8px radius, slate-900
  text. Logo monogram in slate, no decorative haze, no gradients.
- login_code / registration_code: tiny uppercase eyebrow + 18px
  bold heading + neutral body + monospace code pill in a hairline-
  bordered box. No serif type.
- reset_password / welcome: same chrome. Slate-900 primary button
  replaces the sky-gradient one. Plaintext link below for accessible
  fallback.
- Template tests updated against the new markup; all green.
2026-05-23 10:07:11 +00:00

76 lines
3.7 KiB
Go

package templates
import (
"bytes"
"html/template"
"github.com/getsentry/sentry-go"
)
// Welcome template — also moved onto the shared base shell so it
// matches the dashboard chrome instead of the old standalone HTML
// with its blue gradients and big blue button.
const welcomeContent = `
<p style="margin:0 0 4px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:11px;color:#94a3b8;letter-spacing:0.14em;text-transform:uppercase;font-weight:500;">
Welcome
</p>
<h2 style="margin:0 0 12px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-weight:600;font-size:20px;color:#0f172a;letter-spacing:-0.01em;">
{{if .FirstName}}Hi {{.FirstName}}, welcome to Warmbly{{else}}Welcome to Warmbly{{end}}
</h2>
<p style="margin:0 0 16px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:13px;color:#475569;line-height:20px;">
Your account is ready. From here you can connect mailboxes, warm them up, and start outbound campaigns — all in one place.
</p>
<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="margin:0 0 20px;width:100%;">
<tr><td style="padding:6px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:13px;color:#0f172a;line-height:20px;">
&middot;&nbsp; Connect Gmail, Outlook, or any SMTP/IMAP inbox
</td></tr>
<tr><td style="padding:6px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:13px;color:#0f172a;line-height:20px;">
&middot;&nbsp; Automated warmup so your mail lands in primary
</td></tr>
<tr><td style="padding:6px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:13px;color:#0f172a;line-height:20px;">
&middot;&nbsp; Sequences with scheduling, replies, opens, clicks
</td></tr>
<tr><td style="padding:6px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:13px;color:#0f172a;line-height:20px;">
&middot;&nbsp; Unified inbox across every mailbox
</td></tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" align="center" role="presentation" style="margin:0 0 24px;">
<tr>
<td align="center" style="border-radius:6px;background:#0f172a;">
<a href="https://app.warmbly.com/" target="_blank" style="display:inline-block;padding:10px 22px;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:13px;font-weight:600;color:#ffffff;text-decoration:none;letter-spacing:0.01em;">Open the dashboard</a>
</td>
</tr>
</table>
<div style="margin:0 0 16px;height:1px;background:#e2e8f0;"></div>
<p style="margin:0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:12px;color:#64748b;line-height:18px;">
Need help? Reply to this email or hit the support channel from your dashboard.
</p>
`
var welcomeTmpl = template.Must(template.New("welcome_content").Parse(welcomeContent))
// GenerateWelcomeHTML renders the welcome email through the shared
// base shell so styling stays consistent with the rest of the
// transactional mail.
func GenerateWelcomeHTML(firstName string) (string, error) {
data := struct{ FirstName string }{FirstName: firstName}
var buf bytes.Buffer
if err := welcomeTmpl.Execute(&buf, data); err != nil {
sentry.CaptureException(err)
return "", err
}
return renderEmail("Welcome to Warmbly", buf.String())
}
// WelcomeTemplate / WelcomeHTMLTMPL retained as deprecated exports so
// any external caller importing them still compiles. New code should
// call GenerateWelcomeHTML instead.
const WelcomeTemplate = welcomeContent
var WelcomeHTMLTMPL = welcomeTmpl