feat(office): mail preview, infinite scroll, pane resize, and scrollbars
Release Please / Release Please (push) Skipped
Tests / Test (Go 1.22) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Release / GoReleaser (push) Failing after 38s
Release Please / Release Please (push) Skipped
Tests / Test (Go 1.22) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Release / GoReleaser (push) Failing after 38s
Polish the office TUI with proportional pane layout, drag resize, live filtering, HTML mail preview, paginated mail lists, overflow scrollbars, flattened navigation, and project save/status fixes; add UpdateProjectStatus. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package fetch
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/eslider/go-onlyoffice/cmd/office/model"
|
||||
)
|
||||
|
||||
// CalendarItemFields maps calendar API rows to list items.
|
||||
var CalendarItemFields = FieldMap{IDKey: "objectId", TitleKey: "title"}
|
||||
|
||||
// CalendarItemsFromRows converts API calendar/event rows into list items.
|
||||
func CalendarItemsFromRows(rows []map[string]any) []model.Item {
|
||||
out := make([]model.Item, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
kind, typeLabel := model.ClassifyCalendarRow(row)
|
||||
title := str(row, "title")
|
||||
if title == "" {
|
||||
title = str(row, "name")
|
||||
}
|
||||
if title == "" {
|
||||
title = "(untitled)"
|
||||
}
|
||||
raw := make(map[string]any, len(row)+1)
|
||||
for k, v := range row {
|
||||
raw[k] = v
|
||||
}
|
||||
raw["type"] = typeLabel
|
||||
out = append(out, model.Item{
|
||||
ID: idStr(row, "objectId"),
|
||||
Title: title,
|
||||
Kind: kind,
|
||||
Raw: raw,
|
||||
})
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// ListCalendar returns calendars and events for the upcoming date window.
|
||||
func (l *Loader) ListCalendar(ctx context.Context) ([]model.Item, error) {
|
||||
if l == nil || l.Client == nil {
|
||||
return nil, fmt.Errorf("fetch: client is nil")
|
||||
}
|
||||
start := time.Now().AddDate(0, 0, -7).Format("2006-01-02")
|
||||
end := time.Now().AddDate(0, 0, 30).Format("2006-01-02")
|
||||
rows, err := l.Client.ListCalendars(ctx, start, end)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return CalendarItemsFromRows(rows), nil
|
||||
}
|
||||
Reference in New Issue
Block a user