Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: command menu v2 #22300

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
9694064
feat: command menu v2
charislam Mar 27, 2024
28103d2
develop: fill out features
charislam Mar 27, 2024
37f866b
develop: fill out features
charislam Mar 27, 2024
d0c7873
develop: fill out features
charislam Mar 27, 2024
4f80442
develop: hook up to app
charislam Mar 27, 2024
3ba2562
refactor: use valtio to optimize state
charislam Mar 27, 2024
54c51a3
feat: add command menu v2 to studio for testing
charislam Mar 27, 2024
f144277
polish: minor tweaks
charislam Mar 27, 2024
f2ac902
fix: command dismount
charislam Mar 28, 2024
6f91f53
chore: clean up dead code
charislam Mar 28, 2024
f29926e
develop: put some dummy text in interfaces
charislam Mar 30, 2024
de10bf4
refactor: rename hook
charislam Apr 9, 2024
5361602
refactor: replace cmdk primitives with ui exports
charislam Apr 9, 2024
0c9dfa4
enhance: restore previous styling and partial functionality
charislam Apr 9, 2024
3295deb
fix: remove command menu bits torn out of apps
charislam Apr 9, 2024
c58296f
feat: get docs search working again
charislam Apr 9, 2024
871f5af
feat: get skeleton of ai responses back in
charislam Apr 9, 2024
8e54653
feat: add back skeleton of generatesql
charislam Apr 10, 2024
d6c26d1
feat: get generatesql working fully
charislam Apr 10, 2024
093b73d
feat: get api keys mostly working
charislam Apr 10, 2024
4d82b60
feat: get apikeys working properly
charislam Apr 11, 2024
e3a7578
feat: add project switcher
charislam Apr 11, 2024
8e63332
feat: add theme switcher
charislam Apr 11, 2024
bef3c48
feat: add support commands
charislam Apr 11, 2024
517f52a
enhance: minor dx improvement by defaulting query reset behavior on p…
charislam Apr 11, 2024
5b55176
enhance: add icons to everything
charislam Apr 11, 2024
d42b1f0
fix: fix ordering bug
charislam Apr 11, 2024
91f9f91
feat: add branch switcher
charislam Apr 11, 2024
bbac1a7
feat: add docs navigation commands
charislam Apr 11, 2024
ba4c972
feat: add changelog command
charislam Apr 11, 2024
e653119
feat: restore all commands from previous version
charislam Apr 11, 2024
636a2d6
feat: minor polish of www version
charislam Apr 11, 2024
ae215fc
chore: add testing package
charislam Apr 12, 2024
fb9bea9
chore: install testing packages
charislam Apr 15, 2024
9412461
dev,fix: fix type errors
charislam Apr 22, 2024
d845dd4
Merge branch 'master' into feat/command-menu-v2
charislam Apr 30, 2024
803c731
Merge branch 'master' into feat/command-menu-v2
charislam May 1, 2024
1b33caf
Merge branch 'master' into feat/command-menu-v2
charislam May 2, 2024
94aa742
use new router for transitions
charislam May 3, 2024
748ae3e
Revert "use new router for transitions"
charislam May 3, 2024
68cc828
Reapply "use new router for transitions"
charislam May 3, 2024
ad77d69
Revert "Reapply "use new router for transitions""
charislam May 3, 2024
c8d7e3d
Merge branch 'master' into feat/command-menu-v2
charislam May 6, 2024
db190e9
Merge branch 'master' into feat/command-menu-v2
charislam May 7, 2024
27ea662
Merge branch 'master' into feat/command-menu-v2
charislam May 8, 2024
1e8e28c
Merge branch 'master' into feat/command-menu-v2
charislam May 9, 2024
26cbc3a
Merge branch 'master' into feat/command-menu-v2
charislam May 10, 2024
964da7e
Merge branch 'master' into feat/command-menu-v2
charislam May 22, 2024
e566c66
Merge branch 'master' into feat/command-menu-v2
charislam May 22, 2024
a6c6eb5
Merge branch 'master' into feat/command-menu-v2
charislam May 23, 2024
fd176b3
Merge branch 'master' into feat/command-menu-v2
charislam May 29, 2024
83f73ec
Merge branch 'master' into feat/command-menu-v2
charislam Jun 4, 2024
30ef459
Merge branch 'master' into feat/command-menu-v2
charislam Jun 4, 2024
0f88c53
Merge branch 'master' into feat/command-menu-v2
charislam Jun 5, 2024
ed72678
Merge branch 'master' into feat/command-menu-v2
charislam Jun 6, 2024
99b9b9d
Merge branch 'master' into feat/command-menu-v2
charislam Jun 7, 2024
dda1632
Merge branch 'master' into feat/command-menu-v2
charislam Jun 10, 2024
999a565
Merge branch 'master' into feat/command-menu-v2
charislam Jun 11, 2024
f1fd810
Merge branch 'master' into feat/command-menu-v2
charislam Jun 12, 2024
63b5e2b
feat: finish editing everything except social login
charislam Jun 17, 2024
5e7e207
Merge branch 'master' into feat/command-menu-v2
charislam Jun 20, 2024
31aa927
fix: import error
charislam Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions apps/docs/components/CommandMenu/CommandMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { CommandInput, CommandList, CommandMenu } from 'ui-patterns/CommandMenu'
import { useChangelogCommand } from 'ui-patterns/CommandMenu/prepackaged/Changelog'
import { useDocsAiCommands } from 'ui-patterns/CommandMenu/prepackaged/DocsAi'
import { useDocsSearchCommands } from 'ui-patterns/CommandMenu/prepackaged/DocsSearch'
import { useSupportCommands } from 'ui-patterns/CommandMenu/prepackaged/Support'
import { useThemeSwitcherCommands } from 'ui-patterns/CommandMenu/prepackaged/ThemeSwitcher'
import { useQuickstartCommands } from './Quickstarts'
import { useDocsNavCommands } from '../Navigation/Navigation.commands'

