diff --git a/packages/protodevice/src/Subsystem.tsx b/packages/protodevice/src/Subsystem.tsx index 7b3d16fda..63e3f7e52 100644 --- a/packages/protodevice/src/Subsystem.tsx +++ b/packages/protodevice/src/Subsystem.tsx @@ -1,9 +1,9 @@ import React, { useState } from "react"; -import { XStack, YStack, Text, Paragraph, Button, Input, Spinner, Switch, useToastController } from '@my/ui'; +import { XStack, YStack, Text, Paragraph, Button, Input, Spinner, Switch, useToastController, Select } from '@my/ui'; import { ContainerLarge } from 'protolib/components/Container'; import { Tinted } from 'protolib/components/Tinted'; import { Chip } from 'protolib/components/Chip'; -import { Megaphone, MegaphoneOff } from "@tamagui/lucide-icons" +import { Megaphone, MegaphoneOff, ChevronDown, Check } from "@tamagui/lucide-icons" import { useMqttState, useSubscription } from 'protolib/lib/mqtt'; import { useFetch } from 'protolib/lib/useFetch' import { DeviceSubsystemMonitor, getPeripheralTopic } from 'protolib/bundles/devices/devices/devicesSchemas'; @@ -111,6 +111,8 @@ const Action = ({ deviceName, action }) => { var type if (action?.payload?.value) { type = "button" + } else if (Array.isArray(action?.payload)) { + type = "select" } else if (action?.payload?.type != "json-schema") { type = "input" } @@ -146,6 +148,45 @@ const Action = ({ deviceName, action }) => { Send + case "select": + const [selectedOption, setSelectedOption] = useState(action.payload[0].value); + const payloadOptions = Array.isArray(action.payload.value) ? action.payload.value : []; + + console.log("🤖 ~ Action ~ selectedOption:", selectedOption) + + return + {action.label ?? action.name} + + + default: return {action.label ?? action.name}