import PageContent from '@/components/PageContent';
import PageTitle from '@/components/PageTitle';
import TabsContent from '@/components/TabsContent';
import { UnityAction } from '@/utils/utils';
import AirConditioner from './components/AirConditioner';
import Light from './components/Light';

function Hardware() {
  const handleTabsChange = (tab) => {
    // UnityAction.sendMsg(tab == '1' ? 'ACData' : 'lightData');
  };

  // useEffect(() => {
  //   UnityAction.sendMsg('ACData');
  // }, []);

  return (
    <PageContent closeable={false}>
      <PageTitle
        tabs
        onReturn={() => UnityAction.sendMsg('menuItem', '智能管控')}
      ></PageTitle>
      <TabsContent
        defaultActiveKey="1"
        onChange={handleTabsChange}
        center={true}
        items={[
          {
            label: `空调控制`,
            key: '1',
            children: <AirConditioner />,
          },
          {
            label: `照明控制`,
            key: '2',
            children: <Light />,
          },
        ]}
      />
    </PageContent>
  );
}

export default Hardware;
