Skip to content

Commit

Permalink
chore: optimize reboot button
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 committed Jul 22, 2024
1 parent e0a1730 commit 7a5ca9c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/Firmware/Firmware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,26 @@ const RebootToBoard: FC = () => {
const intl = useIntl();
const device = useSelector((state: RootState) => state.runtime.device);
const [loading, setLoading] = useState(false);
const isBootLoader = device?.features?.bootloader_mode;

const onRebootToBoard = useCallback(async () => {
setLoading(true);
await serviceHardware.rebootToBoard();
setLoading(false);
}, []);

if (['touch', 'pro'].includes(getDeviceType(device?.features))) {
if (
!isBootLoader &&
['touch', 'pro'].includes(getDeviceType(device?.features))
) {
return (
<div className="flex items-center justify-between text-sm text-gray-800 py-1">
<Button loading={loading} className="w-full" onClick={onRebootToBoard}>
<div className="flex items-center justify-end py-1">
<Button
className="sm:w-[50%] w-full"
size="sm"
loading={loading}
onClick={onRebootToBoard}
>
{intl.formatMessage({ id: 'TR_CLICK_TO_BOARD' })}
</Button>
</div>
Expand Down

0 comments on commit 7a5ca9c

Please sign in to comment.