import { Suspense } from 'react'; import { urls, useConceptNavigation } from '@/app'; import { HelpTopic } from '@/features/help'; import { BadgeHelp } from '@/features/help/components/badge-help'; import { Loader } from '@/components/loader'; import { TabLabel, TabList, TabPanel, Tabs } from '@/components/tabs'; import { MenuTemplates } from './menu-templates'; import { TabEditTemplate } from './tab-edit-template'; import { TabListTemplates } from './tab-list-templates'; import { TabViewVariables } from './tab-view-variables'; export const PromptTabID = { LIST: 0, EDIT: 1, VARIABLES: 2 } as const; export type PromptTabID = (typeof PromptTabID)[keyof typeof PromptTabID]; interface TemplatesTabsProps { activeID: number | null; tab: PromptTabID; } function TabLoader() { return (
); } export function TemplatesTabs({ activeID, tab }: TemplatesTabsProps) { const router = useConceptNavigation(); function onSelectTab(index: number, last: number, event: Event) { if (last === index) { return; } if (event.type == 'keydown') { const kbEvent = event as KeyboardEvent; if (kbEvent.altKey) { if (kbEvent.code === 'ArrowLeft') { router.back(); return; } else if (kbEvent.code === 'ArrowRight') { router.forward(); return; } } } router.replace({ path: urls.prompt_template(activeID, index as PromptTabID) }); } return (
}> {activeID ? ( }> {' '} {' '} ) : null}
); }