Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion server/app/client/[channelId]/[section]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { UIAgentContext, useAppConnected, useAppInfo, useComponentTree, useConsole, useDatabases, useLocalStorage, useLocation, useNetworkRequests, usePlatformInfo, useStorageEntries, useTimelineLog } from "@/hooks/hooks";
import { Tabs, Tab, Button, Input, DropdownMenu, DropdownItem, Dropdown, DropdownTrigger, ButtonGroup } from "@nextui-org/react";
import { Tabs, Tab, Button, Input, DropdownMenu, DropdownItem, Dropdown, DropdownTrigger, ButtonGroup, Tooltip } from "@nextui-org/react";
import { useRouter } from "next/navigation";
import { useContext, useState, useEffect , useMemo, useCallback} from "react";
import { Info } from "./info";
Expand Down Expand Up @@ -64,6 +64,7 @@ function PulsePage({ section, refresh, channelId }: { section: string, refresh:
const [appId, setAppId] = useState(localStorage.getItem('wavepulse.lastopenedapp.id') || 'com.application.id'); //should get props.path into this page
const [expoUrl, setExpoUrl] = useState(localStorage.getItem('wavepulse.lastopenedexpo.url') || '');
const [url, setUrl] = useState('');
const [isIframe, setIsIframe] = useState(false);
const [selectedConnectOption, setSelectedConnectOption] = useState(['mobile']);
useEffect(() => {
if (selectedConnectOption[0] === 'mobile') {
Expand All @@ -79,6 +80,11 @@ function PulsePage({ section, refresh, channelId }: { section: string, refresh:
uiAgent.onConnect(() => {
setIsConnected(uiAgent.isConnected);
});
try {
setIsIframe(window.self !== window.top);
} catch {
setIsIframe(true);
}
}, []);
useEffect(() => {
setIsConnected(!!uiAgent.sessionDataKey);
Expand All @@ -95,6 +101,16 @@ function PulsePage({ section, refresh, channelId }: { section: string, refresh:
},[]);
return (
<div className="w-full h-full flex flex-col">
{isIframe && <Tooltip content="Open WavePulse in a new tab" className="bg-black text-white text-xs" showArrow={true}>
<Button
className="min-w-0 p-0 px-2 bg-transparent absolute right-36 h-8"
onClick={() => {window.open(window.location.href, '_blank')}}
>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.15039 1.9502C6.30458 1.95028 6.43637 2.00316 6.54199 2.10938C6.6475 2.21555 6.70018 2.34795 6.7002 2.50293C6.7002 2.65788 6.64692 2.78912 6.54102 2.89355C6.43532 2.99764 6.30425 3.04972 6.15039 3.0498H3.0498V12.9502H12.9502V9.84961C12.9503 9.69541 13.0032 9.56363 13.1094 9.45801C13.2155 9.3525 13.3479 9.29982 13.5029 9.2998C13.6579 9.2998 13.7891 9.35308 13.8936 9.45898C13.9976 9.56468 14.0497 9.69574 14.0498 9.84961V13C14.0498 13.2808 13.9441 13.5266 13.7354 13.7354C13.5266 13.9441 13.2808 14.0498 13 14.0498H3C2.71921 14.0498 2.47339 13.9441 2.26465 13.7354C2.0559 13.5266 1.9502 13.2808 1.9502 13V3C1.9502 2.71921 2.0559 2.47339 2.26465 2.26465C2.47339 2.0559 2.71921 1.9502 3 1.9502H6.15039ZM13.5 1.9502C13.6543 1.9502 13.7859 2.0028 13.8916 2.1084C13.9972 2.21412 14.0498 2.34575 14.0498 2.5V6.84961C14.0498 7.00385 13.9968 7.13567 13.8906 7.24121C13.7844 7.34692 13.6521 7.40037 13.4971 7.40039C13.3422 7.40039 13.2108 7.34714 13.1064 7.24121C13.0023 7.13555 12.9502 7.00364 12.9502 6.84961V3.83691L6.75195 10.0352C6.64273 10.1444 6.51248 10.1976 6.36426 10.1914C6.21774 10.1852 6.08965 10.1268 5.98145 10.0186C5.87281 9.90992 5.81652 9.78106 5.81641 9.63379C5.81641 9.48633 5.8727 9.35679 5.98145 9.24805L12.1797 3.0498H9.15039C8.99615 3.0498 8.86434 2.99679 8.75879 2.89062C8.65308 2.78444 8.59963 2.6521 8.59961 2.49707C8.59961 2.3422 8.65286 2.21085 8.75879 2.10645C8.86445 2.00224 8.99636 1.9502 9.15039 1.9502H13.5Z" fill="#2294EF" stroke="#2294EF" stroke-width="0.1"/>
</svg>
</Button>
</Tooltip>}
<Button
className="w-40 px-4 bg-transparent absolute right-0 h-8"
onClick={() => {
Expand Down