refactor(web): share poll-state derivation; keep zebra parity across a row swap (#146)
Review round: pollState() unifies the CanPoll/Pending/Requested derivation used by the list row and the detail page, and the row anchor carries its band parity with the press (hx-vals) so the swapped answer keeps the alternation.
This commit is contained in:
@@ -96,6 +96,7 @@ func (h *Handler) adminSeriesByKey(site, seriesID string) (store.AdminSeries, bo
|
||||
// seriesDetailView shapes one AdminSeries row for display: every judgement in
|
||||
// Go, the template left to print strings and flags.
|
||||
func (h *Handler) seriesDetailView(a store.AdminSeries) seriesDetailView {
|
||||
canPoll, pending, requested := pollState(a, time.Now())
|
||||
v := seriesDetailView{
|
||||
Key: a.Key(),
|
||||
Site: a.Site,
|
||||
@@ -107,11 +108,9 @@ func (h *Handler) seriesDetailView(a store.AdminSeries) seriesDetailView {
|
||||
NoCover: a.CoverAddress == "",
|
||||
Orphan: a.ReaderCount == 0,
|
||||
SightingRaised: a.RaisedByReader,
|
||||
CanPoll: a.SeriesURL != "" && a.ReaderCount > 0,
|
||||
}
|
||||
if a.ForcePollAt > a.LatestCheckedAt {
|
||||
v.Pending = true
|
||||
v.Requested = requestedAge(time.Now(), a.ForcePollAt)
|
||||
CanPoll: canPoll,
|
||||
Pending: pending,
|
||||
Requested: requested,
|
||||
}
|
||||
if a.LatestChapterNum == nil {
|
||||
v.Chapter = "—"
|
||||
|
||||
Reference in New Issue
Block a user