/**
 * 知识库
 */

import { View, Text } from "@tarojs/components";
import PageCustom from "@/components/page-custom/index";
import NavBarNormal from "@/components/NavBarNormal/index";
import WemetaTabs from "@/components/wemeta-tabs/index";
import PersonalTab from "./components/PersonalTab";
import CompanyTab from "./components/CompanyTab";
import CorrectionList from "./components/CorrectionList";
import style from "./index.module.less";

// 渲染统一容器带高光圆角的头部
const renderTabContainer = (children: JSX.Element) => {
  return (
    <View className={style.tabContent}>
      <View className="pt-12 h-full">
        <View className="rounded-container-header"></View>
        {children}
      </View>
    </View>
  );
};

export default function Index() {
  const tabList = [
    {
      key: "1",
      label: "个人知识",
      children: renderTabContainer(<PersonalTab />),
    },
    {
      key: "2",
      label: "企业知识",
      children: renderTabContainer(<CompanyTab />),
    },
    {
      key: "3",
      label: "纠错记录",
      children: renderTabContainer(<CorrectionList />),
    },
  ];
  return (
    <PageCustom>
      <NavBarNormal
        scrollFadeIn
        leftColumn={() => <Text className="text-16 font-medium">知识库</Text>}
      ></NavBarNormal>
      <View className="w-full">
        <View className={style.container}>
          <WemetaTabs current="1" list={tabList} className="px-16"></WemetaTabs>
        </View>
      </View>
    </PageCustom>
  );
}
