Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Bring in changes from master and resolve conflicts

Joshen Lim29de99835fbe
diff --cc studio/components/ui/PageTelemetry.tsx
index b83fbe11f94,24fd0e4bea5..967103ae7be
--- a/studio/components/ui/PageTelemetry.tsx
+++ b/studio/components/ui/PageTelemetry.tsx
@@@ -2,30 -3,21 +3,31 @@@ import { observer } from 'mobx-react-li
import { useRouter } from 'next/router'
import { PropsWithChildren, useEffect } from 'react'
- import { useParams, useTelemetryProps } from 'common'
import { useSelectedOrganization } from 'hooks'
import { post } from 'lib/common/fetch'
-import { API_URL, IS_PLATFORM } from 'lib/constants'
+import { API_URL, IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
+import { useAppStateSnapshot } from 'state/app-state'
const PageTelemetry = ({ children }: PropsWithChildren<{}>) => {
const router = useRouter()
const { ref } = useParams()
const telemetryProps = useTelemetryProps()
const selectedOrganization = useSelectedOrganization()
+ const snap = useAppStateSnapshot()
+
+ useEffect(() => {
+ const consent =
+ typeof window !== 'undefined'
+ ? localStorage.getItem(LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT)
+ : null
+ snap.setIsOptedInTelemetry(consent === 'true')
+ }, [])
+ const isLoggedIn = useIsLoggedIn()
+
useEffect(() => {
function handleRouteChange(url: string) {
- handlePageTelemetry(url)
+ if (snap.isOptedInTelemetry) handlePageTelemetry(url)
}
// Listen for page changes after a navigation or when the query changes
diff --cc studio/lib/constants/index.ts
index 0e42a8cb7a9,3a83865cdae..7d5fbe06451
--- a/studio/lib/constants/index.ts
+++ b/studio/lib/constants/index.ts
@@@ -88,5 -95,9 +95,10 @@@ export const USAGE_APPROACHING_THRESHOL
export const LOCAL_STORAGE_KEYS = {
RECENTLY_VISITED_ORGANIZATION: 'supabase-organization',
+ TELEMETRY_CONSENT: 'supabase-consent',
}
+
+ export const OPT_IN_TAGS = {
+ AI_SQL: 'AI_SQL_GENERATOR_OPT_IN',
+ PREVIEW_BRANCHES: 'PREVIEW_BRANCHES_OPT_IN',
+ }
diff --cc studio/pages/_app.tsx
index 179d9d7cace,32c606c65f3..9c5ff10e135
--- a/studio/pages/_app.tsx
+++ b/studio/pages/_app.tsx
@@@ -20,42 -27,30 +27,33 @@@ import customParseFormat from 'dayjs/pl
import relativeTime from 'dayjs/plugin/relativeTime'
import timezone from 'dayjs/plugin/timezone'
import utc from 'dayjs/plugin/utc'
-
- // @ts-ignore
- import Prism from 'prism-react-renderer/prism'
import Head from 'next/head'
-
- import { Hydrate, QueryClientProvider } from '@tanstack/react-query'
- import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
- import { ThemeProvider } from 'common'
- import { useRootQueryClient } from 'data/query-client'
- import { StoreProvider } from 'hooks'
- import { AuthProvider } from 'lib/auth'
- import { dart } from 'lib/constants/prism'
- import { ProfileProvider } from 'lib/profile'
-import { useEffect, useMemo, useState } from 'react'
+import { useEffect, useMemo, useRef, useState } from 'react'
- import { RootStore } from 'stores'
- import HCaptchaLoadedStore from 'stores/hcaptcha-loaded-store'
- import { AppPropsWithLayout } from 'types'
++import toast from 'react-hot-toast'
+ // @ts-ignore
+ import Prism from 'prism-react-renderer/prism'
+ import Favicons from 'components/head/Favicons'
import {
AppBannerWrapper,
CommandMenuWrapper,
PortalToast,
RouteValidationWrapper,
} from 'components/interfaces/App'
++import ConsentToast from 'components/ui/ConsentToast'
import FlagProvider from 'components/ui/Flag/FlagProvider'
import PageTelemetry from 'components/ui/PageTelemetry'
+ import { useRootQueryClient } from 'data/query-client'
+ import { StoreProvider } from 'hooks'
import useAutoAuthRedirect from 'hooks/misc/useAutoAuthRedirect'
-
- import { TooltipProvider } from '@radix-ui/react-tooltip'
- import { SessionContextProvider } from '@supabase/auth-helpers-react'
- import { createClient } from '@supabase/supabase-js'
- import Favicons from 'components/head/Favicons'
- import ConsentToast from 'components/ui/ConsentToast'
- import { IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
- import { toast } from 'react-hot-toast'
+ import { AuthProvider } from 'lib/auth'
-import { BASE_PATH, IS_PLATFORM } from 'lib/constants'
++import { BASE_PATH, IS_PLATFORM, LOCAL_STORAGE_KEYS } from 'lib/constants'
+ import { dart } from 'lib/constants/prism'
+ import { ProfileProvider } from 'lib/profile'
+import { useAppStateSnapshot } from 'state/app-state'
+ import { RootStore } from 'stores'
+ import HCaptchaLoadedStore from 'stores/hcaptcha-loaded-store'
+ import { AppPropsWithLayout } from 'types'
dayjs.extend(customParseFormat)
dayjs.extend(utc)
@@@ -63,10 -58,26 +61,28 @@@ dayjs.extend(timezone
dayjs.extend(relativeTime)
dart(Prism)
+ loader.config({
+ // [Joshen] Attempt for offline support/bypass ISP issues is to store the assets required for monaco
+ // locally. We're however, only storing the assets which we need (based on what the network tab loads
+ // while using monaco). If we end up facing more effort trying to maintain this, probably to either
+ // use cloudflare or find some way to pull all the files from a CDN via a CLI, rather than tracking individual files
+ // The alternative was to import * as monaco from 'monaco-editor' but i couldn't get it working
+ paths: {
+ vs: IS_PLATFORM
+ ? 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.37.0/min/vs'
+ : `${BASE_PATH}/monaco-editor`,
+ },
+ })
+
+ // [Joshen TODO] Once we settle on the new nav layout - we'll need a lot of clean up in terms of our layout components
+ // a lot of them are unnecessary and introduce way too many cluttered CSS especially with the height styles that make
+ // debugging way too difficult. Ideal scenario is we just have one AppLayout to control the height and scroll areas of
+ // the dashboard, all other layout components should not be doing that
+
function CustomApp({ Component, pageProps }: AppPropsWithLayout) {
+ const consentToastId = useRef<string>()
const queryClient = useRootQueryClient()
+ const snap = useAppStateSnapshot()
const [rootStore] = useState(() => new RootStore())
// [Joshen] Some issues with using createBrowserSupabaseClient