Skip to content

Commit 516019f

Browse files
committed
feat: show rename banner if referred from postgres.new
1 parent 4b7d33b commit 516019f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

apps/postgres-new/components/layout.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,25 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from
1313

1414
const loadFramerFeatures = () => import('./framer-features').then((res) => res.default)
1515

16+
const legacyDomain = 'postgres.new'
17+
const referrerDomain =
18+
typeof window !== 'undefined' ? new URL(document.referrer).hostname || undefined : undefined
19+
20+
const isLegacyDomain = typeof window !== 'undefined' && window.location.hostname === legacyDomain
21+
const isLegacyDomainReferrer = referrerDomain === legacyDomain
22+
1623
export type LayoutProps = PropsWithChildren
1724

1825
export default function Layout({ children }: LayoutProps) {
1926
const { isPreview } = useApp()
2027
const isSmallBreakpoint = useBreakpoint('lg')
21-
const isLegacyDomain =
22-
typeof window !== 'undefined' && window.location.hostname === 'postgres.new'
2328

2429
return (
2530
<LazyMotion features={loadFramerFeatures}>
2631
<TooltipProvider delayDuration={0}>
2732
<div className="w-full h-full flex flex-col overflow-hidden">
2833
{isPreview && <PreviewBanner />}
29-
{isLegacyDomain && <RenameBanner />}
34+
{(isLegacyDomain || isLegacyDomainReferrer) && <RenameBanner />}
3035
<main className="flex-1 flex flex-col lg:flex-row min-h-0">
3136
{/* TODO: make sidebar available on mobile */}
3237
{!isSmallBreakpoint && <Sidebar />}

0 commit comments

Comments
 (0)