mirror of
				https://github.com/taigrr/wtf
				synced 2025-01-18 04:03:14 -08:00 
			
		
		
		
	Grey out past calendar event descriptions
This commit is contained in:
		
							parent
							
								
									b0184bca2d
								
							
						
					
					
						commit
						57b0e96d64
					
				@ -22,9 +22,7 @@ func Widget() tview.Primitive {
 | 
				
			|||||||
		ts, _ := time.Parse(time.RFC3339, item.Start.DateTime)
 | 
							ts, _ := time.Parse(time.RFC3339, item.Start.DateTime)
 | 
				
			||||||
		timestamp := ts.Format("Mon Jan _2 15:04:05 2006")
 | 
							timestamp := ts.Format("Mon Jan _2 15:04:05 2006")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		color := colorize(item, ts)
 | 
							str := fmt.Sprintf(" [%s]%s[white]\n [%s]%s[white]\n\n", titleColor(item), item.Summary, descriptionColor(item), timestamp)
 | 
				
			||||||
 | 
					 | 
				
			||||||
		str := fmt.Sprintf(" [%s]%s[white]\n %s\n\n", color, item.Summary, timestamp)
 | 
					 | 
				
			||||||
		data = data + str
 | 
							data = data + str
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -33,7 +31,9 @@ func Widget() tview.Primitive {
 | 
				
			|||||||
	return widget
 | 
						return widget
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func colorize(item *calendar.Event, ts time.Time) string {
 | 
					func titleColor(item *calendar.Event) string {
 | 
				
			||||||
 | 
						ts, _ := time.Parse(time.RFC3339, item.Start.DateTime)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	color := "red"
 | 
						color := "red"
 | 
				
			||||||
	if strings.Contains(item.Summary, "1on1") {
 | 
						if strings.Contains(item.Summary, "1on1") {
 | 
				
			||||||
		color = "green"
 | 
							color = "green"
 | 
				
			||||||
@ -45,3 +45,15 @@ func colorize(item *calendar.Event, ts time.Time) string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return color
 | 
						return color
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func descriptionColor(item *calendar.Event) string {
 | 
				
			||||||
 | 
						ts, _ := time.Parse(time.RFC3339, item.Start.DateTime)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						color := "white"
 | 
				
			||||||
 | 
						if ts.Before(time.Now()) {
 | 
				
			||||||
 | 
							color = "grey"
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return color
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user