<template>
  <div class="flex flex-col items-center justify-center w-full h-full">
    <ILogo/>
    <div class="mt-2">开源搜索，直达结果</div>
    <ICreate ref="refCreate"/>
    <div class="max-w-screen-md w-full p-6 grid grid-cols-1 lg:grid-cols-2 gap-4">
      <template v-for="(item, index) in recommendQuestions" :key="index">
        <UButton
          color="gray"
          variant="soft"
          size="md"
          :to="item.c_id ? `/search/${item.c_id}` : ''"
          @click="handleSearch(item)"
        >
          <div class="w-full flex justify-between">
            <div class="truncate">{{ item.title }}</div>
            <UIcon class="flex-shrink-0 h-5 w-5" :name="item.c_id ? 'i-heroicons-chevron-right-20-solid' : 'i-heroicons-plus-20-solid'" />
          </div>
        </UButton>
      </template>
    </div>
  </div>
  <IMenuSider fixed/>
</template>
<script setup>
const { deploymentType } = useConfig();
let recommendQuestions = [
  {
    title: '介绍一下 ChatTTS 项目',
    c_id: 'c_WyRkNzi6MgBzOD32'
  },
  {
    title: '用 TailwindCSS 写一个响应式布局的登录页面',
    c_id: 'c_Upb8x5jxhYeRJXrI'
  },
  {
    title: '归纳总结这篇文章 https://blog.csdn.net/csdnnews/article/details/139788492',
    c_id: 'c_PESV6PxFRUSOrQis'
  },
  {
    title: 'LangChain 的项目结构是怎样的',
    c_id: 'c_8toZjUIGGJmh96fa'
  },
  {
    title: '用 Python 写一个对列表去重的函数',
    c_id: 'c_ZpIdBs6FQqtTq4u5'
  },
  {
    title: '常见的 SEO 方法有哪些？',
    // c_id: 'c_CawfQuhqPxGy1Ny9'
  },
  // {
  //   title: '有哪些有效的方法可以应对 DDoS 攻击？'
  // }
]
if (deploymentType === 'private') {
  recommendQuestions = [
    {
      title: '介绍一下 ChatTTS 项目',
      c_id: 'c_WyRkNzi6MgBzOD32'
    },
    {
      title: '用 TailwindCSS 写一个响应式布局的登录页面',
      c_id: 'c_Upb8x5jxhYeRJXrI'
    },
    {
      title: '归纳总结这篇文章 https://blog.csdn.net/csdnnews/article/details/139788492',
      c_id: 'c_PESV6PxFRUSOrQis'
    },
    {
      title: 'LangChain 的项目结构是怎样的',
      c_id: 'c_8toZjUIGGJmh96fa'
    },
    {
      title: '用 Python 写一个对列表去重的函数',
      c_id: 'c_ZpIdBs6FQqtTq4u5'
    },
    {
      title: '有哪些有效的方法可以应对 DDoS 攻击？',
    },
  ]
}
const refCreate = ref(null)
function handleSearch (item) {
  if (!item.c_id) refCreate.value.handleQuickSearch(item.title)
}
</script>
