|
| 1 | +import { |
| 2 | + FxBox, |
| 3 | + FxRadioButton, |
| 4 | + FxRadioButtonWithLabel, |
| 5 | + FxText, |
| 6 | +} from '@functionland/component-library'; |
| 7 | +import React from 'react'; |
| 8 | +import { SubHeaderText } from '../../components/Text'; |
| 9 | +import { useSettingsStore } from '../../stores'; |
| 10 | + |
| 11 | +const INTERVAL_OPTIONS = [ |
| 12 | + { value: '0', label: 'Disabled' }, |
| 13 | + { value: '480', label: 'Every 8 hours' }, |
| 14 | + { value: '1440', label: 'Every 24 hours' }, |
| 15 | +] as const; |
| 16 | + |
| 17 | +export const BloxStatusMonitorScreen = () => { |
| 18 | + const bloxStatusCheckInterval = useSettingsStore( |
| 19 | + (state) => state.bloxStatusCheckInterval |
| 20 | + ); |
| 21 | + const setBloxStatusCheckInterval = useSettingsStore( |
| 22 | + (state) => state.setBloxStatusCheckInterval |
| 23 | + ); |
| 24 | + |
| 25 | + return ( |
| 26 | + <FxBox marginHorizontal="20"> |
| 27 | + <SubHeaderText marginVertical="16">Blox Status Monitor</SubHeaderText> |
| 28 | + <FxText variant="bodySmallRegular" marginBottom="8"> |
| 29 | + Check interval |
| 30 | + </FxText> |
| 31 | + <FxText variant="bodyXSRegular" color="content3" marginBottom="16"> |
| 32 | + When enabled, the app periodically checks if your bloxes are reachable |
| 33 | + and notifies you of any that are disconnected — even when the app is |
| 34 | + closed. |
| 35 | + </FxText> |
| 36 | + <FxRadioButton.Group |
| 37 | + value={String(bloxStatusCheckInterval)} |
| 38 | + onValueChange={(val: string) => |
| 39 | + setBloxStatusCheckInterval(Number(val)) |
| 40 | + } |
| 41 | + > |
| 42 | + {INTERVAL_OPTIONS.map((opt) => ( |
| 43 | + <FxBox key={opt.value} marginBottom="8"> |
| 44 | + <FxRadioButtonWithLabel value={opt.value} label={opt.label} /> |
| 45 | + </FxBox> |
| 46 | + ))} |
| 47 | + </FxRadioButton.Group> |
| 48 | + <FxText variant="bodyXSRegular" color="content3" marginTop="16"> |
| 49 | + Note: On iOS, the system controls exact timing and may delay background |
| 50 | + tasks based on battery state and usage patterns. Each blox check takes |
| 51 | + approximately 30 seconds. |
| 52 | + </FxText> |
| 53 | + </FxBox> |
| 54 | + ); |
| 55 | +}; |
0 commit comments