Support.tsx47 lines · main
| 1 | import { useRegisterCommands, useSetCommandMenuOpen, type ICommand } from '..' |
| 2 | import { Activity, LifeBuoy } from 'lucide-react' |
| 3 | import { useMemo } from 'react' |
| 4 | |
| 5 | import { BASE_PATH } from './shared/constants' |
| 6 | |
| 7 | const 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 | |
| 47 | export { useSupportCommands } |