feat: automation UI

merge with automation service
This commit is contained in:
Carlos Valente
2024-11-24 14:33:54 +01:00
committed by Carlos Valente
parent 05e61e7bf8
commit 8b84963e17
19 changed files with 1473 additions and 26 deletions
@@ -0,0 +1,39 @@
import useScrollIntoView from '../../../../common/hooks/useScrollIntoView';
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
import type { PanelBaseProps } from '../../panel-list/PanelList';
import * as Panel from '../../panel-utils/PanelUtils';
import AutomationSettingsForm from './AutomationSettingsForm';
import AutomationsList from './AutomationsList';
import BlueprintsList from './BlueprintsList';
export default function AutomationPanel({ location }: PanelBaseProps) {
const { data, status } = useAutomationSettings();
const settingsRef = useScrollIntoView<HTMLDivElement>('settings', location);
const automationRef = useScrollIntoView<HTMLDivElement>('automations', location);
const blueprintsRef = useScrollIntoView<HTMLDivElement>('blueprints', location);
const isLoading = status === 'pending';
return (
<>
<Panel.Header>Automation</Panel.Header>
<Panel.Section>
<Panel.Loader isLoading={isLoading} />
<div ref={settingsRef}>
<AutomationSettingsForm
enabledAutomations={data.enabledAutomations}
enabledOscIn={data.enabledOscIn}
oscPortIn={data.oscPortIn}
/>
</div>
<div ref={automationRef}>
<AutomationsList automations={data.automations} blueprints={data.blueprints} />
</div>
<div ref={blueprintsRef}>
<BlueprintsList blueprints={data.blueprints} />
</div>
</Panel.Section>
</>
);
}