Fix chapter reader nav bar: use hamburger icon for back-to-book, show chapter date below title
Some checks failed
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Build (push) Has been cancelled

- Replace bare ← back-to-book link with ☰ (hamburger) icon to eliminate
  the visual double-arrow confusion with the ← Prev chapter button
- Export SplitChapterTitle in writer package and call it in handleChapter
  to split the raw heading into (title, date) — fixes concatenated title+date bug
- Display ChapterDate as a smaller muted line below the chapter title
  in the center nav button
- Bump nav bar height from h-12 to h-14 to accommodate two-line center button
This commit is contained in:
Admin
2026-03-01 22:03:47 +05:00
parent ca33f8c3cf
commit 7e4bb87da0
2 changed files with 18 additions and 12 deletions

View File

@@ -219,12 +219,12 @@ func chapterTitle(path string, n int) (title, date string) {
continue
}
line = strings.TrimPrefix(line, "# ")
return splitChapterTitle(line)
return SplitChapterTitle(line)
}
return fmt.Sprintf("Chapter %d", n), ""
}
// splitChapterTitle separates the human-readable chapter name from the
// SplitChapterTitle separates the human-readable chapter name from the
// trailing relative-date string that novelfire.net appends to the heading.
// Examples of raw heading text (after stripping "# "):
//
@@ -233,7 +233,7 @@ func chapterTitle(path string, n int) (title, date string) {
//
// The pattern is: optional leading number+whitespace, then the real title,
// then a date that matches /\d+\s+(second|minute|hour|day|week|month|year)s?\s+ago$/
func splitChapterTitle(raw string) (title, date string) {
func SplitChapterTitle(raw string) (title, date string) {
// Strip a leading chapter-number index that novelfire sometimes prepends.
// It looks like "1 " or "12 " at the very start.
raw = strings.TrimSpace(raw)