|
|
@ -18,16 +18,19 @@ export default function Header() { |
|
|
|
const navigate = useNavigate(); |
|
|
|
const dispatch = useAppDispatch(); |
|
|
|
const deviceInfo = useAppSelector(store => store.context.device); |
|
|
|
//@ts-ignoref
|
|
|
|
const deviceState = useSelector(store => store.deviceState); |
|
|
|
let [isConnect, setIsConnect] = useState(deviceState.isConnect) |
|
|
|
const [bluetoothInfo, setBluetoothInfo] = useState(deviceState) |
|
|
|
const deviceState = useAppSelector(store => store.deviceState); |
|
|
|
let [isConnect, setIsConnect] = useState(true); |
|
|
|
const [bluetoothInfo, setBluetoothInfo] = useState(deviceState); |
|
|
|
//获取当前websocet的状态
|
|
|
|
const showBlueImg = () => { |
|
|
|
if(isConnect){ |
|
|
|
return <Popover content={getBtContent()} title=""> |
|
|
|
<img src={icon_usb} onClick={onDisconnectBt} alt="" className="ext-base ml-2 h-6" /> |
|
|
|
if (isConnect) { |
|
|
|
return ( |
|
|
|
<Popover content={getBtContent()} title=""> |
|
|
|
<section className="bg-white rounded-md h-9 w-10 flex justify-center items-center mr-3"> |
|
|
|
<img src={icon_usb} alt="" className="h-6" /> |
|
|
|
</section> |
|
|
|
</Popover> |
|
|
|
); |
|
|
|
} |
|
|
|
return null; |
|
|
|
// if(!isConnect){
|
|
|
@ -40,7 +43,7 @@ export default function Header() { |
|
|
|
// <img src={icon_usb} onClick={onDisconnectBt} alt="" className="ext-base ml-2 h-6" />
|
|
|
|
// </Popover>
|
|
|
|
// }
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
let list = [ |
|
|
|
{ |
|
|
@ -126,8 +129,9 @@ export default function Header() { |
|
|
|
}; |
|
|
|
|
|
|
|
//设备已连接
|
|
|
|
const getBtContent = ()=> { |
|
|
|
return <div> |
|
|
|
const getBtContent = () => { |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<div className="bluetooth_c"> |
|
|
|
<img src={check_mark} alt="" className="ext-base ml-2 h-4" /> |
|
|
@ -170,13 +174,11 @@ export default function Header() { |
|
|
|
/> |
|
|
|
<p className="text-primary text-xs">{deviceInfo.power.toFixed()}%</p> |
|
|
|
</section> |
|
|
|
<section className="bg-white rounded-md h-9 w-10 flex justify-center items-center mr-3"> |
|
|
|
{/* <section className="bg-white rounded-md h-9 w-10 flex justify-center items-center mr-3"> |
|
|
|
<img src={icon_usb} className="w-6" alt="icon" /> |
|
|
|
</section> |
|
|
|
|
|
|
|
<div className="mr-8 flex items-center w-[5rem]"> |
|
|
|
</section> */} |
|
|
|
{showBlueImg()} |
|
|
|
</div> |
|
|
|
<div className="mr-8 flex items-center min-w-[5rem]"> |
|
|
|
<Dropdown menu={{ items }} trigger={["click"]}> |
|
|
|
<section className="flex items-center"> |
|
|
|
<img src={icon_avatar} alt="" className="h-8" /> |
|
|
|