Files
supabase/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.tsx
T
439af38592 feat: add Supabase Cron (#30870)
* d3

* change Cron tagline to Schedule Recurring Jobs

* update images

* feat: add Supabase Cron docs (#30822)

* feat: postgres integrations

Create a new global navigation and homepage menu section for the Postgres Integrations category.
reorg: move cron docs into postgres integrations
feat: postgres integrations

Create a new global navigation and homepage menu section for the Postgres Integrations category.
reorg: move cron docs into postgres integrations
docs homepage layout

feat: postgres integrations

Create a new global navigation and homepage menu section for the Postgres Integrations category.
reorg: move cron docs into postgres integrations
feat: postgres integrations

Create a new global navigation and homepage menu section for the Postgres Integrations category.
reorg: move cron docs into postgres integrations
docs homepage layout

feat: postgres integrations

Create a new global navigation and homepage menu section for the Postgres Integrations category.
reorg: move cron docs into postgres integrations
feat: postgres integrations

Create a new global navigation and homepage menu section for the Postgres Integrations category.
reorg: move cron docs into postgres integrations
docs homepage layout

* fix: add pg_cron back to extensions sidebar

* update Supabase Cron docs

* Add screenshots to CRON guides (#30851)

add screenshots to CRON guides

* Update apps/docs/content/guides/cron.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/install.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/install.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/database/extensions/pg_cron.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* remove no longer needed cron mdx files

* move cron unschedule image to the right section

* link job history image

* update Cron taglines

---------

Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
Co-authored-by: Oliver Rice <github@oliverrice.com>

* Chore/cleanup 3 (#30861)

* cleanup

* rss

* LM images

* updates for Supabase Cron blog post (#30868)

---------

Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com>

* www cron (#30859)

* new products menu

* set up cron page

* set up cron page

* placeholder sections

* basic suggestion for cron

* video placeholder + images

* sql snippet

* Cron landing page updates

* change API to SQL

* cron page update

* cron page update

* cron logs image

* update ogs

* update image url

* update metadata

* update cron metadata

* cleanup

* updates to cron landing page

* more updates

---------

Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
Co-authored-by: Wen Bo Xie <wenbo.xie3@gmail.com>

* add Supabase Cron to www features page

* fix mobile nav and footer

* update images

* Update lw13_data.tsx

* update images

* remove old SVGs

* Update video link

* Fix a eslint error.

* Update apps/docs/content/guides/cron/quickstart.mdx

Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com>

* Update apps/www/_blog/2024-12-04-supabase-cron.mdx

Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>

* Sm edits

* add video slug

* Update apps/www/_blog/2024-12-04-supabase-cron.mdx

Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>

* plurals

* update citus data callout

* cleanup images

* fix yt embed in features page

* update images

* minizie

* accept Cron

* accept [Cc]ron

* fix vale?

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
Co-authored-by: Oliver Rice <github@oliverrice.com>
Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com>
2024-12-04 10:51:57 -04:00

273 lines
5.8 KiB
TypeScript

import { memo } from 'react'
import type { NavMenuSection } from '../Navigation.types'
import NavigationMenuGuideList from './NavigationMenuGuideList'
import NavigationMenuRefList from './NavigationMenuRefList'
import { useCloseMenuOnRouteChange } from './NavigationMenu.utils'
enum MenuId {
GettingStarted = 'gettingstarted',
Database = 'database',
Api = 'api',
Graphql = 'graphql',
Auth = 'auth',
Functions = 'functions',
Realtime = 'realtime',
Storage = 'storage',
Ai = 'ai',
Cron = 'cron',
Platform = 'platform',
Deployment = 'deployment',
MonitoringTroubleshooting = 'monitoring_troubleshooting',
Resources = 'resources',
SelfHosting = 'self_hosting',
Integrations = 'integrations',
LocalDevelopment = 'local_development',
RefJavaScriptV1 = 'reference_javascript_v1',
RefJavaScriptV2 = 'reference_javascript_v2',
RefDartV1 = 'reference_dart_v1',
RefDartV2 = 'reference_dart_v2',
RefCSharpV0 = 'reference_csharp_v0',
RefCSharpV1 = 'reference_csharp_v1',
RefPythonV2 = 'reference_python_v2',
RefSwiftV1 = 'reference_swift_v1',
RefSwiftV2 = 'reference_swift_v2',
RefKotlinV1 = 'reference_kotlin_v1',
RefKotlinV2 = 'reference_kotlin_v2',
RefKotlinV3 = 'reference_kotlin_v3',
RefCli = 'reference_cli',
RefApi = 'reference_api',
SelfHostingAuth = 'reference_self_hosting_auth',
SelfHostingStorage = 'reference_self_hosting_storage',
SelfHostingRealtime = 'reference_self_hosting_realtime',
SelfHostingAnalytics = 'reference_self_hosting_analytics',
SelfHostingFunctions = 'reference_self_hosting_functions',
}
interface BaseMenu {
id: MenuId
type: string
}
interface GuideMenu extends BaseMenu {
type: 'guide'
}
interface ReferenceMenu extends BaseMenu {
type: 'reference'
path: string
commonSectionsFile?: string
}
type Menu = GuideMenu | ReferenceMenu
const menus: Menu[] = [
{
id: MenuId.GettingStarted,
type: 'guide',
},
{
id: MenuId.Database,
type: 'guide',
},
{
id: MenuId.Api,
type: 'guide',
},
{
id: MenuId.Graphql,
type: 'guide',
},
{
id: MenuId.Auth,
type: 'guide',
},
{
id: MenuId.Functions,
type: 'guide',
},
{
id: MenuId.MonitoringTroubleshooting,
type: 'guide',
},
{
id: MenuId.Realtime,
type: 'guide',
},
{
id: MenuId.Storage,
type: 'guide',
},
{
id: MenuId.Ai,
type: 'guide',
},
{ id: MenuId.Cron, type: 'guide' },
{
id: MenuId.Platform,
type: 'guide',
},
{
id: MenuId.Resources,
type: 'guide',
},
{
id: MenuId.SelfHosting,
type: 'guide',
},
{
id: MenuId.Integrations,
type: 'guide',
},
{
id: MenuId.LocalDevelopment,
type: 'guide',
},
{
id: MenuId.Deployment,
type: 'guide',
},
{
id: MenuId.RefJavaScriptV1,
type: 'reference',
path: '/reference/javascript/v1',
},
{
id: MenuId.RefJavaScriptV2,
type: 'reference',
path: '/reference/javascript',
},
{
id: MenuId.RefDartV1,
type: 'reference',
path: '/reference/dart/v1',
},
{
id: MenuId.RefDartV2,
type: 'reference',
path: '/reference/dart',
},
{
id: MenuId.RefCSharpV0,
type: 'reference',
path: '/reference/csharp/v0',
},
{
id: MenuId.RefCSharpV1,
type: 'reference',
path: '/reference/csharp',
},
{
id: MenuId.RefPythonV2,
type: 'reference',
path: '/reference/python',
},
{
id: MenuId.RefSwiftV1,
type: 'reference',
path: '/reference/swift',
},
{
id: MenuId.RefSwiftV2,
type: 'reference',
path: '/reference/swift',
},
{
id: MenuId.RefKotlinV1,
type: 'reference',
path: '/reference/kotlin/v1',
},
{
id: MenuId.RefKotlinV2,
type: 'reference',
path: '/reference/kotlin/v2',
},
{
id: MenuId.RefKotlinV3,
type: 'reference',
path: '/reference/kotlin',
},
{
id: MenuId.RefCli,
type: 'reference',
path: '/reference/cli',
commonSectionsFile: 'common-cli-sections.json',
},
{
id: MenuId.RefApi,
type: 'reference',
path: '/reference/api',
commonSectionsFile: 'common-api-sections.json',
},
{
id: MenuId.SelfHostingAuth,
type: 'reference',
path: '/reference/self-hosting-auth',
commonSectionsFile: 'common-self-hosting-auth-sections.json',
},
{
id: MenuId.SelfHostingStorage,
type: 'reference',
path: '/reference/self-hosting-storage',
commonSectionsFile: 'common-self-hosting-storage-sections.json',
},
{
id: MenuId.SelfHostingRealtime,
type: 'reference',
path: '/reference/self-hosting-realtime',
commonSectionsFile: 'common-self-hosting-realtime-sections.json',
},
{
id: MenuId.SelfHostingAnalytics,
type: 'reference',
path: '/reference/self-hosting-analytics',
commonSectionsFile: 'common-self-hosting-analytics-sections.json',
},
{
id: MenuId.SelfHostingFunctions,
type: 'reference',
path: '/reference/self-hosting-functions',
commonSectionsFile: 'common-self-hosting-functions-sections.json',
},
]
function getMenuById(id: MenuId) {
return menus.find((menu) => menu.id === id)
}
function getMenuElement(menu: Menu | undefined, props?: any) {
const menuType = menu?.type
switch (menuType) {
case 'guide':
return <NavigationMenuGuideList id={menu.id} {...props} />
case 'reference':
return (
<NavigationMenuRefList
id={menu.id}
basePath={menu.path}
commonSectionsFile={menu.commonSectionsFile}
/>
)
default:
return null
}
}
const NavigationMenu = ({
menuId,
additionalNavItems,
}: {
menuId: MenuId
additionalNavItems?: Record<string, Partial<NavMenuSection>[]>
}) => {
const level = menuId
const menu = getMenuById(level)
useCloseMenuOnRouteChange()
return getMenuElement(menu, { additionalNavItems })
}
export { MenuId, getMenuById }
export default memo(NavigationMenu)