The 43 react-refresh/only-export-components warnings the gate let through meant an edit to a provider (or AnchoredPopover, Toaster, plexDetailUi, …) could not be hot-swapped: Fast Refresh reloads a module that also exports hooks or helpers. - Each provider's contexts, the types its hooks return and the hooks themselves live in a sibling context module (navigationContext.ts, channelsContext.ts, …); the provider file keeps the component. loadAccountFilters moved next to the feed filters' defaults (feedFiltersInit.ts), following navigationInit/playlistsInit. - Helpers that sat in component files have their own modules: welcomeMode, downloadTitle, plexPlayable, channelSync, ui/anchoredPopoverHooks, ui/pageToolbarSlot, ui/pagerContent, ui/toastLevels, ui/overlayOrder, ui/tableAlign, lib/plexDetail; the cells of the channel columns and the registry's page wrappers are components files of their own (channelCells, modulePages). - usePersistedTab, an alias of useAccountPersistedState, is gone; its callers use the original. npm run lint is now eslint --max-warnings 0, so a warning fails the gate like an error does.
21 lines
1.2 KiB
TypeScript
21 lines
1.2 KiB
TypeScript
// The playback-cost classes and their dot tints, shared by the Plex cards (plexCards) and the info
|
|
// page's playback chip (PlexInfo). Its own module so plexCards exports only components (Fast Refresh).
|
|
|
|
// Playback cost, escalating good→heavy: Direct Play (green) → Direct Stream / remux, a light
|
|
// repackage (blue) → Transcode · HW, a hardware re-encode (amber) → Transcode · SW, a software
|
|
// re-encode (red). transcode splits HW vs SW by card.transcode_hw. Reuses the semantic tokens as a
|
|
// gradient; all four stay visually distinct in light + dark.
|
|
export const PLAYABLE_TINT: Record<string, string> = {
|
|
direct: "bg-success",
|
|
remux: "bg-info",
|
|
transcode_hw: "bg-warn",
|
|
transcode_sw: "bg-danger",
|
|
};
|
|
// Collapse the wire `playable` (direct|remux|transcode) + transcode_hw flag into one of the 4 display
|
|
// classes, so the corner dot's colour + tooltip can't drift from the sidebar filter's option keys.
|
|
// Shared with the info-page playback chip (PlexInfo) so both surfaces derive the class identically.
|
|
export function playableClass(playable: string, transcodeHw?: boolean | null): string {
|
|
if (playable === "transcode") return transcodeHw ? "transcode_hw" : "transcode_sw";
|
|
return playable; // direct | remux
|
|
}
|