diff --git a/apps/www/lib/constants.ts b/apps/www/lib/constants.ts index b1143f5d6f7..2bbc4bf52d8 100644 --- a/apps/www/lib/constants.ts +++ b/apps/www/lib/constants.ts @@ -35,7 +35,6 @@ export const SITE_URL = : 'http://localhost:3000/launch-week' export const SITE_ORIGIN = new URL(SITE_URL).origin export const TWITTER_USER_NAME = 'supabase' -export const COOKIE = 'supa-launch-week-ticke-user-id' export const DATE = 'April 10th 2023' export const TWEET_TEXT = "It's almost #SupaLaunchWeek 7! Generate your unique ticket here 👇 you can win a mechanical keyboard 🤩" diff --git a/apps/www/pages/_app.tsx b/apps/www/pages/_app.tsx index b35d2bfbedd..467aed83e82 100644 --- a/apps/www/pages/_app.tsx +++ b/apps/www/pages/_app.tsx @@ -1,23 +1,24 @@ -import '../../../packages/ui/build/css/themes/light.css' -import '../../../packages/ui/build/css/themes/dark.css' - -import '../styles/index.css' +import { useEffect } from 'react' +import { AppProps } from 'next/app' +import Head from 'next/head' +import { useRouter } from 'next/router' +import { DefaultSeo } from 'next-seo' import { API_URL, APP_NAME, DEFAULT_META_DESCRIPTION } from 'lib/constants' -import { DefaultSeo } from 'next-seo' -import { AppProps } from 'next/app' -import { useRouter } from 'next/router' -import { useEffect } from 'react' import Meta from '~/components/Favicons' -import '../styles/index.css' import { post } from '~/lib/fetchWrapper' -import { AuthProvider, ThemeProvider, useTelemetryProps } from 'common' -import Head from 'next/head' +import PortalToast from 'ui/src/layout/PortalToast' +import { AuthProvider, ThemeProvider, useConsent, useTelemetryProps } from 'common' + +import '../../../packages/ui/build/css/themes/light.css' +import '../../../packages/ui/build/css/themes/dark.css' +import '../styles/index.css' import 'config/code-hike.scss' -export default function MyApp({ Component, pageProps }: AppProps) { +export default function App({ Component, pageProps }: AppProps) { const router = useRouter() const telemetryProps = useTelemetryProps() + const { consentValue, hasAcceptedConsent } = useConsent() function handlePageTelemetry(route: string) { return post(`${API_URL}/telemetry/page`, { @@ -32,6 +33,8 @@ export default function MyApp({ Component, pageProps }: AppProps) { } useEffect(() => { + if (!hasAcceptedConsent) return + function handleRouteChange(url: string) { handlePageTelemetry(url) } @@ -41,16 +44,17 @@ export default function MyApp({ Component, pageProps }: AppProps) { return () => { router.events.off('routeChangeComplete', handleRouteChange) } - }, [router.events]) + }, [router.events, consentValue]) useEffect(() => { + if (!hasAcceptedConsent) return /** * Send page telemetry on first page load */ if (router.isReady) { handlePageTelemetry(router.asPath) } - }, [router.isReady]) + }, [router.isReady, consentValue]) const site_title = `${APP_NAME} | The Open Source Firebase Alternative` const { basePath } = useRouter() @@ -85,6 +89,7 @@ export default function MyApp({ Component, pageProps }: AppProps) { /> + diff --git a/apps/www/public/planetpg-egor_romanov-rss.xml b/apps/www/public/planetpg-egor_romanov-rss.xml new file mode 100644 index 00000000000..6eddea8089c --- /dev/null +++ b/apps/www/public/planetpg-egor_romanov-rss.xml @@ -0,0 +1,19 @@ + + + + 'Postgres | Supabase Blog + https://supabase.com/blog + Latest Postgres news from Egor Romanov at Supabase + en + Wed, 12 Jul 2023 22:00:00 GMT + + + https://supabase.com/blog/pgvector-performance + pgvector 0.4.0 performance + https://supabase.com/blog/pgvector-performance + There's been lot of talk about pgvector performance lately, so we took some datasets and pushed pgvector to the limits to find out its strengths and limitations. + Wed, 12 Jul 2023 22:00:00 GMT + + + + diff --git a/apps/www/public/planetpg-pavel-rss.xml b/apps/www/public/planetpg-pavel-rss.xml index c5be079063a..b0e33cbb033 100644 --- a/apps/www/public/planetpg-pavel-rss.xml +++ b/apps/www/public/planetpg-pavel-rss.xml @@ -5,9 +5,16 @@ https://supabase.com/blog Latest Postgres news from Pavel Borisov at Supabase en - Thu, 15 Dec 2022 23:00:00 GMT + Wed, 12 Jul 2023 22:00:00 GMT + https://supabase.com/blog/pgvector-performance + pgvector 0.4.0 performance + https://supabase.com/blog/pgvector-performance + There's been lot of talk about pgvector performance lately, so we took some datasets and pushed pgvector to the limits to find out its strengths and limitations. + Wed, 12 Jul 2023 22:00:00 GMT + + https://supabase.com/blog/new-in-postgres-15 What's new in Postgres 15? https://supabase.com/blog/new-in-postgres-15 diff --git a/apps/www/public/rss.xml b/apps/www/public/rss.xml index d04b0a987a4..21dd685f16a 100644 --- a/apps/www/public/rss.xml +++ b/apps/www/public/rss.xml @@ -5,9 +5,16 @@ https://supabase.com Latest news from Supabase en - Tue, 11 Jul 2023 22:00:00 GMT + Wed, 12 Jul 2023 22:00:00 GMT + https://supabase.com/blog/pgvector-performance + pgvector 0.4.0 performance + https://supabase.com/blog/pgvector-performance + There's been lot of talk about pgvector performance lately, so we took some datasets and pushed pgvector to the limits to find out its strengths and limitations. + Wed, 12 Jul 2023 22:00:00 GMT + + https://supabase.com/blog/postgrest-11-1-release What is new in PostgREST v11.1? https://supabase.com/blog/postgrest-11-1-release diff --git a/package-lock.json b/package-lock.json index e67029b1b73..36fb978643b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4362,6 +4362,36 @@ "@mdx-js/react": "*" } }, + "node_modules/@next/swc-android-arm-eabi": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.2.tgz", + "integrity": "sha512-r2rrz+DZ8YYGqzVrbRrpP6GKzwozpOrnFbErc4k36vUTSFMag9yQahZfaBe06JYdqu/e5yhm/saIDEaSVPRP4g==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-android-arm64": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.2.tgz", + "integrity": "sha512-B+TINJhCf+CrY1+b3/JWQlkecv53rAGa/gA7gi5B1cnBa/2Uvoe+Ue0JeCefTjfiyl1ScsyNx+NcESY8Ye2Ngg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@next/swc-darwin-arm64": { "version": "12.3.2", "cpu": [ @@ -4376,6 +4406,156 @@ "node": ">= 10" } }, + "node_modules/@next/swc-darwin-x64": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.2.tgz", + "integrity": "sha512-1HkjmS9awwlaeEY8Y01nRSNkSv3y+qnC/mjMPe/W66hEh3QKa/LQHqHeS7NOdEs19B2mhZ7w+EgMRXdLQ0Su8w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-freebsd-x64": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.2.tgz", + "integrity": "sha512-h5Mx0BKDCJ5Vu/U8e07esF6PjPv1EJgmRbYWTUZMAflu13MQpCJkKEJir7+BeRfTXRfgFf+llc7uocrpd7mcrg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm-gnueabihf": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.2.tgz", + "integrity": "sha512-EuRZAamoxfe/WoWRaC0zsCAoE4gs/mEhilcloNM4J5Mnb3PLY8PZV394W7t5tjBjItMCF7l2Ebwjwtm46tq2RA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.2.tgz", + "integrity": "sha512-T9GCFyOIb4S3acA9LqflUYD+QZ94iZketHCqKdoO0Nx0OCHIgGJV5rotDe8TDXwh/goYpIfyHU4j1qqw4w4VnA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.2.tgz", + "integrity": "sha512-hxNVZS6L3c2z3l9EH2GP0MGQ9exu6O8cohYNZyqC9WUl6C03sEn8xzDH1y+NgD3fVurvYkGU5F0PDddJJLfDIw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.2.tgz", + "integrity": "sha512-fCPkLuwDwY8/QeXxciJJjDHG09liZym/Bhb4A+RLFQ877wUkwFsNWDUTSdUx0YXlYK/1gf67BKauqKkOKp6CYw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.2.tgz", + "integrity": "sha512-o+GifBIQ2K+/MEFxHsxUZoU3bsuVFLXZYWd3idimFHiVdDCVYiKsY6mYMmKDlucX+9xRyOCkKL9Tjf+3tuXJpw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.2.tgz", + "integrity": "sha512-crii66irzGGMSUR0L8r9+A06eTv7FTXqw4rgzJ33M79EwQJOdpY7RVKXLQMurUhniEeQEEOfamiEdPIi/qxisw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.2.tgz", + "integrity": "sha512-5hRUSvn3MdQ4nVRu1rmKxq5YJzpTtZfaC/NyGw6wa4NSF1noUn/pdQGUr+I5Qz3CZkd1gZzzC0eaXQHlrk0E2g==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.2.tgz", + "integrity": "sha512-tpQJYUH+TzPMIsdVl9fH8uDg47iwiNjKY+8e9da3dXqlkztKzjSw0OwSADoqh3KrifplXeKSta+BBGLdBqg3sg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "license": "MIT", @@ -42261,186 +42441,6 @@ "engines": { "node": ">=14.17" } - }, - "node_modules/@next/swc-android-arm-eabi": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.2.tgz", - "integrity": "sha512-r2rrz+DZ8YYGqzVrbRrpP6GKzwozpOrnFbErc4k36vUTSFMag9yQahZfaBe06JYdqu/e5yhm/saIDEaSVPRP4g==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-android-arm64": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.2.tgz", - "integrity": "sha512-B+TINJhCf+CrY1+b3/JWQlkecv53rAGa/gA7gi5B1cnBa/2Uvoe+Ue0JeCefTjfiyl1ScsyNx+NcESY8Ye2Ngg==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-darwin-x64": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.2.tgz", - "integrity": "sha512-1HkjmS9awwlaeEY8Y01nRSNkSv3y+qnC/mjMPe/W66hEh3QKa/LQHqHeS7NOdEs19B2mhZ7w+EgMRXdLQ0Su8w==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-freebsd-x64": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.2.tgz", - "integrity": "sha512-h5Mx0BKDCJ5Vu/U8e07esF6PjPv1EJgmRbYWTUZMAflu13MQpCJkKEJir7+BeRfTXRfgFf+llc7uocrpd7mcrg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm-gnueabihf": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.2.tgz", - "integrity": "sha512-EuRZAamoxfe/WoWRaC0zsCAoE4gs/mEhilcloNM4J5Mnb3PLY8PZV394W7t5tjBjItMCF7l2Ebwjwtm46tq2RA==", - "cpu": [ - "arm" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-gnu": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.2.tgz", - "integrity": "sha512-T9GCFyOIb4S3acA9LqflUYD+QZ94iZketHCqKdoO0Nx0OCHIgGJV5rotDe8TDXwh/goYpIfyHU4j1qqw4w4VnA==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-arm64-musl": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.2.tgz", - "integrity": "sha512-hxNVZS6L3c2z3l9EH2GP0MGQ9exu6O8cohYNZyqC9WUl6C03sEn8xzDH1y+NgD3fVurvYkGU5F0PDddJJLfDIw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-gnu": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.2.tgz", - "integrity": "sha512-fCPkLuwDwY8/QeXxciJJjDHG09liZym/Bhb4A+RLFQ877wUkwFsNWDUTSdUx0YXlYK/1gf67BKauqKkOKp6CYw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-linux-x64-musl": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.2.tgz", - "integrity": "sha512-o+GifBIQ2K+/MEFxHsxUZoU3bsuVFLXZYWd3idimFHiVdDCVYiKsY6mYMmKDlucX+9xRyOCkKL9Tjf+3tuXJpw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-arm64-msvc": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.2.tgz", - "integrity": "sha512-crii66irzGGMSUR0L8r9+A06eTv7FTXqw4rgzJ33M79EwQJOdpY7RVKXLQMurUhniEeQEEOfamiEdPIi/qxisw==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.2.tgz", - "integrity": "sha512-5hRUSvn3MdQ4nVRu1rmKxq5YJzpTtZfaC/NyGw6wa4NSF1noUn/pdQGUr+I5Qz3CZkd1gZzzC0eaXQHlrk0E2g==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.2.tgz", - "integrity": "sha512-tpQJYUH+TzPMIsdVl9fH8uDg47iwiNjKY+8e9da3dXqlkztKzjSw0OwSADoqh3KrifplXeKSta+BBGLdBqg3sg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } } } } diff --git a/packages/common/hooks/index.ts b/packages/common/hooks/index.ts index 65b5a76ec98..353ef9decda 100644 --- a/packages/common/hooks/index.ts +++ b/packages/common/hooks/index.ts @@ -1,3 +1,4 @@ export * from './useBreakpoint' +export * from './useConsent' export * from './useParams' export * from './useTelemetryProps' diff --git a/packages/common/hooks/useConsent.tsx b/packages/common/hooks/useConsent.tsx new file mode 100644 index 00000000000..399ae569f71 --- /dev/null +++ b/packages/common/hooks/useConsent.tsx @@ -0,0 +1,40 @@ +import { useEffect, useRef, useState } from 'react' +import { toast } from 'react-hot-toast' +import ConsentToast from 'ui/src/components/ConsentToast' + +// Use with PortalToast from 'ui/src/layout/PortalToast' +export const useConsent = () => { + const consentToastId = useRef() + const isClient = typeof window !== 'undefined' + if (!isClient) return {} + const TELEMETRY_CONSENT = 'supabase-consent' + const [consentValue, setConsentValue] = useState( + localStorage?.getItem(TELEMETRY_CONSENT) + ) + + const handleConsent = (value: 'true' | 'false') => { + if (!isClient) return + setConsentValue(value) + localStorage.setItem(TELEMETRY_CONSENT, value) + + if (consentToastId.current) toast.dismiss(consentToastId.current) + } + + useEffect(() => { + if (isClient && consentValue === null) { + consentToastId.current = toast( + handleConsent('true')} + onOptOut={() => handleConsent('false')} + />, + { + id: 'consent-toast', + position: 'bottom-right', + duration: Infinity, + } + ) + } + }, [consentValue]) + + return { consentValue, setConsentValue, hasAcceptedConsent: consentValue === 'true' } +} diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx index f1c481e4a50..da7e0b0baee 100644 --- a/packages/ui/index.tsx +++ b/packages/ui/index.tsx @@ -36,9 +36,11 @@ export * from './src/components/Menu' export * from './src/components/Modal' export * from './src/components/SidePanel' export * from './src/components/Dropdown' +export * from './src/components/ConsentToast' export * from './src/components/ContextMenu' export * from './src/components/Popover' export * from './src/components/ExpandableVideo' +export * from './src/layout/PortalToast' // UTILITIES diff --git a/packages/ui/src/components/ConsentToast/ConsentToast.tsx b/packages/ui/src/components/ConsentToast/ConsentToast.tsx new file mode 100644 index 00000000000..e8216283013 --- /dev/null +++ b/packages/ui/src/components/ConsentToast/ConsentToast.tsx @@ -0,0 +1,39 @@ +import { noop } from 'lodash' +import Link from 'next/link' +import { Button } from 'ui' +import { useRouter } from 'next/router' + +interface ConsentToastProps { + onAccept: () => void + onOptOut: () => void +} + +const ConsentToast = ({ onAccept = noop, onOptOut = noop }: ConsentToastProps) => { + const { basePath } = useRouter() + + return ( +
+
+

+ This site does not use cookies 🍪 +

+

We use friendly server side analytics to measure and improve your experience

+
+
+ + + + + + + +
+
+ ) +} + +export default ConsentToast diff --git a/packages/ui/src/components/ConsentToast/index.ts b/packages/ui/src/components/ConsentToast/index.ts new file mode 100644 index 00000000000..d0afb7d9651 --- /dev/null +++ b/packages/ui/src/components/ConsentToast/index.ts @@ -0,0 +1,3 @@ +import ConsentToast from './ConsentToast' + +export default ConsentToast diff --git a/packages/ui/src/layout/PortalToast/PortalToast.tsx b/packages/ui/src/layout/PortalToast/PortalToast.tsx new file mode 100644 index 00000000000..6247f336373 --- /dev/null +++ b/packages/ui/src/layout/PortalToast/PortalToast.tsx @@ -0,0 +1,71 @@ +import dynamic from 'next/dynamic' +import { Toaster, ToastBar, toast } from 'react-hot-toast' +import { Button, IconX } from 'ui' + +const PortalRootWithNoSSR = dynamic( + // @ts-ignore + () => import('@radix-ui/react-portal').then((portal) => portal.Root), + { ssr: false } +) + +const PortalToast = () => ( + // @ts-ignore + + + {(t) => ( + + {({ icon, message }) => { + const isConsentToast = t.id === 'consent-toast' + return ( + <> + {icon} +
+
+ {message} +
+ {t.type !== 'loading' && !isConsentToast && ( +
+ +
+ )} +
+ + ) + }} +
+ )} +
+
+) + +export default PortalToast diff --git a/packages/ui/src/layout/PortalToast/index.tsx b/packages/ui/src/layout/PortalToast/index.tsx new file mode 100644 index 00000000000..08750aa475e --- /dev/null +++ b/packages/ui/src/layout/PortalToast/index.tsx @@ -0,0 +1,3 @@ +import PortalToast from './PortalToast' + +export default PortalToast