const DocsCommandMenu = () => {
useDocsSearchCommands({
modify: (command) => ({ ...command, forceMount: true }),
options: { forceMountSection: true },
})
useDocsAiCommands({ modify: (command) => ({ ...command, forceMount: true }) })
useDocsNavCommands()
useQuickstartCommands()
useSupportCommands()
useChangelogCommand()
useThemeSwitcherCommands()

return (
<CommandMenu>
<CommandInput />
<CommandList />
</CommandMenu>
)
}

export { DocsCommandMenu as default }
58 changes: 58 additions & 0 deletions apps/docs/components/CommandMenu/Quickstarts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { ArrowRight } from 'lucide-react'
import { useRegisterCommands } from 'ui-patterns/CommandMenu'

interface Quickstart {
label: string
url: `/${string}`
}

const quickstarts = [
{
label: 'React',
url: '/guides/getting-started/quickstarts/reactjs',
},
{
label: 'Next.js',
url: '/guides/getting-started/quickstarts/nextjs',
},
{
label: 'Nuxt.js',
url: '/guides/getting-started/quickstarts/nuxtjs',
},
{
label: 'Flutter',
url: '/guides/getting-started/quickstarts/flutter',
},
{
label: 'Kotlin',
url: '/guides/getting-started/quickstarts/android',
},
{
label: 'SvelteKit',
url: '/guides/getting-started/quickstarts/sveltekit',
},
{
label: 'SolidJS',
url: '/guides/getting-started/quickstarts/solidjs',
},
{
label: 'Vue',
url: '/guides/getting-started/quickstarts/vue',
},
] as Quickstart[]

const useQuickstartCommands = () => {
useRegisterCommands(
'Quick starts',
quickstarts.map(({ label, url }) => ({
id: label,
name: `Get started with ${label}`,
route: url,
defaultHidden: true,
value: `Quick starts: Get started with ${label}`,
icon: () => <ArrowRight />,
}))
)
}

export { useQuickstartCommands }
12 changes: 12 additions & 0 deletions apps/docs/components/CommandMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import dynamic from 'next/dynamic'

import { useCommandMenuInitiated } from 'ui-patterns/CommandMenu'

const LazyCommandMenu = dynamic(() => import('./CommandMenu'), { ssr: false })

const DocsCommandMenu = () => {
const isInitiated = useCommandMenuInitiated()
return isInitiated && <LazyCommandMenu />
}

export { DocsCommandMenu }
151 changes: 151 additions & 0 deletions apps/docs/components/Navigation/Navigation.commands.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import { ArrowRight } from 'lucide-react'
import { ICommand, useRegisterCommands } from 'ui-patterns/CommandMenu'

