import icon_bluetooth from '../assets/icon_bluetooth.svg'; import icon_arr_d from '../assets/icon_arr_down.svg'; import './CustomNavBar.scss'; import { useState } from 'react'; import { useAppSelector } from '../utils/hooks'; import { useNavigate } from 'react-router-dom'; export default function CustomNavBar({ title }: { title: string }) { const navigate = useNavigate(); const device = useAppSelector((state) => state.context.device); const [showDetail, setShowDetail] = useState(false); return (
{/** 温度,水平仪 */}
温度: {device.temperature.toFixed(1)}°C X轴倾斜: {device.inclinatorX.toFixed(2)} Y轴倾斜: {device.inclinatorY.toFixed(2)}
{/** 导航栏 */}

{title}

{/** 蓝牙连接状态 */} {device.connected ? (
setShowDetail(!showDetail)} >
{device.power}%
icon 设备已连接 arr
) : (
navigate('/home/bluetooth')} > icon 设备未连接
)}
); }