import { useNavigate } from '@tanstack/react-router' import type { IntegrationTab } from '@/components/interfaces/Integrations/Landing/useIntegrationDetail' import { navigateToUrl } from '@/lib/navigation' import { SHORTCUT_REFERENCE_GROUPS } from '@/state/shortcuts/referenceGroups' import { DynamicShortcut } from '@/state/shortcuts/useDynamicShortcut' const TAB_DIGIT_KEYS = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] as const /** * Binds digit keys 1-9 to whichever tabs the active integration declares in * its `navigation` array. Render this once per integration detail page, * driven off the `tabs` shape from `useIntegrationDetail`. * * The dynamic shortcut registry handles per-tab label overrides ("Go to Jobs", * "Go to Wrappers", etc.) so the reference sheet and Cmd+K pick up the actual * tab name without us having to pre-declare every possible integration tab. */ export interface IntegrationDetailTabShortcutsProps { tabs: IntegrationTab[] enabled?: boolean } export const IntegrationDetailTabShortcuts = ({ tabs, enabled = true, }: IntegrationDetailTabShortcutsProps) => { const navigate = useNavigate() return ( <> {tabs.slice(0, TAB_DIGIT_KEYS.length).map((tab, index) => ( navigateToUrl(navigate, tab.href)} /> ))} ) }