From f2a1eeb9716bfb353d37b06d8b3291226f98235c Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 10 Aug 2023 13:56:51 +0000 Subject: [PATCH] changed add action button to disabled if last action is stop --- src/Components/Button/index.js | 7 ++- .../Device/modals/EditActions/Stop/index.js | 9 +++- src/Screens/Device/scene.js | 53 +++++++++---------- src/utils.js | 12 ++--- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/src/Components/Button/index.js b/src/Components/Button/index.js index e024092..32fbd50 100644 --- a/src/Components/Button/index.js +++ b/src/Components/Button/index.js @@ -38,16 +38,19 @@ export function MyTextButton({ onPress, actionColor, iconName, + disabled, }) { const appContext = useContext(AppContext); - const color = actionColor + const color = disabled + ? appContext.appTheme.textDisabled + : actionColor ? appContext.appTheme.colors.primary : appContext.appTheme.textSecondary; return ( - + - + + {t("screens.device.scenes.editActions.modalStopEditAction.description")} diff --git a/src/Screens/Device/scene.js b/src/Screens/Device/scene.js index fc59f18..1e61d29 100644 --- a/src/Screens/Device/scene.js +++ b/src/Screens/Device/scene.js @@ -189,29 +189,7 @@ export default function SceneView({ navigation }) { } ListFooterComponent={ <> - {lastSceneAction?.type !== Constants.actionType.stop ? ( - - navigation.navigate("modalAddSceneAction", { - deviceFirmwareVersion: device.firmware.version, - }) - } - iconName="plus-circle-outline" - /> - ) : ( + {lastSceneAction?.type === Constants.actionType.stop && ( )} + + + navigation.navigate("modalAddSceneAction", { + deviceFirmwareVersion: device.firmware.version, + }) + } + iconName="plus-circle-outline" + disabled={lastSceneAction?.type === Constants.actionType.stop} + /> } renderItem={({ item, drag }) => { @@ -564,11 +565,7 @@ function ActionListItem({ drag, navigation, device, item }) { }} style={{ padding: 4 }} > - + diff --git a/src/utils.js b/src/utils.js index c2b72ed..eda1f9c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,13 +1,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage"; -import { createContext, createRef, useEffect, useState } from "react"; +import { createContext, createRef, useState } from "react"; import { useTranslation } from "react-i18next"; -import { - Appearance, - Platform, - StyleSheet, - Vibration, - View, -} from "react-native"; +import { Appearance, Platform, StyleSheet, View } from "react-native"; import uuid from "react-native-uuid"; import * as Haptics from "expo-haptics"; @@ -85,6 +79,7 @@ const DarkAppTheme = { }, text: "#fff", textSecondary: "#ddd", + textDisabled: "#b2bec3", backgroundColor: "#21252a", card: { backgroundColor: "#2b3139", @@ -137,6 +132,7 @@ const LightAppTheme = { }, text: "#000", textSecondary: "#555", + textDisabled: "#636e72", backgroundColor: "#f7f7f7", card: { backgroundColor: "#fff",