<script setup lang="ts">
import ProjectList from './components/ProjectList.vue'
import type { ListItem, MenuItem } from '@/types'

const samplePic =
  'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAACf1BMVEVGQksvbmYyaWM0ZGA3X107WFk9U1VATlNDSU8ucWgyamQ2Yl88VlhDSE8wbWY1ZGAvb2c1ZGA+U1U6WloucWgzZ2I/UFQ0ZmFATVIyaWM/T1MyaWMwbWY7V1gucWg1Yl8wbWUucWg0ZWAvb2cwbWYxa2QzaGI0ZWFBTFE5XFszZmI0ZmE9VFY7WFkxa2RERk5BTVIxamQ2YV4xbGUvcGdATlI8Vlgvb2c6Wlo5XFswbWYucWgzZ2IucWgxa2Q9U1U7WFg5W1pCSlAucWgzZ2IyaWMucWg1Y19DSE43X103X104XlwvcGc8VlcxbGUvb2c3X10wbWU6WVk4XlxATlMyaWMucWg2YV4vbmYxa2RDR041Y18ucWgyaGM2YV4vb2c1Y185W1ovb2cwbGU8VVdCSU82Yl8+UVQxa2Q4XVs0ZWE1Yl8xbGU4XVwyaWM6WlowbWY2Yl8wbGUwbWY4XVs/T1M0ZmEvb2c3X109U1YwbWYwbmYxbGU4Xlw2YV4+UVU5XFs0ZmEvbmY5W1o+UlUwbmY6Wlo/UFQ1Y181Y180ZWEyamQzZ2JBS1Evb2c8Vlc5XFsvb2cyaWM2Yl8vcGcvb2dDSU80ZWE7V1g1Yl9BTFExamRER049VFY6WVk6WlpBS1AwbWU0ZWEyaWM7WFkvb2c0ZmE5W1ozaGIxbGU4XVs1ZGAyamQzaGIxa2RCSVAzaGI7V1g6WVk2YV4zZ2I9VFYxbGU0ZmEucWgwbmYzZmIzaGIxa2QwbWY4Xlw3YF03YF5CSlAxamQvb2cyaWM0ZWA2YV43X11AT1M3X107V1gwbGVFRU1GQktFRExERU1GQ0tFQ0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 1000 }, (_, i) => ({
  id: i,
  name: `project-${i + 1}`,
  description: `这是项目 ${i + 1} 的详细描述信息`,
  icon: samplePic,
  tags: [
    ...(i % 2 === 0 ? [{ id: 1, name: 'Vue', color: '#42b883' }] : []),
    ...(i % 3 === 0 ? [{ id: 2, name: 'TypeScript', color: '#3178c6' }] : []),
    ...(i % 4 === 0 ? [{ id: 3, name: 'React', color: '#149eca' }] : []),
    ...(i % 5 === 0 ? [{ id: 4, name: 'Node.js', color: '#539e43' }] : []),
  ],
}))

// 自定义菜单项
const menuItems: MenuItem[] = [
  {
    id: 'refresh',
    label: '刷新列表',
    action: (item) => {
      console.log('当前选中项:', item)
    },
  },
  {
    id: 'clear',
    label: '清空选择',
    action: (item) => {
      console.log('清空前选中项:', item)
    },
  },
  {
    id: 'export',
    label: '导出数据',
    action: (item) => {
      console.log('当前选中项:', item)
    },
  },
]

// 列表项点击事件处理
const handleItemClick = (item: ListItem): void => {
  console.log('点击列表项:', item)
}
</script>

<template>
  <ProjectList
    :data="listData"
    :menu-items="menuItems"
    @click="handleItemClick"
  />
</template>

<style>
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#app {
  height: 100%;
}
</style>
