latest work
This commit is contained in:
1 parent
651ba865b1
commit
240f8faef7
13 files changed
+323
-57
No files matched your search
@@ -1,11 +1,19 @@
|
||||
import { HAEntitiesState } from 'haService';
|
||||
import { FC } from 'react';
|
||||
import { AutomationAction } from 'types/automations/actions';
|
||||
import { AutomationCondition } from 'types/automations/conditions';
|
||||
export interface OptionManager<T> {
|
||||
export type OptionManager<T> = {
|
||||
defaultState(): T;
|
||||
isReady(s: T): boolean;
|
||||
} & ({
|
||||
renderOptionList(s: T, set: (s: T) => void, entities: HAEntitiesState): JSX.Element;
|
||||
}
|
||||
} | {
|
||||
Component: FC<{
|
||||
state: T,
|
||||
setState: (s: T) => void,
|
||||
entities: HAEntitiesState,
|
||||
}>
|
||||
})
|
||||
|
||||
|
||||
export const updateConditionData = <T extends AutomationCondition>(
|
||||
@@ -13,17 +21,17 @@ export const updateConditionData = <T extends AutomationCondition>(
|
||||
) => (
|
||||
state: T,
|
||||
data: Partial<T>,
|
||||
) => setState({
|
||||
...state,
|
||||
...data,
|
||||
})
|
||||
) => setState({
|
||||
...state,
|
||||
...data,
|
||||
})
|
||||
|
||||
export const updateActionData = <T extends AutomationAction>(
|
||||
state: T,
|
||||
setState: (s: T) => void
|
||||
) => (
|
||||
data: Partial<T>,
|
||||
) => setState({
|
||||
...state,
|
||||
...data,
|
||||
})
|
||||
) => setState({
|
||||
...state,
|
||||
...data,
|
||||
})
|
||||
Reference in new issue
Block a user