Files
siftlode/frontend/src/lib/plexSearch.ts
T
peter b605c28b32 release: 0.66.0 — E5 Plex epic (scoped search, HU localization, toolbar/header)
Ships the E5 sprint stack (S1–S7): field-scoped Plex search + typeahead, cast &
crew pages, the HU-overlay Hungarian metadata + language-aware serving, the
IMDb/audience rating split, the toolbar relocation, and the narrow/mobile header
fix — plus the underlying Plex-module refactors (feedquery/plex.cards/plex.query
extraction, db.query→2.0 select).

- VERSION 0.65.2 → 0.66.0
- releaseNotes.ts: 0.66.0 user-facing entry
- prettier-format the E5-touched frontend files (release hygiene)

Merged main (0.65.2 download-gc hotfix) in first; no code conflicts (E5 is
Plex-only, the hotfix was notifications/downloads).
2026-08-17 22:18:07 +02:00

27 lines
1.5 KiB
TypeScript

// The search-box scope-pill (S2): one field-scope active at a time, narrowing the Plex full-text
// search to a single facet of the row. Kept in one module so the provider (state), the header
// SearchBar (the pill UI), and the api layer (the `field` query param) share one source of truth.
export type PlexSearchField = "all" | "title" | "people" | "summary" | "episode";
const PLEX_SEARCH_FIELDS: PlexSearchField[] = ["all", "title", "people", "summary", "episode"];
// i18n label key per scope (see plex.searchField.* in the locale files).
export const plexFieldLabelKey = (f: PlexSearchField): string => `plex.searchField.${f}`;
// Episodes only exist under show libraries, so the Episode scope is offered only when shows are in
// scope (show | both) — mirroring the backend, which returns nothing for episode+movie-only.
export function availablePlexFields(scope: string): PlexSearchField[] {
return scope === "movie" ? PLEX_SEARCH_FIELDS.filter((f) => f !== "episode") : PLEX_SEARCH_FIELDS;
}
// Heal a stored/selected field against the current scope: a movie-only scope can't hold Episode, so
// it falls back to Everywhere (analogous to healPlexSort). Applied at the point of use.
export function healPlexField(field: PlexSearchField, scope: string): PlexSearchField {
return availablePlexFields(scope).includes(field) ? field : "all";
}
export function parsePlexField(v: string | null | undefined): PlexSearchField {
return v && (PLEX_SEARCH_FIELDS as string[]).includes(v) ? (v as PlexSearchField) : "all";
}