feat: 收件箱功能新增按回车查看详情面板
- 添加邮件详情面板显示(主题、发件人、收件人、抄送、账户、时间、正文) - 优化邮件列表卡片样式,增加选中高亮效果 - 窗口宽度 >= 80 时启用双面板布局,左侧列表右侧详情 - 简化依赖包,从 charm.land 使用统一导入路径 - 删除未使用的 golangci/goreleaser 配置文件
This commit is contained in:
21
inbox.go
21
inbox.go
@@ -3,13 +3,32 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/charmbracelet/bubbletea"
|
||||
"charm.land/bubbletea/v2"
|
||||
"github.com/charmbracelet/pop/inbox"
|
||||
)
|
||||
|
||||
func runInbox(days int) error {
|
||||
m := inbox.NewInboxModel()
|
||||
m.SetLoading(true)
|
||||
m.SetDetailFetcher(func(accountID string, uid uint32) (*inbox.EmailDetail, error) {
|
||||
detail, err := FetchEmailDetailByUID(accountID, uid)
|
||||
if err != nil || detail == nil {
|
||||
return nil, err
|
||||
}
|
||||
return &inbox.EmailDetail{
|
||||
UID: detail.UID,
|
||||
From: detail.From,
|
||||
FromName: detail.FromName,
|
||||
To: detail.To,
|
||||
Cc: detail.Cc,
|
||||
Subject: detail.Subject,
|
||||
Date: detail.Date,
|
||||
TextBody: detail.TextBody,
|
||||
HTMLBody: detail.HTMLBody,
|
||||
Account: detail.Account,
|
||||
AccountID: detail.AccountID,
|
||||
}, nil
|
||||
})
|
||||
|
||||
emails, err := FetchAllUnreadEmails(days)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user