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

export function renderCommandPaletteOverlay(ctx: ChatPageContext) {
  return [
    h(DimSdkCommandPalette, {
      modelValue: ctx.showCommands.value,
      'onUpdate:modelValue': (v: boolean) => (ctx.showCommands.value = v),
      options: ctx.commandOptions.value,
      selectedIndex: ctx.commandIndex.value,
      'onUpdate:selectedIndex': (v: number) => (ctx.commandIndex.value = v),
      onSelect: (v: string | null) => ctx.onCommandSelect(v),
      onClose: ctx.closeCommandPalette,
    }),
  ]
}
