mirror of
https://github.com/zoriya/vex.git
synced 2026-06-01 18:16:21 +00:00
big refacto
This commit is contained in:
@@ -4,18 +4,9 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Feed struct {
|
||||
Id uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
FaviconUrl string `json:"faviconUrl"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
type Entry struct {
|
||||
Id uuid.UUID `json:"id"`
|
||||
ArticleTitle string `json:"title"`
|
||||
@@ -42,42 +33,3 @@ func (e Entry) Title() string {
|
||||
func (e Entry) Description() string {
|
||||
return fmt.Sprintf("%s", "my desc") // TODO: real description (tags and author + date ?)
|
||||
}
|
||||
|
||||
type ListKeyMap struct {
|
||||
Query key.Binding
|
||||
BookmarkToggle key.Binding
|
||||
ReadToggle key.Binding
|
||||
ReadLaterToggle key.Binding
|
||||
IgnoreToggle key.Binding
|
||||
PreviewPost key.Binding
|
||||
}
|
||||
|
||||
func NewListKeyMap() *ListKeyMap {
|
||||
return &ListKeyMap{
|
||||
PreviewPost: key.NewBinding(
|
||||
key.WithKeys("enter"),
|
||||
key.WithHelp("enter", "preview post"),
|
||||
),
|
||||
Query: key.NewBinding(
|
||||
key.WithKeys("/"),
|
||||
key.WithHelp("/", "query posts"),
|
||||
),
|
||||
BookmarkToggle: key.NewBinding(
|
||||
key.WithKeys("b"),
|
||||
key.WithHelp("b", "toggle bookmarked"),
|
||||
),
|
||||
ReadToggle: key.NewBinding(
|
||||
key.WithKeys("r"),
|
||||
key.WithHelp("r", "toggle mark as read"),
|
||||
),
|
||||
|
||||
IgnoreToggle: key.NewBinding(
|
||||
key.WithKeys("x", "d"),
|
||||
key.WithHelp("d/x", "ignore post"),
|
||||
),
|
||||
ReadLaterToggle: key.NewBinding(
|
||||
key.WithKeys("m"),
|
||||
key.WithHelp("m", "add to read later"),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Feed struct {
|
||||
Id uuid.UUID `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
FaviconUrl string `json:"faviconUrl"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
func (f Feed) FilterValue() string {
|
||||
return f.Name
|
||||
}
|
||||
|
||||
func (f Feed) Title() string {
|
||||
return f.Name
|
||||
}
|
||||
|
||||
func (f Feed) Description() string {
|
||||
return fmt.Sprintf("%s", "my desc") // TODO: real description (tags, submitter, error status, last sync)
|
||||
}
|
||||
Reference in New Issue
Block a user