§9 / D3 / D13 / D15 / D16: podcasts-type libraries are excluded from every generic book surface. Under RLS these are pure UX/type filters (engine already hides other users' episodes); their job is preventing episode grids in surfaces designed for books. The discriminator is the denormalized media_items.library_type_name (IS DISTINCT FROM 'podcasts' — NULL rows predate the column and stay visible). SQL (queries.sql, marked '-- podcasts exclusion (plan §9)'): ListMediaItems/ListMediaItemsSorted (All Books) · SearchMediaItems + SearchMediaItemsUnified (generic search) · FacetCountsUnderFilters (all 14 arms) + the six Search*Values facet-suggestion queries · GetDistinctSeries + Count (series pages) · GetLibraryItems (collections picker) · dashboard system sections (Continue Reading / Recently Added / Recently Read / Not Started) · GetPopularBooks + GetTopBooksByMinutes (book rankings must not rank episodes). Go: statistics summary counts episodes' sessions into time-spent (D15 keeps that) but skips them in BooksActive/BooksFinished — an episode is not a book. OPDS filters podcasts libraries via one helper at all 7 library-walk sites (D16). Templ: LibrarySwitcher skips podcasts entries and TotalMediaCount excludes them — presentation-layer filter so every switcher consumer (dashboard, collections, custom-section builder) is correct at once (D13); podcasts surface via /podcasts only.
87 lines
3.0 KiB
Templ
87 lines
3.0 KiB
Templ
package templates
|
|
|
|
// LibrarySwitcher renders the sticky subbar: title + library select on
|
|
// the left (title hidden below `sm` — phones need the row width for the
|
|
// select + actions + the dashboard's stats widget), optional action
|
|
// buttons on the right. `center` is an
|
|
// optional slot between them (nil = unused) — the dashboard passes its
|
|
// "This Week" stats widget here so it participates in the bar's
|
|
// justify-between layout as the middle group.
|
|
templ LibrarySwitcher(libData []LibraryData, currentLibraryID string, title string, center templ.Component, actions ...templ.Component) {
|
|
<div
|
|
class="app-subbar backdrop-blur border-b"
|
|
style="background-color: color-mix(in srgb, var(--bg-primary) 88%, transparent); border-color: color-mix(in srgb, var(--text-primary) 6%, transparent);"
|
|
>
|
|
<div class="w-full px-4 sm:px-6 lg:px-8 py-3 flex items-center justify-between gap-4">
|
|
<div class="flex items-center gap-3 min-w-0">
|
|
if title != "" {
|
|
<span class="text-base font-bold tracking-tight shrink-0 hidden sm:inline" style="color: var(--text-primary)">{ title }</span>
|
|
} else {
|
|
<label class="text-sm font-medium" style="color: var(--text-secondary)">Library</label>
|
|
}
|
|
<select
|
|
id="library-select"
|
|
name="library_id"
|
|
class="input w-auto py-1.5 pr-8 cursor-pointer"
|
|
>
|
|
<option value="">All Libraries ({ TotalMediaCount(libData) })</option>
|
|
for _, lib := range libData {
|
|
// Podcasts libraries are feed-managed (plan D13): never
|
|
// in the book-library switcher — feeds surface via
|
|
// /podcasts only. Presentation-layer filter so every
|
|
// switcher consumer is correct at once.
|
|
if !IsBookLibrary(lib.TypeName) {
|
|
continue
|
|
}
|
|
if lib.Offline {
|
|
if lib.ID == currentLibraryID {
|
|
<option value={ lib.ID } selected>{ lib.Name } ({ lib.MediaCount }) — storage offline</option>
|
|
} else {
|
|
<option value={ lib.ID }>{ lib.Name } ({ lib.MediaCount }) — storage offline</option>
|
|
}
|
|
} else if lib.ID == currentLibraryID {
|
|
<option value={ lib.ID } selected>{ lib.Name } ({ lib.MediaCount })</option>
|
|
} else {
|
|
<option value={ lib.ID }>{ lib.Name } ({ lib.MediaCount })</option>
|
|
}
|
|
}
|
|
</select>
|
|
</div>
|
|
if center != nil {
|
|
@center
|
|
}
|
|
if len(actions) > 0 {
|
|
<div class="flex items-center gap-2">
|
|
for _, action := range actions {
|
|
@action
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
<div
|
|
id="loading-spinner"
|
|
class="hidden fixed inset-0 flex items-center justify-center z-50"
|
|
style="background-color: color-mix(in srgb, var(--bg-primary) 55%, transparent);"
|
|
>
|
|
<div class="animate-spin rounded-full h-12 w-12 border-b-2" style="border-color: var(--accent);"></div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
templ DashboardActions() {
|
|
<button
|
|
data-action="open-dashboard-settings"
|
|
class="icon-btn"
|
|
title="Customize Dashboard"
|
|
>
|
|
@Icon("grid", "h-5 w-5")
|
|
</button>
|
|
<button
|
|
data-action="reload-page"
|
|
class="icon-btn"
|
|
title="Refresh"
|
|
>
|
|
@Icon("refresh", "h-5 w-5")
|
|
</button>
|
|
}
|