v1 of loaded manager
This commit is contained in:
1 parent
a9c3e9c890
commit
96617e7b0c
17 files changed
+295
-88
No files matched your search
@@ -25,4 +25,25 @@
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.automation-manager--sidebar-box--bottom-buttons .hide-btn {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.automation-manager--sidebar.hidden {
|
||||
width: 2.5em;
|
||||
}
|
||||
|
||||
.automation-manager--sidebar.hidden .automation-manager--sidebar-box--nav,
|
||||
.automation-manager--sidebar.hidden .automation-manager--sidebar-box--list,
|
||||
.automation-manager--sidebar.hidden .automation-manager--sidebar-box--bottom-buttons .add-btn {
|
||||
width: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.automation-manager--sidebar.hidden .automation-manager--sidebar-box--bottom-buttons .hide-btn {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AutomationListSidebar } from ".";
|
||||
import { AutomationManagerSidebar } from ".";
|
||||
import { useTagDB } from "../TagDB";
|
||||
import { useState } from "react";
|
||||
import { AutomationListAuto } from "../types";
|
||||
import { AutomationManagerAuto } from "../types";
|
||||
|
||||
import { makeStory } from "devUtils";
|
||||
|
||||
@@ -9,7 +9,7 @@ const story = makeStory({
|
||||
meta: {
|
||||
title: "App/AutomationManager/Sidebar",
|
||||
},
|
||||
Component: AutomationListSidebar,
|
||||
Component: AutomationManagerSidebar,
|
||||
BaseTemplate: (args) => {
|
||||
const [automations, setAutomations] = useState(args.automations);
|
||||
const [selectedAutomationId, setSelAutoId] = useState(
|
||||
@@ -29,7 +29,7 @@ const story = makeStory({
|
||||
}
|
||||
};
|
||||
return (
|
||||
<AutomationListSidebar
|
||||
<AutomationManagerSidebar
|
||||
selectedAutomationId={selectedAutomationId}
|
||||
tagsDB={useTagDB(automations, (a, t) => onTagUpdate(t, a))}
|
||||
automations={automations}
|
||||
@@ -78,11 +78,13 @@ const story = makeStory({
|
||||
|
||||
export default story.componentMeta;
|
||||
|
||||
const make = (automations: AutomationListAuto[]) =>
|
||||
const make = (automations: AutomationManagerAuto[]) =>
|
||||
story.make({
|
||||
automations,
|
||||
});
|
||||
const makeAuto = (data: Partial<AutomationListAuto>): AutomationListAuto => {
|
||||
const makeAuto = (
|
||||
data: Partial<AutomationManagerAuto>
|
||||
): AutomationManagerAuto => {
|
||||
const id = `${Date.now()}_${Math.random().toString(26).slice(3, 6)}`;
|
||||
return {
|
||||
id,
|
||||
|
||||
@@ -2,6 +2,8 @@ import "./index.css";
|
||||
|
||||
import { FC, useState } from "react";
|
||||
|
||||
import ArrowIcon from "@mui/icons-material/ArrowBackIosNewOutlined";
|
||||
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import InputMultiSelect from "components/Inputs/InputMultiSelect";
|
||||
|
||||
@@ -9,15 +11,19 @@ import { ListBoxGroup } from "../ListBoxGroup";
|
||||
import { filterAutomations } from "../helpers";
|
||||
import { TagDB } from "../TagDB";
|
||||
import { convertGroupingToItems, makeGrouping } from "../automationGrouper";
|
||||
import { AutomationListAuto, AutomationListAutoUpdatable } from "../types";
|
||||
import {
|
||||
AutomationManagerAuto,
|
||||
AutomationManagerAutoUpdatable,
|
||||
} from "../types";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
|
||||
export type AutomationListSidebarProps = {
|
||||
export type AutomationManagerSidebarProps = {
|
||||
tagsDB: TagDB;
|
||||
automations: AutomationListAuto[];
|
||||
automations: AutomationManagerAuto[];
|
||||
selectedAutomationId: string | null;
|
||||
onAutomationUpdate: (
|
||||
a: AutomationListAutoUpdatable,
|
||||
a: AutomationManagerAutoUpdatable,
|
||||
aid: string,
|
||||
eid: string
|
||||
) => void;
|
||||
@@ -25,7 +31,7 @@ export type AutomationListSidebarProps = {
|
||||
onAutomationAdd: () => void;
|
||||
onSelectedAutomationId: (aid: string) => void;
|
||||
};
|
||||
export const AutomationListSidebar: FC<AutomationListSidebarProps> = ({
|
||||
export const AutomationManagerSidebar: FC<AutomationManagerSidebarProps> = ({
|
||||
automations,
|
||||
tagsDB,
|
||||
onAutomationAdd,
|
||||
@@ -35,6 +41,7 @@ export const AutomationListSidebar: FC<AutomationListSidebarProps> = ({
|
||||
}) => {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const [selectedTagIdx, setSelectedTagIdx] = useState<number[]>([]);
|
||||
const [isHidden, setHidden] = useState(false);
|
||||
|
||||
const tags = tagsDB.getTagNames([]);
|
||||
|
||||
@@ -56,7 +63,12 @@ export const AutomationListSidebar: FC<AutomationListSidebarProps> = ({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="automation-manager--sidebar">
|
||||
<div
|
||||
className={[
|
||||
"automation-manager--sidebar",
|
||||
isHidden ? "hidden" : "shown",
|
||||
].join(" ")}
|
||||
>
|
||||
<div className="automation-manager--sidebar-box--nav">
|
||||
<InputText label="Search" value={searchText} onChange={setSearchText} />
|
||||
<InputMultiSelect
|
||||
@@ -80,9 +92,15 @@ export const AutomationListSidebar: FC<AutomationListSidebarProps> = ({
|
||||
))}
|
||||
</div>
|
||||
<div className="automation-manager--sidebar-box--bottom-buttons">
|
||||
<Button onClick={onAutomationAdd} color="primary">
|
||||
<Button onClick={onAutomationAdd} color="primary" className="add-btn">
|
||||
Add
|
||||
</Button>
|
||||
<ButtonIcon
|
||||
className="hide-btn"
|
||||
color="secondary"
|
||||
icon={<ArrowIcon />}
|
||||
onClick={() => setHidden(!isHidden)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user