import { useShareAppMessage } from '@tarojs/taro';

import { Tabs } from '@taroify/core';
import { useState } from 'react';

import PartnerIntro, { PartnerIntroFooter } from '@/components/partner-intro';
import { getCommonShareMessage } from '@/utils/share';
import './index.less';

const PREFIX = 'partner';

export default function Partner() {
  const [tab, setTab] = useState(0);

  useShareAppMessage(() => {
    return getCommonShareMessage(false);
  });

  return (
    <div className={PREFIX}>
      <Tabs swipeable className={`${PREFIX}__tabs`} value={tab} onChange={setTab}>
        <Tabs.TabPane value={0} title="简介">
          <PartnerIntro />
        </Tabs.TabPane>
        <Tabs.TabPane value={1} title="邀请名单">
          邀请名单
        </Tabs.TabPane>
        <Tabs.TabPane value={2} title="我的收益">
          我的收益
        </Tabs.TabPane>
      </Tabs>
      {tab === 0 && <PartnerIntroFooter />}
    </div>
  );
}
