EditorsLayout.hooks.ts13 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import { usePathname } from 'next/navigation' |
| 3 | |
| 4 | export function useEditorType(): 'table' | 'sql' | undefined { |
| 5 | const pathname = usePathname() |
| 6 | const { ref } = useParams() |
| 7 | |
| 8 | return pathname?.includes(`/project/${ref}/editor`) |
| 9 | ? 'table' |
| 10 | : pathname?.includes(`/project/${ref}/sql`) |
| 11 | ? 'sql' |
| 12 | : undefined |
| 13 | } |