feat(web): float device streams over chat (#11285)
Co-authored-by: Claude Code <[email protected]>
This commit is contained in:
1 parent
e22040dfc1
commit
8bbe2bf660
15 files changed
+612
-167
No files matched your search
@@ -7,6 +7,7 @@ import type {
|
||||
import {
|
||||
ChevronLeft,
|
||||
Home,
|
||||
PictureInPicture2,
|
||||
Power,
|
||||
RotateCcw,
|
||||
SlidersHorizontal,
|
||||
@@ -16,6 +17,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { usePreviewMiniPlayerStore } from "~/previewMiniPlayerStore";
|
||||
import { useRightPanelStore, type RightPanelSurface } from "~/rightPanelStore";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { DiscoveryList, DiscoveryListRow } from "~/components/ui/discovery-list";
|
||||
@@ -116,6 +118,19 @@ export function DevicePanel(props: {
|
||||
}
|
||||
};
|
||||
|
||||
// Floating the device closes the panel, like the browser's floating preview.
|
||||
const floatActive = () => {
|
||||
if (!activeDevice) return;
|
||||
usePreviewMiniPlayerStore.getState().open(props.threadRef, {
|
||||
kind: "device",
|
||||
hostId: activeDevice.hostId,
|
||||
deviceId: activeDevice.id,
|
||||
platform: activeDevice.platform,
|
||||
name: activeDevice.name,
|
||||
});
|
||||
useRightPanelStore.getState().close(props.threadRef);
|
||||
};
|
||||
|
||||
const closeActive = (powerOff: boolean) => {
|
||||
if (!powerOff) {
|
||||
useRightPanelStore.getState().closeSurface(props.threadRef, props.surface.id);
|
||||
@@ -218,6 +233,9 @@ export function DevicePanel(props: {
|
||||
>
|
||||
<SlidersHorizontal />
|
||||
</Toggle>
|
||||
<DeviceButton label="Float device over chat" onClick={floatActive}>
|
||||
<PictureInPicture2 />
|
||||
</DeviceButton>
|
||||
<DeviceButton label="Power off" onClick={() => closeActive(true)}>
|
||||
<Power />
|
||||
</DeviceButton>
|
||||
|
||||
Reference in new issue
Block a user