Add date to message viewer

This commit is contained in:
Drew DeVault 2019-06-02 10:23:53 -04:00
parent 753adb9069
commit 7d1770754f
2 changed files with 11 additions and 5 deletions

View file

@ -60,7 +60,7 @@ func NewMessageViewer(acct *AccountView, conf *config.AercConfig,
store *lib.MessageStore, msg *types.MessageInfo) *MessageViewer {
grid := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, 3}, // TODO: Based on number of header rows
{ui.SIZE_EXACT, 4}, // TODO: Based on number of header rows
{ui.SIZE_WEIGHT, 1},
}).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, 1},
@ -71,6 +71,7 @@ func NewMessageViewer(acct *AccountView, conf *config.AercConfig,
{ui.SIZE_EXACT, 1},
{ui.SIZE_EXACT, 1},
{ui.SIZE_EXACT, 1},
{ui.SIZE_EXACT, 1},
}).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, 1},
{ui.SIZE_WEIGHT, 1},
@ -85,12 +86,17 @@ func NewMessageViewer(acct *AccountView, conf *config.AercConfig,
Name: "To",
Value: formatAddresses(msg.Envelope.To),
}).At(0, 1)
headers.AddChild(
&HeaderView{
Name: "Date",
Value: msg.Envelope.Date.Format("Mon Jan 2, 2006 at 3:04 PM"),
}).At(1, 0).Span(1, 2)
headers.AddChild(
&HeaderView{
Name: "Subject",
Value: msg.Envelope.Subject,
}).At(1, 0).Span(1, 2)
headers.AddChild(ui.NewFill(' ')).At(2, 0).Span(1, 2)
}).At(2, 0).Span(1, 2)
headers.AddChild(ui.NewFill(' ')).At(3, 0).Span(1, 2)
var err error
switcher := &PartSwitcher{}

View file

@ -1,14 +1,14 @@
package widgets
import (
"git.sr.ht/~sircmpwn/aerc/worker/types"
"git.sr.ht/~sircmpwn/aerc/lib"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
"git.sr.ht/~sircmpwn/aerc/worker/types"
)
type ProvidesMessage interface {
ui.Drawable
Store() *lib.MessageStore
Store() *lib.MessageStore
SelectedMessage() *types.MessageInfo
SelectedAccount() *AccountView
}