import React, { useState } from "react"
import { DataNavigation } from "@/components/Common/DataNavigation.tsx"
import { Card, Drawer, List } from "antd"

export const PlaygroundTeam = () => {
  // 模拟数据
  const data = [
    {
      title: "绿色化工工艺项目",
      description:
        "基于生物基原料，采用repeal2.0可降解材料技术，开发新型环保材料。",
      demander: "奥赛康药业 供方：美国Propella公司"
    },
    {
      title: "智能农业解决方案",
      description: "利用物联网技术，实现精准农业管理，提高农作物产量。",
      demander: "奥赛康药业 供方：美国Propella公司"
    },
    {
      title: "新能源汽车电池技术",
      description: "研发高能量密度、长寿命的新型电池材料，推动电动汽车发展。",
      demander: "奥赛康药业 供方：美国Propella公司"
    },
    {
      title: "碳捕集与封存技术",
      description: "开发高效的碳捕集技术，减少工业排放，助力碳中和目标。",
      demander: "奥赛康药业 供方：美国Propella公司"
    }
  ]

  for (let i = 0; i < 10; i++) {
    data.push({
      title: "开发新型电池材料",
      description: "研发高能量密度、长寿命的新型电池材料，推动电动汽车发展。",
      demander: "奥赛康药业 供方：美国Propella公司"
    })
  }

  const [open, setOpen] = useState(false)

  const showDrawer = () => {
    setOpen(true)
  }

  const onClose = () => {
    setOpen(false)
  }

  return (
    <Card
      className="h-full [&_.ant-card-body]:h-full [&_.ant-card-body]:!p-[20px] overflow-y-hidden"
      hoverable>
      <div className="h-full flex flex-col relative">
        {/* 数据导航 */}
        <DataNavigation
          Header={
            <div className="flex items-center text-[#BE0BAC] gap-1">
              <svg
                className="icon"
                viewBox="0 0 1024 1024"
                version="1.1"
                xmlns="http://www.w3.org/2000/svg"
                p-id="7272"
                width="18"
                height="18">
                <path
                  d="M824.2 699.9c-25.4-25.4-54.7-45.7-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5-31.7 14.7-60.9 34.9-86.4 60.4C345 754.6 314 826.8 312 903.8c-0.1 4.5 3.5 8.2 8 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5C493.8 707.7 551.1 684 612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c0.1 4.3 3.7 7.7 8 7.7h56c4.5 0 8.1-3.7 8-8.2-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5-24.5-24.5-37.9-57.1-37.5-91.8 0.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-0.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5-24.2 24.2-56.4 37.5-90.6 37.5z"
                  p-id="7273"
                  fill="#BE0BAC"></path>
                <path
                  d="M361.5 510.4c-0.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5 0.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1-25.8-25.2-39.7-59.3-38.7-95.4 0.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9 0.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-0.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204-0.1 4.5 3.5 8.2 8 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"
                  p-id="7274"
                  fill="#BE0BAC"></path>
              </svg>
              相关团队
            </div>
          }
          onClick={showDrawer}
        />

        {/* 场景列表 */}
        <div className="grid grid-cols-3 gap-3 flex-1 overflow-y-auto">
          {data.slice(0, 5).map((item, index) => (
            <Card
              key={index}
              className="[&_.ant-card-body]:!p-2 !bg-[gb(248, 248, 248)] border !border-[#e9e9e9]">
              <div className="flex flex-col gap-0.5">
                <h3 className="text-base font-medium  mb-1 text-[#222222] line-clamp-2">
                  {item.title}
                </h3>
                <p className="text-[#828282] text-xs truncate">
                  {item.description}
                </p>
                <p className="flex items-center gap-1.5">
                  <span className="inline-block text-[#BE0BAC] bg-[#be0bac30] h-5 leading-5 mt-1 text-xs rounded-full px-2.5">
                    晶体材料
                  </span>
                  <span className="inline-block text-[#EB1C1C] bg-[#eb1c1c30] h-5 leading-5 mt-1 text-xs rounded-full px-2.5">
                    中国
                  </span>
                </p>
              </div>
            </Card>
          ))}
        </div>
      </div>

      {/* 抽屉 */}
      <Drawer
        title="相关团队"
        closable={{ "aria-label": "Close Button" }}
        onClose={onClose}
        open={open}
        width="33.33%">
        <div className="grid grid-cols-1 gap-3 overflow-y-auto">
          {data.slice(0, 5).map((item, index) => (
            <Card
              key={index}
              hoverable
              className="[&_.ant-card-body]:!p-2 !bg-[gb(248, 248, 248)] border !border-[#e9e9e9]">
              <div className="flex flex-col gap-0.5">
                <h3 className="text-base font-medium  mb-1 text-[#222222]">
                  {item.title}
                </h3>
                <p className="text-[#828282] text-xs">{item.description}</p>
                <p className="flex items-center gap-1.5">
                  <span className="inline-block text-[#BE0BAC] bg-[#be0bac30] h-5 leading-5 mt-1 text-xs rounded-full px-2.5">
                    晶体材料
                  </span>
                  <span className="inline-block text-[#EB1C1C] bg-[#eb1c1c30] h-5 leading-5 mt-1 text-xs rounded-full px-2.5">
                    中国
                  </span>
                </p>
              </div>
            </Card>
          ))}
        </div>
      </Drawer>
    </Card>
  )
}
