import {useEffect} from 'react'
// import Taro from '@tarojs/taro';
import UserCard from "./components/UserCard";
// import UserOrder from "./components/UserOrder";
import UserCell from "./components/UserCell";
import UserFooter from "./components/UserFooter";
import {useUser} from "@/hooks/useUser";
// import {NavBar} from '@nutui/nutui-react-taro';
// import {Home} from '@nutui/icons-react-taro';
import './user.scss';

function User() {
  // const [statusBarHeight, setStatusBarHeight] = useState<number>()
  const {
    isAdmin
  } = useUser();

  useEffect(() => {
    // Taro.getSystemInfo({
    //   success: (res) => {
    //     setStatusBarHeight(res.statusBarHeight)
    //   },
    // })
  }, []);

  /**
   * 门店核销管理
   */
  if (isAdmin()) {
    return <>
      <div className={'user-page w-full'}>
        {/* 装饰性背景 - 深蓝色渐变 + 圆点装饰 */}
        <div className={'h-64 w-full fixed top-0 z-0'}
          style={{
            background: 'linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%)'
          }}>
          <div className="absolute w-32 h-32 rounded-full" style={{
            backgroundColor: 'rgba(255, 255, 255, 0.1)',
            top: '-16px',
            right: '-16px'
          }}></div>
          <div className="absolute w-24 h-24 rounded-full" style={{
            backgroundColor: 'rgba(255, 255, 255, 0.08)',
            bottom: '-12px',
            left: '-12px'
          }}></div>
          <div className="absolute w-16 h-16 rounded-full" style={{
            backgroundColor: 'rgba(255, 255, 255, 0.05)',
            top: '60px',
            left: '120px'
          }}></div>
        </div>
        <UserCard/>
        {/*<UserOrder/>*/}
        <UserCell/>
        <UserFooter/>
      </div>
    </>
  }

  return (
    <>
      {/*<NavBar*/}
      {/*  fixed={true}*/}
      {/*  style={{marginTop: `${statusBarHeight}px`, backgroundColor: 'transparent'}}*/}
      {/*  onBackClick={() => {*/}
      {/*  }}*/}
      {/*  left={*/}
      {/*    <div style={{*/}
      {/*      display: 'flex',*/}
      {/*      alignItems: 'center',*/}
      {/*      justifyContent: 'center',*/}
      {/*      width: '30px',*/}
      {/*      height: '30px',*/}
      {/*      backgroundColor: 'white',*/}
      {/*      textAlign: 'center',*/}
      {/*      borderRadius: '50%',*/}
      {/*    }}>*/}
      {/*      <Home size={15} onClick={() => Taro.reLaunch({url: '/pages/index/index'})} style={{color: 'black', marginBottom: '1px'}} />*/}
      {/*    </div>*/}
      {/*  }*/}
      {/*>*/}
      {/*  <span>我的</span>*/}
      {/*</NavBar>*/}
      <div className={'user-page w-full'}>
        {/* 装饰性背景 - 深蓝色渐变 + 圆点装饰 */}
        <div className={'h-40 w-full fixed top-0 z-0'}
          style={{
            background: 'linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%)'
          }}>
          <div className="absolute w-32 h-32 rounded-full" style={{
            backgroundColor: 'rgba(255, 255, 255, 0.1)',
            top: '-16px',
            right: '-16px'
          }}></div>
          <div className="absolute w-24 h-24 rounded-full" style={{
            backgroundColor: 'rgba(255, 255, 255, 0.08)',
            bottom: '-12px',
            left: '-12px'
          }}></div>
          <div className="absolute w-16 h-16 rounded-full" style={{
            backgroundColor: 'rgba(255, 255, 255, 0.05)',
            top: '60px',
            left: '120px'
          }}></div>
        </div>
        <UserCard/>
        {/*<UserOrder/>*/}
        <UserCell/>
        <UserFooter/>
      </div>
    </>
  )
}

export default User
