import type { ChatPageContext } from '../../context'
import { h } from 'vue'
import { DimSdkExitSessionDialog } from '../../../../ui/components/ExitSessionDialog'

export function renderExitOverlay(ctx: ChatPageContext) {
  return [
    h(DimSdkExitSessionDialog, {
      modelValue: ctx.showExitConfirm.value,
      'onUpdate:modelValue': (v: boolean) => (ctx.showExitConfirm.value = v),
      w: ctx.smW.value,
      h: ctx.smH.value,
      onExit: async () => {
        ctx.showExitConfirm.value = false
        await ctx.exitSessionToHome()
      },
    }),
  ]
}
