-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
317 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package cfgui | ||
|
||
import "github.com/charmbracelet/bubbles/key" | ||
|
||
type Keymap struct { | ||
Up key.Binding | ||
Down key.Binding | ||
Home key.Binding | ||
End key.Binding | ||
Refresh key.Binding | ||
Select key.Binding | ||
Quit key.Binding | ||
} | ||
|
||
func DefaultKeymap() *Keymap { | ||
return &Keymap{ | ||
Up: key.NewBinding(key.WithKeys("up", "k"), key.WithHelp("↑", "up")), | ||
Down: key.NewBinding(key.WithKeys("down", "j"), key.WithHelp("↓", "down")), | ||
Home: key.NewBinding(key.WithKeys("home"), key.WithHelp("home/end", "top/bottom")), | ||
End: key.NewBinding(key.WithKeys("end")), | ||
Refresh: key.NewBinding(key.WithKeys("f5", "ctrl+r"), key.WithHelp("f5", "refresh")), | ||
Select: key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "submit")), | ||
Quit: key.NewBinding(key.WithKeys("q", "esc", "ctrl+c"), key.WithHelp("q", "quit")), | ||
} | ||
} | ||
|
||
func (k *Keymap) Bindings() []key.Binding { | ||
return []key.Binding{k.Up, k.Down, k.Home, k.Refresh, k.Select, k.Quit} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package cfgui | ||
|
||
import ( | ||
"github.com/charmbracelet/lipgloss" | ||
"github.com/rusq/slackdump/v3/cmd/slackdump/internal/ui" | ||
) | ||
|
||
type Style struct { | ||
Focused StyleSet | ||
Blurred StyleSet | ||
} | ||
|
||
type StyleSet struct { | ||
Border lipgloss.Style | ||
Title lipgloss.Style | ||
Description lipgloss.Style | ||
Name lipgloss.Style | ||
ValueEnabled lipgloss.Style | ||
ValueDisabled lipgloss.Style | ||
SelectedName lipgloss.Style | ||
Cursor lipgloss.Style | ||
} | ||
|
||
func DefaultStyle() *Style { | ||
t := ui.DefaultTheme() | ||
return &Style{ | ||
Focused: StyleSet{ | ||
Border: t.Focused.Border, | ||
Title: t.Focused.Options.Section, | ||
Description: t.Focused.Description, | ||
Name: t.Focused.Options.Name, | ||
ValueEnabled: t.Focused.Options.EnabledValue, | ||
ValueDisabled: t.Focused.Options.DisabledValue, | ||
SelectedName: t.Focused.Options.SelectedName, | ||
Cursor: t.Focused.Cursor, | ||
}, | ||
Blurred: StyleSet{ | ||
Border: t.Blurred.Border, | ||
Title: t.Blurred.Options.Section, | ||
Description: t.Blurred.Description, | ||
Name: t.Blurred.Options.Name, | ||
ValueEnabled: t.Blurred.Options.EnabledValue, | ||
ValueDisabled: t.Blurred.Options.DisabledValue, | ||
SelectedName: t.Blurred.Options.SelectedName, | ||
Cursor: t.Blurred.Cursor, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dumpui | ||
|
||
import tea "github.com/charmbracelet/bubbletea" | ||
|
||
type FocusModel interface { | ||
tea.Model | ||
SetFocus(bool) | ||
IsFocused() bool | ||
// Reset should reset the model to its initial state. | ||
Reset() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dumpui | ||
|
||
import "github.com/charmbracelet/bubbles/key" | ||
|
||
type Keymap struct { | ||
Up key.Binding | ||
Down key.Binding | ||
Select key.Binding | ||
Quit key.Binding | ||
} | ||
|
||
func DefaultKeymap() *Keymap { | ||
return &Keymap{ | ||
Up: key.NewBinding(key.WithKeys("up", "k"), key.WithHelp("↑", "up")), | ||
Down: key.NewBinding(key.WithKeys("down", "j"), key.WithHelp("↓", "down")), | ||
Select: key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "submit")), | ||
Quit: key.NewBinding(key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit")), | ||
} | ||
} | ||
|
||
func (k *Keymap) Bindings() []key.Binding { | ||
return []key.Binding{k.Up, k.Down, k.Select, k.Quit} | ||
} |
Oops, something went wrong.