added duplicate item - bug with reference to old action - low prio
parent
7ffb26c9a5
commit
e65de207c0
|
@ -14,7 +14,12 @@ import {
|
||||||
import Card from "../../../../../Components/Card";
|
import Card from "../../../../../Components/Card";
|
||||||
import MyDropdown from "../../../../../Components/Dropdown";
|
import MyDropdown from "../../../../../Components/Dropdown";
|
||||||
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
import { useCallback, useContext, useEffect, useRef, useState } from "react";
|
||||||
import { AppContext, AppStyles, ModalContainer } from "../../../../../utils";
|
import {
|
||||||
|
AppContext,
|
||||||
|
AppStyles,
|
||||||
|
GetUuid,
|
||||||
|
ModalContainer,
|
||||||
|
} from "../../../../../utils";
|
||||||
import {
|
import {
|
||||||
MyDotsModal,
|
MyDotsModal,
|
||||||
MyPickerModalListItem,
|
MyPickerModalListItem,
|
||||||
|
@ -89,13 +94,31 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<MyDotsModal
|
<MyDotsModal
|
||||||
modalData={[
|
modalData={[
|
||||||
{
|
/*{
|
||||||
|
Duplicated item as references to the old action -> if the color is changed it will apply on both actions
|
||||||
|
|
||||||
icon: "content-duplicate",
|
icon: "content-duplicate",
|
||||||
label: t(
|
label: t(
|
||||||
"screens.device.scenes.modalDotsEditAction.duplicateAction"
|
"screens.device.scenes.modalDotsEditAction.duplicateAction"
|
||||||
),
|
),
|
||||||
onPress: () => {},
|
onPress: () => {
|
||||||
},
|
const currentSelectedAction =
|
||||||
|
appContext.deviceSceneActions.find(
|
||||||
|
(a) => a.actionId === actionId
|
||||||
|
);
|
||||||
|
|
||||||
|
appContext.setDeviceSceneActions((arr) => {
|
||||||
|
const duplicatedAction = {
|
||||||
|
...currentSelectedAction,
|
||||||
|
actionId: GetUuid(),
|
||||||
|
};
|
||||||
|
|
||||||
|
return [...arr, duplicatedAction];
|
||||||
|
});
|
||||||
|
|
||||||
|
navigation.goBack();
|
||||||
|
},
|
||||||
|
},*/
|
||||||
{
|
{
|
||||||
icon: "trash-can",
|
icon: "trash-can",
|
||||||
label: t(
|
label: t(
|
||||||
|
@ -157,6 +180,12 @@ export function LightsEditActionModalContent({ navigation, route }) {
|
||||||
(a) => a.actionId === selectedSceneAction.actionId
|
(a) => a.actionId === selectedSceneAction.actionId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"foundSceneActionIndex",
|
||||||
|
foundSceneActionIndex,
|
||||||
|
newArr[foundSceneActionIndex]
|
||||||
|
);
|
||||||
|
|
||||||
if (foundSceneActionIndex !== -1) {
|
if (foundSceneActionIndex !== -1) {
|
||||||
newArr[foundSceneActionIndex].modeAdjustments.colors =
|
newArr[foundSceneActionIndex].modeAdjustments.colors =
|
||||||
sharedLightModeDefaultColors.value;
|
sharedLightModeDefaultColors.value;
|
||||||
|
|
|
@ -131,6 +131,7 @@ export default function SceneView({ navigation }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{console.log("actions", appContext.deviceSceneActions)}
|
||||||
{device.selectedScene === "" ? (
|
{device.selectedScene === "" ? (
|
||||||
<>
|
<>
|
||||||
<DropdownCard />
|
<DropdownCard />
|
||||||
|
@ -255,13 +256,13 @@ function ActionListItem({ drag, navigation, device, item }) {
|
||||||
{appContext.deviceFirmwareModes.lightModes.find(
|
{appContext.deviceFirmwareModes.lightModes.find(
|
||||||
(lM) => lM.id === item.modeId
|
(lM) => lM.id === item.modeId
|
||||||
).defaults.length === 0
|
).defaults.length === 0
|
||||||
? t(
|
? `${t(
|
||||||
"screens.device.scenes.sceneActionsListItems.layers.applyToLayers",
|
"screens.device.scenes.sceneActionsListItems.layers.applyToLayers",
|
||||||
{
|
{
|
||||||
LAYER_GRAMMAR_FORM: layerGrammarForm,
|
LAYER_GRAMMAR_FORM: layerGrammarForm,
|
||||||
AFFECTED_LAYERS: affectedLayers,
|
AFFECTED_LAYERS: affectedLayers,
|
||||||
}
|
}
|
||||||
)
|
)} `
|
||||||
: `${t(
|
: `${t(
|
||||||
"screens.device.scenes.sceneActionsListItems.layers.setLayersTo",
|
"screens.device.scenes.sceneActionsListItems.layers.setLayersTo",
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue