Skip to content

Commit

Permalink
feat: display unsaved/unapplied changes warning. incomplete
Browse files Browse the repository at this point in the history
not currently hooked up to anything
  • Loading branch information
budak7273 committed Jun 20, 2023
1 parent 9ceee7e commit e1c4efb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tea/components/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ func (h headerComponent) View() string {
} else {
out += "None"
}
out += "\n"

out += h.labelStyle.Render("Status: ")
if h.root.GetSavedChangesStatus() {
out += "No Unsaved Changes"
} else {
out += "Unsaved Changes!"
}

out += " • "

if h.root.GetAppliedStatus() {
out += "No Changes to Apply"
} else {
out += "Unapplied Changes!"
}

return lipgloss.NewStyle().Margin(1, 0).Render(out)
}
3 changes: 3 additions & 0 deletions tea/components/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type RootModel interface {
GetCurrentInstallation() *cli.Installation
SetCurrentInstallation(installation *cli.Installation) error

GetSavedChangesStatus() bool
GetAppliedStatus() bool

GetAPIClient() graphql.Client

Size() tea.WindowSizeMsg
Expand Down
8 changes: 8 additions & 0 deletions tea/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ func (m *rootModel) SetCurrentInstallation(installation *cli.Installation) error
return nil
}

func (m *rootModel) GetSavedChangesStatus() bool {
return false // TODO: implement
}

func (m *rootModel) GetAppliedStatus() bool {
return false // TODO: implement
}

func (m *rootModel) GetAPIClient() graphql.Client {
return m.global.APIClient
}
Expand Down

0 comments on commit e1c4efb

Please sign in to comment.