import type { ChatPageContext } from '../../context'
import { t } from '#cli/i18n'
import { h } from 'vue'
import { DimSdkCommandPalette } from '../../../../ui/components/CommandPalette'

export function renderHelpOverlay(ctx: ChatPageContext) {
  return [
    h(DimSdkCommandPalette, {
      modelValue: ctx.showHelp.value,
      'onUpdate:modelValue': (v: boolean) => (ctx.showHelp.value = v),
      title: t('help.title'),
      options: ctx.helpOptions.value,
      selectedIndex: ctx.helpIndex.value,
      'onUpdate:selectedIndex': (v: number) => (ctx.helpIndex.value = v),
      onSelect: () => ctx.closeHelp(),
      onClose: ctx.closeHelp,
    }),
  ]
}
