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) {