package modules import ( "strings" "uberbringer/internal/pkg/receipt" ) // fallback is the plain receipt Card returns when laying out a card goes // wrong: the title in bold, the message as written, then the topic and // time, each cut to the notice limits. func fallback(n Notice, env Env) receipt.Job { elements := []receipt.Element{{Type: receipt.TypeText, Text: noticeTitle(n, receipt.StripEmoji), Bold: true}} if message := strings.TrimSpace(receipt.StripEmoji(cutBytes(n.Message, MaxMessage))); message != "" { elements = append(elements, receipt.Element{Type: receipt.TypeText, Text: message}) } stamp := env.Format(n.Time) if topic := cut(strings.TrimSpace(receipt.StripEmoji(n.Topic)), MaxTopic); topic != "" { stamp = topic + " ยท " + stamp } elements = append(elements, receipt.Element{Type: receipt.TypeText, Text: stamp}) return receipt.Job{Elements: elements} }