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

export function renderTimelineOverlay(ctx: ChatPageContext) {
  return [
    h(DimSdkCommandPalette, {
      modelValue: ctx.showTimeline.value,
      'onUpdate:modelValue': (v: boolean) => (ctx.showTimeline.value = v),
      title: t('chatPage.timeline.title'),
      options: ctx.timelineOptions.value,
      selectedIndex: ctx.timelineIndex.value,
      'onUpdate:selectedIndex': (v: number) => (ctx.timelineIndex.value = v),
      onSelect: (v: string | null) => ctx.onTimelineSelect(v),
      onClose: ctx.closeTimeline,
    }),
  ]
}
