Fix device/replay/session UX issues, add pagination, bump to 0.3.0
- 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>
This commit is contained in:
@@ -45,6 +45,8 @@ export function ButtplugConsole() {
|
||||
const setActuatorValue = useButtplugStore((s) => s.setActuatorValue);
|
||||
const batteryLevels = useButtplugStore((s) => s.batteryLevels);
|
||||
const setBatteryLevel = useButtplugStore((s) => s.setBatteryLevel);
|
||||
const removeDevice = useButtplugStore((s) => s.removeDevice);
|
||||
const setRecording = useButtplugStore((s) => s.setRecording);
|
||||
const storeError = useButtplugStore((s) => s.error);
|
||||
|
||||
const [activeSession, setActiveSession] = useState<ActivePlaySession | null>(null);
|
||||
@@ -136,6 +138,7 @@ export function ButtplugConsole() {
|
||||
sessionDeviceIdByDeviceIndex,
|
||||
});
|
||||
setElapsedMs(0);
|
||||
setRecording(true);
|
||||
} catch {
|
||||
toast.error("Could not start session.");
|
||||
} finally {
|
||||
@@ -147,6 +150,7 @@ export function ButtplugConsole() {
|
||||
if (!activeSession) return;
|
||||
setSessionBusy(true);
|
||||
eventBuffer.stop();
|
||||
setRecording(false);
|
||||
await fetch(`/api/play-sessions/${activeSession.id}`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -197,6 +201,17 @@ export function ButtplugConsole() {
|
||||
device.actuators.forEach((a) => setActuatorValue(device.index, a.featureIndex, 0));
|
||||
}
|
||||
|
||||
async function handleDisconnectDevice(device: ConnectedDeviceInfo) {
|
||||
// Buttplug's protocol has no per-device disconnect message - only a
|
||||
// whole-client disconnect() and stop() (halts actuators). Stopping it and
|
||||
// removing it from local state is the closest equivalent: the card
|
||||
// disappears and it stops receiving commands, though the underlying BLE
|
||||
// link may persist until the whole client disconnects.
|
||||
const liveDevice = await getDevice(device.index);
|
||||
await liveDevice?.stop().catch(() => {});
|
||||
removeDevice(device.index);
|
||||
}
|
||||
|
||||
if (!supported) {
|
||||
return (
|
||||
<Card className="bp-glass">
|
||||
@@ -249,6 +264,7 @@ export function ButtplugConsole() {
|
||||
}
|
||||
onActuatorChange={(featureIndex, value) => void handleActuatorChange(device, featureIndex, value)}
|
||||
onStop={() => void handleStopDevice(device)}
|
||||
onDisconnect={() => void handleDisconnectDevice(device)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user