clean up
This commit is contained in:
1 parent
2a827c24f6
commit
57c86093a4
29 files changed
+145
-1901
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { useConnectedApiService } from "apiService";
|
||||
import { makeStory } from "devUtils";
|
||||
import { AutomationRoute } from "./automation";
|
||||
|
||||
const { make, componentMeta } = makeStory({
|
||||
Component: () => {
|
||||
return <AutomationRoute api={useConnectedApiService()} />;
|
||||
},
|
||||
meta: {
|
||||
title: "App/Routes",
|
||||
},
|
||||
});
|
||||
|
||||
export default componentMeta;
|
||||
|
||||
export const Automations = make({});
|
||||
@@ -1,13 +1,27 @@
|
||||
import { ApiService } from "apiService/core";
|
||||
import { ConnectedAutomationList } from "components/AutomationList";
|
||||
import { DEFAULT_DIMS } from "components/DAGGraph/elements/constants";
|
||||
import { Page } from "components/Page";
|
||||
import { FC } from "react";
|
||||
import { useHA } from "haService";
|
||||
import { AutomationManager } from "components/AutomationManager";
|
||||
|
||||
export const AutomationRoute: FC<{ api: ApiService }> = ({ api }) => {
|
||||
const ha = useHA();
|
||||
return (
|
||||
<Page>
|
||||
<ConnectedAutomationList dims={DEFAULT_DIMS} api={api} />
|
||||
<AutomationManager
|
||||
api={api}
|
||||
onAutomationStateChange={(eid, on) => {
|
||||
ha.callService(
|
||||
"automation",
|
||||
on ? "turn_on" : "turn_off",
|
||||
{},
|
||||
{
|
||||
entity_id: eid,
|
||||
}
|
||||
);
|
||||
}}
|
||||
haEntities={ha.entities}
|
||||
/>
|
||||
</Page>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user