- Fix device rename input collapsing on mobile (fixed width vs w-full inside an auto-layout table column). - Add cascade-delete confirmation for sessions with a saved recording. - Fix header connection LED: derive state from scanning/device-count/ recording instead of the Buttplug client's raw connected flag; drop the label text and hide the indicator entirely when idle. - Add a per-device disconnect button (stop + remove from store, the closest equivalent Buttplug's protocol allows per device). - Fix replay ending early: duration now comes from the recording's actual durationMs, not the last event's timestamp. - Replay robustness: show which devices are being replayed to, reset actuators to zero on start/play/pause, fully disconnect devices and the whole client on stop/unmount, surface command failures via toast. - Stop flagging the header LED red during replay - recording is only for live sessions. - Add page-number pagination to recordings/sessions/devices lists. - Wordmark SEXY -> Sexy; add proper per-page <title>s including dynamic titles for recording/session detail and replay pages. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
29 lines
1018 B
TypeScript
29 lines
1018 B
TypeScript
"use client";
|
|
|
|
import { useButtplugStore } from "@/lib/buttplug/store";
|
|
|
|
type IndicatorState = "scanning" | "connected" | "recording";
|
|
|
|
export function ConnectionStatus() {
|
|
const scanning = useButtplugStore((s) => s.scanning);
|
|
const recording = useButtplugStore((s) => s.recording);
|
|
const deviceCount = useButtplugStore((s) => Object.keys(s.devices).length);
|
|
|
|
// Priority: an active recording is the most important thing to surface,
|
|
// then whether toys are actually connected, then a bare scan-in-progress -
|
|
// this is deliberately independent of the Buttplug client's own `connected`
|
|
// flag, which goes true as soon as the embedded server initializes (i.e. as
|
|
// soon as scanning starts), not when a device is actually paired.
|
|
const state: IndicatorState | null = recording
|
|
? "recording"
|
|
: deviceCount > 0
|
|
? "connected"
|
|
: scanning
|
|
? "scanning"
|
|
: null;
|
|
|
|
if (!state) return null;
|
|
|
|
return <span className="bp-led bp-pulse" data-state={state} aria-hidden />;
|
|
}
|