- commit
- 7e3add8
- parent
- 47c2cad
- author
- Eric Bower
- date
- 2024-05-18 03:07:19 +0000 UTC
chore: use consistent date fmt
6 files changed,
+18,
-10
+5,
-0
1@@ -0,0 +1,5 @@
2+package common
3+
4+import "time"
5+
6+var DateFormat = time.DateOnly
1@@ -112,21 +112,18 @@ func (m Model) bioView() string {
2 username = m.shared.Styles.Subtle.Render("(none set)")
3 }
4
5- plus := "No"
6 expires := ""
7 if m.shared.PlusFeatureFlag != nil {
8- plus = "Yes"
9- expires = m.shared.PlusFeatureFlag.ExpiresAt.Format("02 Jan 2006")
10+ expires = m.shared.PlusFeatureFlag.ExpiresAt.Format(common.DateFormat)
11 }
12
13 vals := []string{
14 "Username", username,
15- "Joined", m.shared.User.CreatedAt.Format("02 Jan 2006"),
16- "Pico+", plus,
17+ "Joined", m.shared.User.CreatedAt.Format(common.DateFormat),
18 }
19
20 if expires != "" {
21- vals = append(vals, "Pico+ Expires At", expires)
22+ vals = append(vals, "Pico+ Expires", expires)
23 }
24
25 return common.KeyValueView(m.shared.Styles, vals...)
+1,
-1
1@@ -85,7 +85,7 @@ type styledKey struct {
2 }
3
4 func (m Model) newStyledKey(styles common.Styles, key *db.PublicKey, active bool) styledKey {
5- date := key.CreatedAt.Format("02 Jan 2006")
6+ date := key.CreatedAt.Format(common.DateFormat)
7 fp, err := FingerprintSHA256(styles, key)
8 if err != nil {
9 fp = Fingerprint{Value: "[error generating fingerprint]"}
+1,
-1
1@@ -129,7 +129,7 @@ func (m Model) featuresView() string {
2 row := []string{
3 feature.Name,
4 fmt.Sprintf("%.2f", storeMax),
5- feature.ExpiresAt.Format("2006-01-02"),
6+ feature.ExpiresAt.Format(common.DateFormat),
7 }
8 data = append(data, row)
9 }
+1,
-1
1@@ -18,7 +18,7 @@ type styledKey struct {
2 }
3
4 func newStyledKey(styles common.Styles, token *db.Token, active bool) styledKey {
5- date := token.CreatedAt.Format("02 Jan 2006")
6+ date := token.CreatedAt.Format(common.DateFormat)
7
8 // Default state
9 return styledKey{
+7,
-1
1@@ -154,10 +154,16 @@ func (m *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
2 }
3
4 func (m *UI) header() string {
5+ logoTxt := "pico.sh"
6+ ff := m.shared.PlusFeatureFlag
7+ if ff != nil && ff.IsValid() {
8+ logoTxt = "pico+"
9+ }
10+
11 logo := m.shared.
12 Styles.
13 Logo.
14- SetString("pico.sh")
15+ SetString(logoTxt)
16 title := m.shared.
17 Styles.
18 Note.