feat(ux): card unification, slim icon nav, filter/plex fixes (7-item batch)
1A ChannelPage "Full history" button no longer wraps (whitespace-nowrap). 1B Extract the manager's press-and-hold priority stepper into a shared PriorityStepper and add it to the channel detail header (subscribed, non-demo); backend channel_detail now returns the per-subscription `priority`. 2 Unify YouTube + Plex media cards onto one look/behaviour: drop the whole-card hover LIFT (VideoCard) — which also fixes the clipped-top bug — and instead the inner thumbnail/poster ZOOMS on hover (both); give the flat Plex posters the same glass-card 3D depth + accent hover border as the feed cards (shadow-md is a transparent no-op here, so it's glass-card that provides the depth); clamp Plex card titles to a fixed 2-line height so 1- vs 2-line titles align. 3 Nav rail is now always a slim icon-only column, flush to the left edge; each icon reveals a floating name label on hover (Tooltip gains `always` + `openDelay`, and a right side). Removed the pin/unpin toggle, the expand-on-hover mode and the navCollapsed pref plumbing. 4 Scope the side-panel peek-open HOVER to the tab handle + the card (not the whole full-height slot next to the rail), so approaching the nav no longer pops the filter open; focus stays container-wide. useHoverFocusWithin gains a hover-out grace period + split hover/focus handler groups. 5 Plex art backdrop fills the whole viewport (a fixed inset-0 layer behind the transparent app) instead of only the inset <main> box. 6 Plex season binge continues across seasons: the season view's play queue now spans the whole show (allKeys), so a season's last episode rolls into the next season's first (seasonKeys stays for "add season to playlist"). 7 When a Plex video/episode ends with nothing queued next, the player returns to the previous page (onEnded → onClose) instead of stranding a black screen.
This commit is contained in:
@@ -1,29 +1,37 @@
|
||||
import { useEffect, useState, type FocusEvent } from "react";
|
||||
import { useCallback, useEffect, useRef, useState, type FocusEvent } from "react";
|
||||
|
||||
/**
|
||||
* "Peek open on hover or keyboard focus" for a container — the shared brain behind the nav rail
|
||||
* and the floating side panels, which sit slim until you point at them or tab into them.
|
||||
* "Peek open on hover or keyboard focus" for a floating panel — the shared brain behind the side
|
||||
* panels, which sit slim until you point at them or tab into them.
|
||||
*
|
||||
* Spread `handlers` on the container; `active` is true while the pointer is over it (or any
|
||||
* descendant) or focus is inside it.
|
||||
* Returns `active` plus THREE handler groups so a consumer can scope hover and focus independently:
|
||||
* - `hoverHandlers` — pointer enter/leave, with a short GRACE period on leave so the pointer can
|
||||
* cross a gap between two separate peek regions (e.g. the docked tab and the expanded card, which
|
||||
* are separate absolutely-positioned elements) without the panel collapsing mid-move. Put these on
|
||||
* ONLY the visible affordances (the tab handle + the card), so approaching empty gutter next to the
|
||||
* panel does not pop it open.
|
||||
* - `focusHandlers` — focus/blur, tracked through the REACT tree so a portaled child menu still
|
||||
* counts as "inside". Put these on the outer container so keyboard focus anywhere within holds it.
|
||||
* - `handlers` — both groups merged, for the simple single-element case.
|
||||
*
|
||||
* Focus is tracked through the REACT tree, so a portaled menu rendered by a child (the language
|
||||
* switcher, the account popover) still counts as "inside" and holds the container open while you
|
||||
* use it. The one case that misses: such a portal unmounts while focused, and browsers fire NO blur
|
||||
* when a focused node is removed — focus silently falls to the body and `active` would latch on
|
||||
* forever. Hence the document-level safety net: when focus has landed nowhere, clear it.
|
||||
* The one focus case that misses: a portaled menu unmounts while focused — browsers fire NO blur when
|
||||
* a focused node is removed, so focus silently falls to the body and would latch `focused` on forever.
|
||||
* Hence the document-level safety net: when focus has landed nowhere, clear it.
|
||||
*/
|
||||
export function useHoverFocusWithin(): {
|
||||
active: boolean;
|
||||
handlers: {
|
||||
onMouseEnter: () => void;
|
||||
onMouseLeave: () => void;
|
||||
onFocus: () => void;
|
||||
onBlur: (e: FocusEvent) => void;
|
||||
};
|
||||
} {
|
||||
export function useHoverFocusWithin() {
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const [focused, setFocused] = useState(false);
|
||||
const leaveTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
||||
|
||||
const enter = useCallback(() => {
|
||||
clearTimeout(leaveTimer.current);
|
||||
setHovered(true);
|
||||
}, []);
|
||||
const leaveSoon = useCallback(() => {
|
||||
clearTimeout(leaveTimer.current);
|
||||
leaveTimer.current = setTimeout(() => setHovered(false), 120);
|
||||
}, []);
|
||||
useEffect(() => () => clearTimeout(leaveTimer.current), []);
|
||||
|
||||
useEffect(() => {
|
||||
let timer: number | undefined;
|
||||
@@ -46,15 +54,18 @@ export function useHoverFocusWithin(): {
|
||||
};
|
||||
}, []);
|
||||
|
||||
return {
|
||||
active: hovered || focused,
|
||||
handlers: {
|
||||
onMouseEnter: () => setHovered(true),
|
||||
onMouseLeave: () => setHovered(false),
|
||||
onFocus: () => setFocused(true),
|
||||
onBlur: (e: FocusEvent) => {
|
||||
if (!e.currentTarget.contains(e.relatedTarget as Node)) setFocused(false);
|
||||
},
|
||||
const hoverHandlers = { onMouseEnter: enter, onMouseLeave: leaveSoon };
|
||||
const focusHandlers = {
|
||||
onFocus: () => setFocused(true),
|
||||
onBlur: (e: FocusEvent) => {
|
||||
if (!e.currentTarget.contains(e.relatedTarget as Node)) setFocused(false);
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
active: hovered || focused,
|
||||
hoverHandlers,
|
||||
focusHandlers,
|
||||
handlers: { ...hoverHandlers, ...focusHandlers },
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user