From 326775848b068f99ca5e7e3c131f7b96a025f8ef Mon Sep 17 00:00:00 2001 From: Ari Date: Thu, 16 Jun 2022 21:23:28 -0400 Subject: [PATCH] trigger state autofill --- .../components/Inputs/InputAutoComplete.tsx | 7 +- webapp/src/components/Inputs/InputList.tsx | 1 + webapp/src/components/Inputs/InputText.tsx | 96 +++-- webapp/src/components/Inputs/extras.tsx | 5 +- .../NodeEditor/OptionManager/TriggerState.tsx | 160 ++++++-- .../components/NodeEditor/index.stories.tsx | 9 + webapp/src/haService/index.ts | 46 +++ webapp/src/utils/automations.ts | 384 ++++++++++-------- 8 files changed, 440 insertions(+), 268 deletions(-) diff --git a/webapp/src/components/Inputs/InputAutoComplete.tsx b/webapp/src/components/Inputs/InputAutoComplete.tsx index 0920ddc..9c3a87c 100644 --- a/webapp/src/components/Inputs/InputAutoComplete.tsx +++ b/webapp/src/components/Inputs/InputAutoComplete.tsx @@ -5,6 +5,7 @@ import Chip from "@mui/material/Chip"; import { Badge } from "@mui/material"; import { SearchItem } from "./extras"; import { ReactNode } from "react"; +import { prettyName } from "utils/formatting"; export type BaseOption = { id: string; @@ -204,7 +205,11 @@ export function InputAutoComplete( size="medium" label={ <> - {id === label ? {label} : {label}} + {id === label ? ( + {prettyName(label)} + ) : ( + {label} + )} {id !== label && !props.onlyShowLabel && ( {id} )} diff --git a/webapp/src/components/Inputs/InputList.tsx b/webapp/src/components/Inputs/InputList.tsx index c69b39a..a2a9101 100644 --- a/webapp/src/components/Inputs/InputList.tsx +++ b/webapp/src/components/Inputs/InputList.tsx @@ -41,6 +41,7 @@ export function InputList({ className={className} variant="filled" sx={{ marginRight: "0.25em", minWidth: `${label.length * 0.75}em` }} + fullWidth > {label}