From 2ca2609fdb52fbd0cfd6d047c5fcb0de6ec897cb Mon Sep 17 00:00:00 2001 From: isabel Date: Wed, 29 May 2024 11:43:20 +0100 Subject: [PATCH] fix: colors not loading correctly --- cmd/main.go | 1 - cmd/modal.go | 4 +--- main.go | 4 +++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 67157e4..a8936f8 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -41,7 +41,6 @@ func (m Model) handleWindowSize(msg tea.WindowSizeMsg) Model { m.table.SetHeight(height - lipgloss.Height(m.help.View(m.keys)) - lib.MainStyle.GetBorderBottomSize()) if !m.ready { - lib.LoadConfig(m.config) m.feeds = lib.GetAllContent(m.urls, true) m.viewport = viewport.New(width, height) diff --git a/cmd/modal.go b/cmd/modal.go index fd37b6b..00ceef9 100644 --- a/cmd/modal.go +++ b/cmd/modal.go @@ -16,7 +16,6 @@ type Model struct { help help.Model context string urls string - config string keys keyMap viewport viewport.Model feeds lib.Feeds @@ -35,7 +34,7 @@ func (m Model) Init() tea.Cmd { } // NewModel creates a new model with sensible defaults -func NewModel(urls string, config string) Model { +func NewModel(urls string) Model { t := table.New(table.WithFocused(true)) t.SetStyles(lib.TableStyle()) @@ -65,6 +64,5 @@ func NewModel(urls string, config string) Model { post: lib.Post{}, filter: f, urls: urls, - config: config, } } diff --git a/main.go b/main.go index d20904d..f7fe4e6 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "github.com/urfave/cli/v2" "github.com/isabelroses/izrss/cmd" + "github.com/isabelroses/izrss/lib" ) var version = "unstable" @@ -48,7 +49,8 @@ CUSTOMIZATION: }, Action: func(c *cli.Context) error { - p := tea.NewProgram(cmd.NewModel(c.String("urls"), c.String("config")), tea.WithAltScreen()) + lib.LoadConfig(c.String("config")) + p := tea.NewProgram(cmd.NewModel(c.String("urls")), tea.WithAltScreen()) if _, err := p.Run(); err != nil { log.Fatal(err) }