import { h } from 'vue'
import { useModal } from '@/views/Content/hooks/modal'
const { openDetailsModal } = useModal()

export const useHangjingDetail = () => {
  return { showDetailsModal }
}

function renderDetailsContent(data: Record<string, any>) {
  return h(
    'div',
    {},
    Object.keys(data).map(key => h('div', {}, `${key}：${data[key]}`))
  )
}

function showDetailsModal(title: string, data: Record<string, any>) {
  openDetailsModal({
    titleString: title,
    contentSlot: renderDetailsContent(data),
  })
}
