@@ -9,9 +9,19 @@ import { TooltipProvider } from '~/components/ui/tooltip'
99import { useBreakpoint } from '~/lib/use-breakpoint'
1010import { useApp } from './app-provider'
1111import Sidebar from './sidebar'
12+ import { Dialog , DialogContent , DialogHeader , DialogTitle , DialogTrigger } from './ui/dialog'
1213
1314const loadFramerFeatures = ( ) => import ( './framer-features' ) . then ( ( res ) => res . default )
1415
16+ const legacyDomain = 'postgres.new'
17+ const referrerDomain =
18+ typeof window !== 'undefined' && document . referrer
19+ ? new URL ( document . referrer ) . hostname || undefined
20+ : undefined
21+
22+ const isLegacyDomain = typeof window !== 'undefined' && window . location . hostname === legacyDomain
23+ const isLegacyDomainReferrer = referrerDomain === legacyDomain
24+
1525export type LayoutProps = PropsWithChildren
1626
1727export default function Layout ( { children } : LayoutProps ) {
@@ -22,12 +32,8 @@ export default function Layout({ children }: LayoutProps) {
2232 < LazyMotion features = { loadFramerFeatures } >
2333 < TooltipProvider delayDuration = { 0 } >
2434 < div className = "w-full h-full flex flex-col overflow-hidden" >
25- { isPreview && (
26- < div className = "px-3 py-3 flex justify-center text-sm text-center bg-neutral-800 text-white" >
27- Heads up! This is a preview version of postgres.new, so expect some changes here and
28- there.
29- </ div >
30- ) }
35+ { isPreview && < PreviewBanner /> }
36+ { ( isLegacyDomain || isLegacyDomainReferrer ) && < RenameBanner /> }
3137 < main className = "flex-1 flex flex-col lg:flex-row min-h-0" >
3238 { /* TODO: make sidebar available on mobile */ }
3339 { ! isSmallBreakpoint && < Sidebar /> }
@@ -40,3 +46,43 @@ export default function Layout({ children }: LayoutProps) {
4046 </ LazyMotion >
4147 )
4248}
49+
50+ function PreviewBanner ( ) {
51+ return (
52+ < div className = "px-3 py-3 flex justify-center text-sm text-center bg-neutral-800 text-white" >
53+ Heads up! This is a preview version of postgres.new, so expect some changes here and there.
54+ </ div >
55+ )
56+ }
57+
58+ function RenameBanner ( ) {
59+ return (
60+ < div className = "px-3 py-3 flex justify-center text-sm text-center bg-neutral-800 text-white" >
61+ < span >
62+ Heads up - < strong > postgres.new</ strong > is renaming to < strong > database.build</ strong > .{ ' ' }
63+ < Dialog >
64+ < DialogTrigger className = "underline" > Why?</ DialogTrigger >
65+ < DialogContent className = "max-w-2xl" >
66+ < DialogHeader >
67+ < DialogTitle > Why is postgres.new renaming?</ DialogTitle >
68+ < div className = "py-2 border-b" />
69+ </ DialogHeader >
70+ < p >
71+ We are renaming due to a trademark conflict on the name "Postgres". To
72+ respect intellectual property rights, we are transitioning to our new name,{ ' ' }
73+ < a href = "https://database.build" className = "underline" >
74+ database.build
75+ </ a >
76+ .
77+ </ p >
78+ < p >
79+ { ' ' }
80+ Renaming will allow us to continue offering the same experience under a different name
81+ without any interruptions to the service.
82+ </ p >
83+ </ DialogContent >
84+ </ Dialog >
85+ </ span >
86+ </ div >
87+ )
88+ }
0 commit comments