Files
supabase/apps/www/pages/_app.tsx
35de059bbd Feat/eagle 1 (#22730)
* content structure

* remove component

* reorder sections

* eagle new path

* nav

* meetups

* update lw11-og function with service key

* add ticket button in sticky nav

* disable and exit game when not in view

* enable light mode

* add placeholders

* highlights

* update

* typo

* fix mainDays import

* update og image

* update sections

* add hackathon link

* add video id

* add spaces and update ga

* remove highlights

* enterprise section

* highlights

* Adds the bootstrap post

* Updates the desc

* fixing tags

* fixing authors

* fix the admonition

* Adds the AWS post

* fixing categories

* Adds LW number

* Adds the branching post

* fix description

* chore: minor typos in blog post

* swift scaffold

* fix dates on all posts

* adds chris as the author

* Adds the branching tagline

* Adds oriole post

* updates oriole

* Fix caption

* Adds the YT video

* update GA page

* adds branching publicly available post

* bootstrap image update

* updated AWS images

* first section in GA

* update CLI bg

* Updates community

* fix build

* Adds scale section

* Adds all the sections

* updated images

* chore: adds partners and integrations

* padds out the swift post

* chore: whats new

* chore: whats next

* add chart

* updates AWS page

* chore: ai names

* section numbering

* Adds some stats for the community

* Adds humat

* edits

* edits

* update announcements

* add star growth

* update videoid

* Adds edits

* Update ga.tsx

* build stage svg color

* remove meetups link

* remove backticks

* update chart

* Add PWC

* add community stats

* Adds full URLs

* fix charts

* fix whats new

* fix broken HTML

* Fix orderign

* Fix swift video

* fix list

* spelling

* Update ga.tsx

* merge

* update community stats

from Ants feedback

* chore: links and small changes

* Change the category for Oriole

* add bg support

* Update ga.tsx

* fixes formatting on the quote

* update cta

* fixes

* add vercel partner

---------

Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Francesco Sansalvadore <francescosansalvadore@MacBook-Pro-2.local>
Co-authored-by: Francesco Sansalvadore <francescosansalvadore@mac.wind3.hub>
Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
Co-authored-by: Han Qiao <sweatybridge@gmail.com>
Co-authored-by: Alaister Young <a@alaisteryoung.com>
Co-authored-by: awalias <antwilson@hotmail.co.uk>
2024-04-15 12:16:43 +02:00

136 lines
4.0 KiB
TypeScript

import '@code-hike/mdx/styles'
import 'config/code-hike.scss'
import '../styles/index.css'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
import { AuthProvider, ThemeProvider, useTelemetryProps, useThemeSandbox } from 'common'
import { DefaultSeo } from 'next-seo'
import { AppProps } from 'next/app'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import { PortalToast, themes } from 'ui'
import { CommandMenuProvider } from 'ui-patterns/Cmdk'
import { useConsent } from 'ui-patterns/ConsentToast'
import MetaFaviconsPagesRouter, {
DEFAULT_FAVICON_ROUTE,
DEFAULT_FAVICON_THEME_COLOR,
} from 'common/MetaFavicons/pages-router'
import { API_URL, APP_NAME, DEFAULT_META_DESCRIPTION } from '~/lib/constants'
import { post } from '~/lib/fetchWrapper'
import supabase from '~/lib/supabase'
export default function App({ Component, pageProps }: AppProps) {
const router = useRouter()
const telemetryProps = useTelemetryProps()
const { consentValue, hasAcceptedConsent } = useConsent()
useThemeSandbox()
function handlePageTelemetry(route: string) {
return post(`${API_URL}/telemetry/page`, {
referrer: document.referrer,
title: document.title,
route,
ga: {
screen_resolution: telemetryProps?.screenResolution,
language: telemetryProps?.language,
},
})
}
useEffect(() => {
if (!hasAcceptedConsent) return
function handleRouteChange(url: string) {
handlePageTelemetry(url)
}
// Listen for page changes after a navigation or when the query changes
router.events.on('routeChangeComplete', handleRouteChange)
return () => {
router.events.off('routeChangeComplete', handleRouteChange)
}
}, [router.events, consentValue])
useEffect(() => {
if (!hasAcceptedConsent) return
/**
* Send page telemetry on first page load
*/
if (router.isReady) {
handlePageTelemetry(router.asPath)
}
}, [router.isReady, consentValue])
const site_title = `${APP_NAME} | The Open Source Firebase Alternative`
const { basePath, pathname } = useRouter()
const forceDarkMode = pathname === '/' || router.pathname.startsWith('/launch-week')
let applicationName = 'Supabase'
let faviconRoute = DEFAULT_FAVICON_ROUTE
let themeColor = DEFAULT_FAVICON_THEME_COLOR
if (router.asPath && router.asPath.includes('/launch-week/x')) {
applicationName = 'Supabase LWX'
faviconRoute = 'images/launchweek/lwx/favicon'
themeColor = 'FFFFFF'
}
return (
<>
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</Head>
<MetaFaviconsPagesRouter
applicationName={applicationName}
route={faviconRoute}
themeColor={themeColor}
includeManifest
includeMsApplicationConfig
includeRssXmlFeed
/>
<DefaultSeo
title={site_title}
description={DEFAULT_META_DESCRIPTION}
openGraph={{
type: 'website',
url: 'https://supabase.com/',
site_name: 'Supabase',
images: [
{
url: `https://supabase.com${basePath}/images/og/og-image-v2.jpg`,
width: 800,
height: 600,
alt: 'Supabase Og Image',
},
],
}}
twitter={{
handle: '@supabase',
site: '@supabase',
cardType: 'summary_large_image',
}}
/>
<SessionContextProvider supabaseClient={supabase}>
<AuthProvider>
<ThemeProvider
themes={themes.map((theme) => theme.value)}
defaultTheme="system"
enableSystem
disableTransitionOnChange
forcedTheme={forceDarkMode ? 'dark' : undefined}
>
<CommandMenuProvider site="website">
<PortalToast />
<Component {...pageProps} />
</CommandMenuProvider>
</ThemeProvider>
</AuthProvider>
</SessionContextProvider>
</>
)
}