1// email_view is a small helper that renders a mock email with inline images
2// for screenshot generation. It creates a bubbletea program displaying a
3// realistic HTML email using the real EmailView component.
4package main
5
6import (
7 "fmt"
8 "os"
9 "time"
10
11 tea "charm.land/bubbletea/v2"
12 "github.com/floatpane/matcha/fetcher"
13 "github.com/floatpane/matcha/tui"
14)
15
16func main() {
17 email := fetcher.Email{
18 UID: 1001,
19 From: "Sarah Chen <sarah.chen@example.com>",
20 To: []string{"team@example.com"},
21 Subject: "New Dashboard Redesign - Preview & Feedback",
22 Date: time.Now().Add(-2 * time.Hour),
23 MessageID: "<dashboard-redesign-001@example.com>",
24 AccountID: "demo-user",
25 Body: `<html>
26<body>
27<h1>Dashboard Redesign Preview</h1>
28
29<p>Hi team,</p>
30
31<p>I'm excited to share the <b>new dashboard redesign</b> we've been working on!
32Here's a quick overview of the changes:</p>
33
34<h2>What's New</h2>
35
36<ul>
37<li><b>Simplified navigation</b> - We reduced sidebar items from 12 to 6</li>
38<li><b>Dark mode support</b> - Full theme switching with system preference detection</li>
39<li><b>Real-time updates</b> - WebSocket integration for live data refresh</li>
40<li><b>Responsive layout</b> - Optimized for mobile, tablet, and desktop</li>
41</ul>
42
43<h2>Screenshots</h2>
44
45<p>Here's the new main view:</p>
46<img src="cid:dashboard-main" alt="Dashboard main view" />
47
48<p>And the analytics panel:</p>
49<img src="cid:analytics-panel" alt="Analytics panel with charts" />
50
51<h2>Next Steps</h2>
52
53<ol>
54<li>Review the mockups above</li>
55<li>Leave comments in the <a href="https://figma.com/file/example">Figma file</a></li>
56<li>Join the feedback session on <b>Thursday at 3pm</b></li>
57</ol>
58
59<p>Looking forward to your thoughts!</p>
60
61<p>Best,<br/>
62Sarah</p>
63</body>
64</html>`,
65 Attachments: []fetcher.Attachment{
66 {
67 Filename: "dashboard-mockup.png",
68 MIMEType: "image/png",
69 Inline: false,
70 },
71 {
72 Filename: "analytics-export.csv",
73 MIMEType: "text/csv",
74 Inline: false,
75 },
76 },
77 }
78
79 ev := tui.NewEmailView(email, 0, 140, 45, tui.MailboxInbox, true)
80
81 p := tea.NewProgram(ev)
82 if _, err := p.Run(); err != nil {
83 fmt.Fprintf(os.Stderr, "Error: %v\n", err)
84 os.Exit(1)
85 }
86}