Rebuild both UIs on the Cinder design #10
+9
-2
@@ -38,6 +38,11 @@ type listView struct {
|
|||||||
Tab string // "all", "fav", or "new"
|
Tab string // "all", "fav", or "new"
|
||||||
Recent []Bookmark
|
Recent []Bookmark
|
||||||
Items []Bookmark
|
Items []Bookmark
|
||||||
|
// NewCount is the badge on the Updated tab: how many series being read
|
||||||
|
// have a chapter out that has not been read. It is counted over the whole
|
||||||
|
// reading set, not the active tab, so the badge does not change meaning as
|
||||||
|
// the user moves between tabs.
|
||||||
|
NewCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial is the monogram the templates show in place of a cover when the
|
// Initial is the monogram the templates show in place of a cover when the
|
||||||
@@ -178,12 +183,14 @@ func (h *webHandler) buildListView(tab string) (listView, error) {
|
|||||||
recent = recent[:recentCount]
|
recent = recent[:recentCount]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
withNew := filterBookmarks(reading, func(b Bookmark) bool { return b.HasNewChapter() })
|
||||||
|
|
||||||
var items []Bookmark
|
var items []Bookmark
|
||||||
switch tab {
|
switch tab {
|
||||||
case "fav":
|
case "fav":
|
||||||
items = filterBookmarks(reading, func(b Bookmark) bool { return b.Favorite })
|
items = filterBookmarks(reading, func(b Bookmark) bool { return b.Favorite })
|
||||||
case "new":
|
case "new":
|
||||||
items = filterBookmarks(reading, func(b Bookmark) bool { return b.HasNewChapter() })
|
items = withNew
|
||||||
case "archived":
|
case "archived":
|
||||||
items = filterBookmarks(all, func(b Bookmark) bool { return b.Status == statusArchived })
|
items = filterBookmarks(all, func(b Bookmark) bool { return b.Status == statusArchived })
|
||||||
case "finished":
|
case "finished":
|
||||||
@@ -192,7 +199,7 @@ func (h *webHandler) buildListView(tab string) (listView, error) {
|
|||||||
tab = "all"
|
tab = "all"
|
||||||
items = reading
|
items = reading
|
||||||
}
|
}
|
||||||
return listView{Tab: tab, Recent: recent, Items: items}, nil
|
return listView{Tab: tab, Recent: recent, Items: items, NewCount: len(withNew)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *webHandler) uiList(w http.ResponseWriter, r *http.Request) {
|
func (h *webHandler) uiList(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user