diff --git a/gui/src/components/WidgetsComponent.tsx b/gui/src/components/WidgetsComponent.tsx
index f2a60a1a8..f1d82682f 100644
--- a/gui/src/components/WidgetsComponent.tsx
+++ b/gui/src/components/WidgetsComponent.tsx
@@ -12,7 +12,11 @@ import { parseStatusToLocale, useStatusContext } from '@/hooks/status-system';
import { ClearMountingButton } from './ClearMountingButton';
import { ToggleableSkeletonVisualizerWidget } from './widgets/SkeletonVisualizerWidget';
import { useAtomValue } from 'jotai';
-import { flatTrackersAtom } from '@/store/app-store';
+import {
+ feetAssignedTrackers,
+ fingerAssignedTrackers,
+ flatTrackersAtom,
+} from '@/store/app-store';
import { A } from './commons/A';
function UnprioritizedStatuses() {
@@ -48,6 +52,8 @@ function UnprioritizedStatuses() {
export function WidgetsComponent() {
const { config } = useConfig();
+ const hasFeetTrackers = useAtomValue(feetAssignedTrackers);
+ const hasFingerTrackers = useAtomValue(fingerAssignedTrackers);
return (
<>
@@ -55,16 +61,20 @@ export function WidgetsComponent() {
-
-
+ {hasFeetTrackers && (
+
+ )}
+ {hasFingerTrackers && (
+
+ )}
{(typeof __ANDROID__ === 'undefined' || !__ANDROID__?.isThere()) && (
diff --git a/gui/src/components/home/ResetButton.tsx b/gui/src/components/home/ResetButton.tsx
index 6d1d187b4..6ca617fb1 100644
--- a/gui/src/components/home/ResetButton.tsx
+++ b/gui/src/components/home/ResetButton.tsx
@@ -1,7 +1,6 @@
import { useLocalization } from '@fluent/react';
import { useEffect, useMemo, useRef, useState } from 'react';
import {
- BodyPart,
ResetRequestT,
ResetType,
RpcMessage,
@@ -25,57 +24,7 @@ import { useStatusContext } from '@/hooks/status-system';
import classNames from 'classnames';
import { FootIcon } from '@/components/commons/icon/FootIcon';
import { FingersIcon } from '@/components/commons/icon/FingersIcon';
-import { atom, useAtomValue } from 'jotai';
-import { assignedTrackersAtom } from '@/store/app-store';
-
-const FEET_BODY_PARTS = [BodyPart.LEFT_FOOT, BodyPart.RIGHT_FOOT];
-const FINGER_BODY_PARTS = new Set([
- BodyPart.LEFT_THUMB_METACARPAL,
- BodyPart.LEFT_THUMB_PROXIMAL,
- BodyPart.LEFT_THUMB_DISTAL,
- BodyPart.LEFT_INDEX_PROXIMAL,
- BodyPart.LEFT_INDEX_INTERMEDIATE,
- BodyPart.LEFT_INDEX_DISTAL,
- BodyPart.LEFT_MIDDLE_PROXIMAL,
- BodyPart.LEFT_MIDDLE_INTERMEDIATE,
- BodyPart.LEFT_MIDDLE_DISTAL,
- BodyPart.LEFT_RING_PROXIMAL,
- BodyPart.LEFT_RING_INTERMEDIATE,
- BodyPart.LEFT_RING_DISTAL,
- BodyPart.LEFT_LITTLE_PROXIMAL,
- BodyPart.LEFT_LITTLE_INTERMEDIATE,
- BodyPart.LEFT_LITTLE_DISTAL,
- BodyPart.RIGHT_THUMB_METACARPAL,
- BodyPart.RIGHT_THUMB_PROXIMAL,
- BodyPart.RIGHT_THUMB_DISTAL,
- BodyPart.RIGHT_INDEX_PROXIMAL,
- BodyPart.RIGHT_INDEX_INTERMEDIATE,
- BodyPart.RIGHT_INDEX_DISTAL,
- BodyPart.RIGHT_MIDDLE_PROXIMAL,
- BodyPart.RIGHT_MIDDLE_INTERMEDIATE,
- BodyPart.RIGHT_MIDDLE_DISTAL,
- BodyPart.RIGHT_RING_PROXIMAL,
- BodyPart.RIGHT_RING_INTERMEDIATE,
- BodyPart.RIGHT_RING_DISTAL,
- BodyPart.RIGHT_LITTLE_PROXIMAL,
- BodyPart.RIGHT_LITTLE_INTERMEDIATE,
- BodyPart.RIGHT_LITTLE_DISTAL,
-]);
-
-const fingerAssignedTrackers = atom((get) =>
- get(assignedTrackersAtom).some(
- (t) =>
- t.tracker.info?.bodyPart && FINGER_BODY_PARTS.has(t.tracker.info.bodyPart)
- )
-);
-
-const feetAssignedTrackers = atom((get) =>
- get(assignedTrackersAtom).some(
- (t) =>
- t.tracker.info?.bodyPart &&
- FEET_BODY_PARTS.includes(t.tracker.info.bodyPart)
- )
-);
+import { FEET_BODY_PARTS, FINGER_BODY_PARTS } from '@/store/app-store';
export function ResetButton({
type,
@@ -96,8 +45,6 @@ export function ResetButton({
const { config } = useConfig();
const finishedTimeoutRef = useRef(-1);
const [isFinished, setFinished] = useState(false);
- const hasFeetTrackers = useAtomValue(feetAssignedTrackers);
- const hasFingerTrackers = useAtomValue(fingerAssignedTrackers);
const needsFullReset = useMemo(
() =>
@@ -203,13 +150,6 @@ export function ResetButton({
};
}, []);
- if (
- (bodyPartsToReset === 'fingers' && !hasFingerTrackers) ||
- (bodyPartsToReset === 'feet' && !hasFeetTrackers)
- ) {
- return null;
- }
-
return size === 'small' ? (