-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into tom/sql-missing-cursor
- Loading branch information
Showing
174 changed files
with
3,406 additions
and
2,172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-12.3 KB
(62%)
frontend/__snapshots__/filters-property-filter-button--filter-types--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-11.7 KB
(63%)
frontend/__snapshots__/filters-property-filter-button--filter-types--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-269 Bytes
(100%)
frontend/__snapshots__/replay-player-failure--recent-recordings-404--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--user-paths-edit--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
frontend/src/lib/components/IframedToolbarBrowser/IframedToolbarBrowser.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { LemonBanner, Spinner } from '@posthog/lemon-ui' | ||
import { useActions, useValues } from 'kea' | ||
import { useEffect } from 'react' | ||
import useResizeObserver from 'use-resize-observer' | ||
|
||
import { ToolbarUserIntent } from '~/types' | ||
|
||
import { appEditorUrl } from '../AuthorizedUrlList/authorizedUrlListLogic' | ||
import { iframedToolbarBrowserLogic } from './iframedToolbarBrowserLogic' | ||
|
||
function IframeErrorOverlay(): JSX.Element | null { | ||
const logic = iframedToolbarBrowserLogic() | ||
const { iframeBanner } = useValues(logic) | ||
return iframeBanner ? ( | ||
<div className="absolute flex flex-col w-full h-full bg-blend-overlay items-start py-4 px-8 pointer-events-none"> | ||
<LemonBanner className="w-full" type={iframeBanner.level}> | ||
{iframeBanner.message}. Your site might not allow being embedded in an iframe. You can click "Open in | ||
toolbar" above to visit your site and view the heatmap there. | ||
</LemonBanner> | ||
</div> | ||
) : null | ||
} | ||
|
||
function LoadingOverlay(): JSX.Element | null { | ||
const logic = iframedToolbarBrowserLogic() | ||
const { loading } = useValues(logic) | ||
return loading ? ( | ||
<div className="absolute flex flex-col w-full h-full items-center justify-center pointer-events-none"> | ||
<Spinner className="text-5xl" textColored={true} /> | ||
</div> | ||
) : null | ||
} | ||
|
||
export function IframedToolbarBrowser({ | ||
iframeRef, | ||
userIntent, | ||
}: { | ||
iframeRef?: React.MutableRefObject<HTMLIFrameElement | null> | ||
userIntent: ToolbarUserIntent | ||
}): JSX.Element | null { | ||
const logic = iframedToolbarBrowserLogic() | ||
|
||
const { browserUrl } = useValues(logic) | ||
const { onIframeLoad, setIframeWidth } = useActions(logic) | ||
|
||
const { width: iframeWidth } = useResizeObserver<HTMLIFrameElement>({ ref: iframeRef }) | ||
useEffect(() => { | ||
setIframeWidth(iframeWidth ?? null) | ||
}, [iframeWidth]) | ||
|
||
return browserUrl ? ( | ||
<div className="relative flex-1 w-full h-full"> | ||
<IframeErrorOverlay /> | ||
<LoadingOverlay /> | ||
<iframe | ||
ref={iframeRef} | ||
className="w-full h-full" | ||
src={appEditorUrl(browserUrl, { | ||
userIntent: userIntent, | ||
})} | ||
// eslint-disable-next-line react/forbid-dom-props | ||
style={{ | ||
background: '#FFF', | ||
}} | ||
onLoad={onIframeLoad} | ||
// these two sandbox values are necessary so that the site and toolbar can run | ||
// this is a very loose sandbox, | ||
// but we specify it so that at least other capabilities are denied | ||
sandbox="allow-scripts allow-same-origin" | ||
// we don't allow things such as camera access though | ||
allow="" | ||
/> | ||
</div> | ||
) : null | ||
} |
Oops, something went wrong.