Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f624dc7375 | |||
| 8954e4193e |
3 changed files with 20 additions and 22 deletions
|
|
@ -18,10 +18,12 @@ export default function ScreenshareButton({
|
||||||
className,
|
className,
|
||||||
iconSize,
|
iconSize,
|
||||||
tooltip,
|
tooltip,
|
||||||
|
defaultPortal,
|
||||||
}: {
|
}: {
|
||||||
className?: string;
|
className?: string;
|
||||||
iconSize?: number;
|
iconSize?: number;
|
||||||
tooltip?: string;
|
tooltip?: string;
|
||||||
|
defaultPortal?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const isScreensharing = useCall((state) => state.screenShareEnabled);
|
const isScreensharing = useCall((state) => state.screenShareEnabled);
|
||||||
const screenRef = useCall((state) => state.screenRef);
|
const screenRef = useCall((state) => state.screenRef);
|
||||||
|
|
@ -30,8 +32,9 @@ export default function ScreenshareButton({
|
||||||
const [menuOpen, setMenuOpen] = useState(false);
|
const [menuOpen, setMenuOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (defaultPortal) return;
|
||||||
setPortalContainer(screenRef?.current ?? undefined);
|
setPortalContainer(screenRef?.current ?? undefined);
|
||||||
}, [screenRef]);
|
}, [screenRef, defaultPortal]);
|
||||||
|
|
||||||
async function startWebShare() {
|
async function startWebShare() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -110,7 +113,9 @@ export default function ScreenshareButton({
|
||||||
/>
|
/>
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
className="flex w-40 flex-col gap-2"
|
className="flex w-40 flex-col gap-2"
|
||||||
portalProps={{ container: portalContainer }}
|
portalProps={{
|
||||||
|
container: defaultPortal ? undefined : portalContainer,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
disabled={isScreensharing}
|
disabled={isScreensharing}
|
||||||
|
|
@ -141,7 +146,11 @@ export default function ScreenshareButton({
|
||||||
</PopoverContent>
|
</PopoverContent>
|
||||||
</Popover>
|
</Popover>
|
||||||
{tooltip && (
|
{tooltip && (
|
||||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
<TooltipContent
|
||||||
|
portalProps={{
|
||||||
|
container: defaultPortal ? undefined : portalContainer,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{tooltip}
|
{tooltip}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -20,24 +20,18 @@ import LeaveButton from "./buttons/leave";
|
||||||
|
|
||||||
export default function SidebarBox() {
|
export default function SidebarBox() {
|
||||||
const state = useCall((store) => store.state);
|
const state = useCall((store) => store.state);
|
||||||
const screenRef = useCall((store) => store.screenRef);
|
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const [portalContainer, setPortalContainer] = useState<HTMLElement>();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setPortalContainer(screenRef?.current ?? undefined);
|
|
||||||
}, [screenRef]);
|
|
||||||
|
|
||||||
return state === "closed" ? null : (
|
return state === "closed" ? null : (
|
||||||
<Card className="p-1.5 gap-2" hidden={isMobile}>
|
<Card className="p-1.5 gap-2" hidden={isMobile}>
|
||||||
<CardHeader className="p-0! pb-2! border-b-2">
|
<CardHeader className="p-0! pb-2! border-b-2">
|
||||||
<ConnectionBar portalContainer={portalContainer} />
|
<ConnectionBar />
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-0! flex flex-col gap-1">
|
<CardContent className="p-0! flex flex-col gap-1">
|
||||||
<div className="flex justify-start gap-1">
|
<div className="flex justify-start gap-1">
|
||||||
<MuteButton className="w-9 h-9" />
|
<MuteButton className="w-9 h-9" />
|
||||||
<DeafButton className="w-9 h-9" />
|
<DeafButton className="w-9 h-9" />
|
||||||
<ScreenshareButton className="w-9 h-9" />
|
<ScreenshareButton className="w-9 h-9" defaultPortal />
|
||||||
<LeaveButton className="w-9 h-9" />
|
<LeaveButton className="w-9 h-9" />
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
@ -45,7 +39,7 @@ export default function SidebarBox() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConnectionBar({ portalContainer }: { portalContainer?: HTMLElement }) {
|
function ConnectionBar() {
|
||||||
const state = useCall((store) => store.state);
|
const state = useCall((store) => store.state);
|
||||||
const isEncrypted = useCall((store) => store.isEncrypted);
|
const isEncrypted = useCall((store) => store.isEncrypted);
|
||||||
const callId = useCall((store) => store.callId);
|
const callId = useCall((store) => store.callId);
|
||||||
|
|
@ -68,7 +62,7 @@ function ConnectionBar({ portalContainer }: { portalContainer?: HTMLElement }) {
|
||||||
{state === "closed" && "Closed"}
|
{state === "closed" && "Closed"}
|
||||||
{state === "closing" && "Closing"}
|
{state === "closing" && "Closing"}
|
||||||
|
|
||||||
<TinyPingGraph portalContainer={portalContainer} />
|
<TinyPingGraph />
|
||||||
|
|
||||||
{isEncrypted ? (
|
{isEncrypted ? (
|
||||||
<Lock color="var(--primary-foreground-alt)" />
|
<Lock color="var(--primary-foreground-alt)" />
|
||||||
|
|
@ -78,18 +72,12 @@ function ConnectionBar({ portalContainer }: { portalContainer?: HTMLElement }) {
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
<TooltipContent>Click to open call page</TooltipContent>
|
||||||
Click to open call page
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TinyPingGraph({
|
export function TinyPingGraph() {
|
||||||
portalContainer,
|
|
||||||
}: {
|
|
||||||
portalContainer?: HTMLElement;
|
|
||||||
}) {
|
|
||||||
const room = useCall((store) => store.room);
|
const room = useCall((store) => store.room);
|
||||||
|
|
||||||
const [mapData, setMapData] = useState<Map<number, number>>(() => new Map());
|
const [mapData, setMapData] = useState<Map<number, number>>(() => new Map());
|
||||||
|
|
@ -176,7 +164,7 @@ export function TinyPingGraph({
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<TooltipContent portalProps={{ container: portalContainer }}>
|
<TooltipContent>
|
||||||
{data.length > 0 ? `${data.at(-1)?.ping} ms` : "Measuring ping..."}
|
{data.length > 0 ? `${data.at(-1)?.ping} ms` : "Measuring ping..."}
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,4 @@
|
||||||
- Disconnect
|
- Disconnect
|
||||||
- Desktop-App screenshares
|
- Desktop-App screenshares
|
||||||
- Context menus
|
- Context menus
|
||||||
|
- Popout Window
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue