feat(web): updated tab, inline errors, card craft
Adds the Updated tab (series with an unread chapter) with its own empty state, so "what's new" no longer means scanning the whole list. A failed favourite/chapter/delete previously looked like an ignored tap: htmx does not swap on a non-2xx response and nothing else said so. Errors now surface inline on the card. The two per-card panels (chapter edit, delete confirm) also close each other. Mobile fixes, all measured at 360/390px rather than eyeballed: .chapter-form and .confirm-row now wrap so the hint and the prompt take their own row, and the number input shrinks (flex-basis 0) instead of holding its ~20ch intrinsic width. Before this the Save button sat off screen — 97px of page overflow at 390px, 127px at 360px — which broke correcting a chapter number on the one device class this is built for. Emoji glyphs replaced with inline SVG on currentColor: each rendered in a different face at a different weight and colour, ignoring the card's own type and colour system. No icon font or library. Series with no scraped og:image render a title-initial monogram instead of a blank rectangle that read as a cover still loading. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+21
-3
@@ -35,11 +35,21 @@ type webHandler struct {
|
||||
|
||||
// listView is what every list-rendering template receives.
|
||||
type listView struct {
|
||||
Tab string // "all" or "fav"
|
||||
Tab string // "all", "fav", or "new"
|
||||
Recent []Bookmark
|
||||
Items []Bookmark
|
||||
}
|
||||
|
||||
// Initial is the monogram the templates show in place of a cover when the
|
||||
// source site never gave us an og:image. First rune, uppercased; "?" when even
|
||||
// the title is missing, so the slot is never empty.
|
||||
func (b Bookmark) Initial() string {
|
||||
for _, r := range b.Title {
|
||||
return strings.ToUpper(string(r))
|
||||
}
|
||||
return "?"
|
||||
}
|
||||
|
||||
// loginView is what the login template receives.
|
||||
type loginView struct {
|
||||
Error string
|
||||
@@ -150,14 +160,22 @@ func (h *webHandler) buildListView(tab string) (listView, error) {
|
||||
}
|
||||
|
||||
items := all
|
||||
if tab == "fav" {
|
||||
switch tab {
|
||||
case "fav":
|
||||
items = []Bookmark{}
|
||||
for _, b := range all {
|
||||
if b.Favorite {
|
||||
items = append(items, b)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
case "new":
|
||||
items = []Bookmark{}
|
||||
for _, b := range all {
|
||||
if b.HasNewChapter() {
|
||||
items = append(items, b)
|
||||
}
|
||||
}
|
||||
default:
|
||||
tab = "all"
|
||||
}
|
||||
return listView{Tab: tab, Recent: recent, Items: items}, nil
|
||||
|
||||
Reference in New Issue
Block a user