diff --git a/webapp/src/components/AutomationList/AutomationList.stories.tsx b/webapp/src/components/AutomationList/AutomationList.stories.tsx index a28b0f2..878c435 100644 --- a/webapp/src/components/AutomationList/AutomationList.stories.tsx +++ b/webapp/src/components/AutomationList/AutomationList.stories.tsx @@ -59,15 +59,15 @@ export const FewAutos = Template.bind({}) FewAutos.args = { ...FewAutos.args, automations: [ - createMockAuto(), - createMockAuto(), - createMockAuto(), - createMockAuto(), - createMockAuto(), - createMockAuto(), - createMockAuto(), - createMockAuto(), - createMockAuto(), + createMockAuto({ "Room": "Bathroom", "Type": "Lights", "NewDevice": "Yes", "Remote": "No", "Floor": "1" }), + createMockAuto({ "Room": "Bathroom", "Type": "Climate" }), + createMockAuto({ "Room": "Living Room", "Type": "Climate" }), + createMockAuto({ "Type": "Climate" }), + createMockAuto({ "Type": "Lights", "Routine": "Myself" }), + createMockAuto({ "Routine": "DNS", "Type": "SSL" }), + createMockAuto({ "Room": "Bedroom", "Type": "Lights", "Routine": "Baby" }), + createMockAuto({ "Room": "Office", "Type": "Lights" }), + createMockAuto({ "Room": "Office" }), createMockAuto(), ], } diff --git a/webapp/src/components/AutomationList/AutomationListBox.css b/webapp/src/components/AutomationList/AutomationListBox.css index d758fba..fb1bb76 100644 --- a/webapp/src/components/AutomationList/AutomationListBox.css +++ b/webapp/src/components/AutomationList/AutomationListBox.css @@ -52,10 +52,10 @@ padding-left: 1em; cursor: pointer; display: flex; - justify-content: center; + justify-content: left; align-items: flex-start; gap: 1em; - /* position: relative; */ + flex-wrap: wrap; } .automation-list-box--body--item::before { content: "⊚ "; @@ -64,6 +64,7 @@ display: flex; flex-direction: column; padding-left: 0.25em; + flex: 1; } .automation-list-box--body--item--title > b { font-size: 1em; diff --git a/webapp/src/components/AutomationList/AutomationListBox.tsx b/webapp/src/components/AutomationList/AutomationListBox.tsx index a6f3d25..07ddbf4 100644 --- a/webapp/src/components/AutomationList/AutomationListBox.tsx +++ b/webapp/src/components/AutomationList/AutomationListBox.tsx @@ -10,8 +10,8 @@ import { TrashIcon } from "components/Icons"; export type Props = { automations: AutomationData[]; onSelectAutomation: (i: number) => void; + onRemove: (i: number) => void; onAdd: () => void; - onRemove: () => void; } export const AutomationListBox: FC = ({ @@ -39,6 +39,7 @@ export const AutomationListBox: FC = ({ selected={selected} onChange={setSelected} options={tags} + max={3} />
@@ -129,7 +130,7 @@ const convertGroupsToItems = ( return
{auto.metadata.alias.slice(0, 15)} ({auto.metadata.id.slice(0, 5)}) {auto.metadata.description.slice(0, 25)} -
-
onSelectAutomation(autoIndex)} - > - {Object.keys(auto.metadata.tags).map(tagName => - {tagName}: {auto.metadata.tags[tagName]} - )} +
+ {Object.keys(auto.metadata.tags).map(tagName => + {tagName}: {auto.metadata.tags[tagName]} + )} +
diff --git a/webapp/src/components/AutomationList/index.css b/webapp/src/components/AutomationList/index.css index 35c63f4..2b182be 100644 --- a/webapp/src/components/AutomationList/index.css +++ b/webapp/src/components/AutomationList/index.css @@ -9,8 +9,8 @@ .automation-list--list { flex : 1; - min-width: 200px; - max-width: 200px; + min-width: 400px; + max-width: 400px; position : relative; } @@ -19,8 +19,9 @@ } /* list children: on hide */ -.automation-list--list.hide>.automation-list--list-box { - display: none; +.automation-list--list.hide>.automation-list-box { + width: 0; + opacity: 0; } .automation-list--list.hide { @@ -43,45 +44,3 @@ bottom : 10px; right : 5px; } - - -.automation-list--list-box { - overflow : auto; - height : 100%; - display : flex; - flex-direction : column; - justify-content: flex-start; - align-items : center; - padding-top : 10px; - margin-bottom : 10px; -} - -.automation-list--list-box>* { - margin-bottom: 10px; -} - -.automation-list--list-box>:last-child { - background-color: #070; - color : white; -} - -.automation-list--elm { - position: relative; -} - -.automation-list--elm>button { - padding-left : 5px; - padding-right: 5px; -} - -.automation-list--elm>button>span { - font-size: 0.75em; -} - -.automation-list--elm>.automation-list--elm-remove { - position: absolute; - left : -10px; - top : 10%; - padding : 0; - margin : 0; -} diff --git a/webapp/src/components/AutomationList/index.tsx b/webapp/src/components/AutomationList/index.tsx index 14201df..3dbed71 100644 --- a/webapp/src/components/AutomationList/index.tsx +++ b/webapp/src/components/AutomationList/index.tsx @@ -8,6 +8,7 @@ import { defaultAutomation } from '../../utils/defaults'; import { ArrowIcon, TrashIcon } from "components/Icons"; import { ButtonIcon } from "components/Icons/ButtonIcons"; import { ApiService } from "apiService/core"; +import { AutomationListBox } from "./AutomationListBox"; interface AutomationListParams { @@ -35,21 +36,15 @@ export const AutomationList: FC = ({ // render return
-
- {automations.map((auto, i) => -
- - -
- )} - -
+ }} + onSelectAutomation={setCurrent} + onRemove={onRemove} + /> setHideList(!hideList)} className="automation-list--list-hide" diff --git a/webapp/src/components/Inputs/InputMultiSelect.tsx b/webapp/src/components/Inputs/InputMultiSelect.tsx index 382f0b6..cab1473 100644 --- a/webapp/src/components/Inputs/InputMultiSelect.tsx +++ b/webapp/src/components/Inputs/InputMultiSelect.tsx @@ -43,6 +43,7 @@ export default function InputMultiSelect({ const isSelected = selectedCount > -1; return
{ if (!isSelected) {