From 79c29f6f8121fac170ff39fe80b9dbb8979856e8 Mon Sep 17 00:00:00 2001 From: csawatzky Date: Thu, 20 Nov 2025 11:07:14 -0600 Subject: [PATCH] increasing the limit for conditions on devices running 2.1.9 to 4, and changing the button logic for adding and removing them --- src/interactions/InteractionSettings.tsx | 43 +++++++++++------------- src/models/Device.ts | 12 +++++++ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/interactions/InteractionSettings.tsx b/src/interactions/InteractionSettings.tsx index 40b9132..2519669 100644 --- a/src/interactions/InteractionSettings.tsx +++ b/src/interactions/InteractionSettings.tsx @@ -957,29 +957,16 @@ export default function InteractionSettings(props: Props) { - {index === 0 ? ( - - 1 || !canEdit} - aria-label="Add another condition" - onClick={addCondition} - className={classNames(classes.greenButton, classes.noPadding)}> - - - - ) : ( - - removeCondition(index)} - className={classNames(classes.redButton, classes.noPadding)}> - - - - )} + + removeCondition(index)} + className={classNames(classes.redButton, classes.noPadding)}> + + + {multiNodeSource() && !sensor && ( @@ -1076,6 +1063,16 @@ export default function InteractionSettings(props: Props) { ) : ( You must select a source before adding conditions )} + + = device.maxConditions() || !canEdit} + aria-label="Add another condition" + onClick={addCondition} + className={classNames(classes.greenButton, classes.noPadding)}> + + + ); }; diff --git a/src/models/Device.ts b/src/models/Device.ts index de372ce..2577618 100644 --- a/src/models/Device.ts +++ b/src/models/Device.ts @@ -154,6 +154,18 @@ export class Device { } } + public maxConditions(): number { + let max = 2 + switch (this.settings.platform) { + case pond.DevicePlatform.DEVICE_PLATFORM_V2_CELLULAR_BLACK: + case pond.DevicePlatform.DEVICE_PLATFORM_V2_WIFI_BLUE: + case pond.DevicePlatform.DEVICE_PLATFORM_V2_CELLULAR_BLUE: + case pond.DevicePlatform.DEVICE_PLATFORM_V2_ETHERNET_BLUE: + max = this.status.firmwareVersion >= "2.1.9" ? 4 : 2; + } + return max + } + public featureSupported(feature: string): boolean { let versions = featureVersions.get(feature); if (!versions) {