Support.tsx47 lines · main
1import { useRegisterCommands, useSetCommandMenuOpen, type ICommand } from '..'
2import { Activity, LifeBuoy } from 'lucide-react'
3import { useMemo } from 'react'
4
5import { BASE_PATH } from './shared/constants'
6
7const useSupportCommands = ({ enabled = true }: { enabled?: boolean } = {}) => {
8 const setOpen = useSetCommandMenuOpen()
9
10 const commands = useMemo(
11 () =>
12 [
13 {
14 id: 'system-status',
15 name: 'View system status',
16 value: 'Support: View system status',
17 href: 'https://status.supabase.com',
18 icon: () => <Activity />,
19 },
20 {
21 id: 'discord-community',
22 name: 'Ask Discord community',
23 value: 'Support: Ask Discord community',
24 href: 'https://discord.supabase.com',
25 icon: () => <LifeBuoy />,
26 },
27 {
28 id: 'support-team',
29 name: 'Contact support',
30 value: 'Support: Contact support',
31 href: '/support',
32 icon: () => <LifeBuoy />,
33 },
34 ].map((command) => ({
35 ...command,
36 route:
37 BASE_PATH && command.href.startsWith('/')
38 ? `https://supabase.com/${command.href}`
39 : command.href,
40 })) as ICommand[],
41 [setOpen]
42 )
43
44 useRegisterCommands('Support', commands, { enabled })
45}
46
47export { useSupportCommands }