const navCommands = [
{
id: 'nav-getting-started',
name: 'Go to Getting Started',
route: '/guides/getting-started',
icon: () => <ArrowRight />,
},
{
id: 'nav-database',
name: 'Go to Database',
route: '/guides/database/overview',
icon: () => <ArrowRight />,
},
{
id: 'nav-auth',
name: 'Go to Auth',
route: '/guides/auth',
icon: () => <ArrowRight />,
},
{
id: 'nav-storage',
name: 'Go to Storage',
route: '/guides/storage',
icon: () => <ArrowRight />,
},
{
id: 'nav-functions',
name: 'Go to Functions',
route: '/guides/functions',
icon: () => <ArrowRight />,
},
{
id: 'nav-realtime',
name: 'Go to Realtime',
route: '/guides/realtime',
icon: () => <ArrowRight />,
},
{
id: 'nav-ai',
name: 'Go to AI & Vectors',
route: '/guides/ai',
icon: () => <ArrowRight />,
},
{
id: 'nav-rest',
name: 'Go to REST API',
route: '/guides/api',
icon: () => <ArrowRight />,
},
{
id: 'nav-graphql',
name: 'Go to GraphQL',
route: '/guides/graphql',
icon: () => <ArrowRight />,
},
{
id: 'nav-local-cli',
name: 'Go to Local Dev / CLI',
route: '/guides/cli',
icon: () => <ArrowRight />,
},
{
id: 'nav-platform',
name: 'Go to Platform',
route: '/guides/platform',
icon: () => <ArrowRight />,
},
{
id: 'nav-self-hosting',
name: 'Go to Self-Hosting',
route: '/guides/self-hosting',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-javascript',
name: 'Go to JavaScript reference',
value: 'Reference, API, SDK: Go to JavaScript reference (JS)',
route: '/reference/javascript/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-dart',
name: 'Go to Dart reference',
value: 'Reference, API, SDK: Go to Dart reference (Flutter)',
route: '/reference/dart/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-python',
name: 'Go to Python reference',
value: 'Reference, API, SDK: Go to Python reference',
route: '/reference/python/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-csharp',
name: 'Go to C# reference',
value: 'Reference, API, SDK: Go to C# reference',
route: '/reference/csharp/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-swift',
name: 'Go to Swift reference',
value: 'Reference, API, SDK: Go to Swift reference',
route: '/reference/swift/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-kotlin',
name: 'Go to Kotlin reference',
value: 'Reference, API, SDK: Go to Kotlin reference',
route: '/reference/kotlin/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-cli',
name: 'Go to CLI reference',
value: 'Reference, API, SDK: Go to CLI reference',
route: '/reference/cli/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-ref-api',
name: 'Go to Management API reference',
value: 'Reference, API, SDK: Go to Management API reference',
route: '/reference/api/introduction',
icon: () => <ArrowRight />,
},
{
id: 'nav-resources',
name: 'Go to Guides & Examples',
route: '/guides/resources',
icon: () => <ArrowRight />,
},
{
id: 'nav-integrations',
name: 'Go to Integrations',
route: 'https://supabase.com/partners/integrations',
icon: () => <ArrowRight />,
},
] satisfies ICommand[]

const useDocsNavCommands = () => {
useRegisterCommands('Go to', navCommands)
}

export { useDocsNavCommands }
18 changes: 13 additions & 5 deletions apps/docs/components/Navigation/NavigationMenu/TopNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ import { useTheme } from 'next-themes'
import Image from 'next/legacy/image'
import Link from 'next/link'
import { FC } from 'react'
import { Button, IconCommand, IconGitHub, IconSearch } from 'ui'
import { SearchButton } from 'ui-patterns/Cmdk'

import { useIsLoggedIn, useIsUserLoading } from 'common'
import { Button, IconCommand, IconGitHub, IconSearch } from 'ui'

import { useSetCommandMenuOpen } from 'ui-patterns/CommandMenu'
import { ThemeToggle } from 'ui-patterns/ThemeToggle'

const TopNavBar: FC = () => {
const { resolvedTheme } = useTheme()

const isLoggedIn = useIsLoggedIn()
const isUserLoading = useIsUserLoading()
const { resolvedTheme } = useTheme()

const setCommandMenuOpen = useSetCommandMenuOpen()

return (
<nav
Expand All @@ -36,7 +41,10 @@ const TopNavBar: FC = () => {
</div>

<div className="flex items-center gap-6">
<SearchButton className="md:w-full lg:w-96 order-2 lg:order-1">
<button
onClick={() => setCommandMenuOpen(true)}
className="md:w-full lg:w-96 order-2 lg:order-1"
>
<div
className="
flex
Expand Down Expand Up @@ -67,7 +75,7 @@ const TopNavBar: FC = () => {
</div>
</div>
</div>
</SearchButton>
</button>
</div>
<div className="hidden lg:flex grow items-center justify-end gap-3">
<Button type="text" asChild>
Expand Down
8 changes: 5 additions & 3 deletions apps/docs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import MetaFaviconsPagesRouter from 'common/MetaFavicons/pages-router'
import Head from 'next/head'
import { PortalToast } from 'ui'
import { PromoToast } from 'ui-patterns/PromoToast'
import { CommandMenuProvider } from 'ui-patterns/Cmdk'
import { CommandProvider } from 'ui-patterns/CommandMenu'
import { AuthContainer } from '~/features/auth/auth.client'
import { QueryClientProvider } from '~/features/data/queryClient.client'
import { ShortcutPreviewBuild } from '~/features/envs/staging.client'
Expand All @@ -18,6 +18,7 @@ import { ThemeSandbox } from '~/features/ui/theme.client'
import { ScrollRestoration } from '~/features/ui/helpers.scroll.client'
import SiteLayout from '~/layouts/SiteLayout'
import type { AppPropsWithLayout } from '~/types'
import { DocsCommandMenu } from '~/components/CommandMenu'

function MyApp({ Component, pageProps }: AppPropsWithLayout) {
return (
Expand All @@ -31,16 +32,17 @@ function MyApp({ Component, pageProps }: AppPropsWithLayout) {
<PageTelemetry />
<ScrollRestoration />
<ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
<CommandMenuProvider site="docs">
<CommandProvider>
<div className="h-screen flex flex-col">
<SiteLayout>
<PortalToast />
<PromoToast />
<Component {...pageProps} />
<DocsCommandMenu />
</SiteLayout>
<ThemeSandbox />
</div>
</CommandMenuProvider>
</CommandProvider>
</ThemeProvider>
</AuthContainer>
</QueryClientProvider>
Expand Down