chore: show Super demo modal if user doesn't have subscription when switching editor to Super

This commit is contained in:
Aman Harwara
2023-12-22 16:40:42 +05:30
committed by GitHub
parent 485339be86
commit 29b7e989a6
26 changed files with 482 additions and 119 deletions

View File

@@ -33,6 +33,7 @@ const PositionedPopoverContent = ({
hideOnClickInModal = false,
setAnimationElement,
containerClassName,
documentElement,
}: PopoverContentProps) => {
const [popoverElement, setPopoverElement] = useState<HTMLDivElement | null>(null)
const popoverRect = useAutoElementRect(popoverElement)
@@ -45,13 +46,13 @@ const PositionedPopoverContent = ({
y: anchorPoint?.y,
})
const anchorRect = anchorPoint ? anchorPointRect : anchorElementRect
const documentRect = useDocumentRect()
const _documentRect = useDocumentRect()
const isDesktopScreen = useMediaQuery(MediaQueryBreakpoints.md)
const styles = getPositionedPopoverStyles({
align,
anchorRect,
documentRect,
documentRect: documentElement?.getBoundingClientRect() ?? _documentRect,
popoverRect: popoverRect ?? popoverElement?.getBoundingClientRect(),
side,
disableMobileFullscreenTakeover,
@@ -73,7 +74,7 @@ const PositionedPopoverContent = ({
let adjustedStyles: PopoverCSSProperties | undefined = undefined
if (!portal && popoverElement && styles) {
adjustedStyles = getAdjustedStylesForNonPortalPopover(popoverElement, styles)
adjustedStyles = getAdjustedStylesForNonPortalPopover(popoverElement, styles, documentElement)
}
usePopoverCloseOnClickOutside({

View File

@@ -50,6 +50,7 @@ type CommonPopoverProps = {
offset?: number
hideOnClickInModal?: boolean
open: boolean
documentElement?: HTMLElement
}
export type PopoverContentProps = CommonPopoverProps & {

View File

@@ -6,7 +6,7 @@ export const getAdjustedStylesForNonPortalPopover = (
styles: PopoverCSSProperties,
parent?: HTMLElement,
) => {
const absoluteParent = parent || getAbsolutePositionedParent(popoverElement)
const absoluteParent = parent || getAbsolutePositionedParent(popoverElement) || popoverElement.parentElement
const translateXProperty = styles?.['--translate-x']
const translateYProperty = styles?.['--translate-y']