feat(web): add 'Summarized only' filter checkbox to video list
This commit is contained in:
+10
-4
@@ -392,9 +392,10 @@ func disconnectURL(provider string) templ.SafeURL {
|
||||
// Dates are kept as the raw YYYY-MM-DD strings so the form re-renders the user's
|
||||
// input verbatim; parsing happens in matchFilter.
|
||||
type Filter struct {
|
||||
Channel string
|
||||
From string
|
||||
To string
|
||||
Channel string
|
||||
From string
|
||||
To string
|
||||
OnlySummarized bool // show only videos that have a summary
|
||||
}
|
||||
|
||||
// matches reports whether a row satisfies the filter. Channel is an exact match;
|
||||
@@ -402,6 +403,9 @@ type Filter struct {
|
||||
// (no constraint) — Stage-0 filtering is in-memory over the listed rows, not a
|
||||
// store query.
|
||||
func (f Filter) matches(r store.SummaryRow) bool {
|
||||
if f.OnlySummarized && !r.Summarized {
|
||||
return false
|
||||
}
|
||||
if f.Channel != "" && r.Channel != f.Channel {
|
||||
return false
|
||||
}
|
||||
@@ -432,7 +436,7 @@ func parseDate(s string) (time.Time, bool) {
|
||||
|
||||
// apply returns the subset of rows matching the filter, preserving order.
|
||||
func (f Filter) apply(rows []store.SummaryRow) []store.SummaryRow {
|
||||
if f == (Filter{}) {
|
||||
if f.Channel == "" && f.From == "" && f.To == "" && !f.OnlySummarized {
|
||||
return rows
|
||||
}
|
||||
out := rows[:0:0]
|
||||
@@ -484,6 +488,8 @@ main { max-width: 60rem; margin: 0 auto; padding: var(--s4) var(--s3); }
|
||||
.filters label { display: flex; flex-direction: column; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); gap: var(--s1); }
|
||||
.filters input { font: inherit; padding: .4rem .55rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--fg); min-width: 9rem; }
|
||||
.filters input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
|
||||
.filter-check { flex-direction: row !important; align-items: center; gap: var(--s2) !important; padding-bottom: .45rem; }
|
||||
.filter-check input[type=checkbox] { width: 1rem; height: 1rem; min-width: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
|
||||
.btn { font: inherit; font-weight: 600; padding: .45rem 1rem; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: var(--accent-fg); cursor: pointer; }
|
||||
/* anchors styled as buttons: the generic a{} / a:visited{} colour rules outrank
|
||||
.btn on <a>, painting the label accent-on-accent (invisible). Restore the
|
||||
|
||||
Reference in New Issue
Block a user