Compare commits

...

2 Commits

4 changed files with 11 additions and 17 deletions

15
feed.go
View File

@ -30,7 +30,7 @@ func getActivityFeed() []Activity {
feed := []Activity{} feed := []Activity{}
for _, server := range config.servers { for _, server := range config.servers {
client := Servers[server.servername] client := Servers[server.servername]
resp, err := http.Get(fmt.Sprintf("%s/api/v1/users/%s/activities/feeds?limit=10&page=1", resp, err := http.Get(fmt.Sprintf("%s/api/v1/users/%s/activities/feeds?limit=15&page=1",
server.url, server.url,
server.username, server.username,
)) ))
@ -52,17 +52,6 @@ func getActivityFeed() []Activity {
fmt.Println("Error getting user: "+fmt.Sprint(err)) fmt.Println("Error getting user: "+fmt.Sprint(err))
continue continue
} }
// repo, _, err := client.GetRepo(
// obj["repo"].
// (map[string]interface{})["name"].(string),
// obj["repo"].
// (map[string]interface{})["owner"].
// (map[string]interface{})["login"].(string),
// )
// if err != nil {
// fmt.Println("Failed to get repository: "+fmt.Sprint(err))
// continue
// }
var comment gitea.Comment var comment gitea.Comment
if obj["comment"] != nil { if obj["comment"] != nil {
raw_comment := obj["comment"].(map[string]interface{}) raw_comment := obj["comment"].(map[string]interface{})
@ -94,3 +83,5 @@ func getActivityFeed() []Activity {
} }
return feed return feed
} }

View File

@ -25,9 +25,9 @@ type IndicatorInfo struct {
func (i IndicatorInfo) String() string { func (i IndicatorInfo) String() string {
if i.duration == 0 { if i.duration == 0 {
return textStyle.Render(strings.Repeat(".", 30)) return styles.text.Render(strings.Repeat(".", 30))
} }
return fmt.Sprintf("%s %s", textStyle.Render(i.duration.String()), i.info) return fmt.Sprintf("%s %s", styles.text.Render(i.duration.String()), i.info)
} }
func initialIndicator(text string) Indicator { func initialIndicator(text string) Indicator {

View File

@ -10,6 +10,7 @@ type Colors struct {
} }
type Styles struct { type Styles struct {
text lipgloss.Style
} }
var colors = Colors{ var colors = Colors{
@ -26,3 +27,7 @@ var colors = Colors{
lipgloss.Color("#939ab7"), lipgloss.Color("#939ab7"),
}, },
} }
var styles = Styles{
text: lipgloss.NewStyle().Foreground(colors.surface[2]),
}

View File

@ -59,8 +59,6 @@ func getTimeLogs(since time.Time, on_process_repo func(repo gitea.Repository, to
return times return times
} }
var textStyle = lipgloss.NewStyle().Foreground(colors.surface[2])
type timesviewer struct { type timesviewer struct {
table table.Model table table.Model
length int length int
@ -93,7 +91,7 @@ func (m timesviewer) View() string {
Foreground(colors.overlay[0]). Foreground(colors.overlay[0]).
Bold(true) Bold(true)
return m.table.View() + return m.table.View() +
textStyle.Render("\nUse Up and Down arrows to navigate") + styles.text.Render("\nUse Up and Down arrows to navigate") +
totalTextStyle.Render(fmt.Sprintf("\nTotal - %s\n", m.total_time.String())) totalTextStyle.Render(fmt.Sprintf("\nTotal - %s\n", m.total_time.String()))
} }