mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 05:34:09 +00:00
95536902f5
* fix: prevent add filter from submitting form * refactor: event clarifies whether automations exist but are disabled * refactor: improve readability of automation form * refactor: add affordance for field warnings * refactor: improve visibility of automation off state * refactor: apply warning styles to other feature toggles * Adding playback actions to automations (#2024) * adding intial automation actions * cleaning up * fixing formatting * ran oxfmt * switching action names to playback- to match the dropdown strings * fixing flicker that was caused by scroll arrows gettting unmounted --------- Co-authored-by: Cameron Slipp <cdslipp@gmail.com>
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
|
import useScrollIntoView from '../../../../common/hooks/useScrollIntoView';
|
|
import type { PanelBaseProps } from '../../panel-list/PanelList';
|
|
import * as Panel from '../../panel-utils/PanelUtils';
|
|
import AutomationSettingsForm from './AutomationSettingsForm';
|
|
import AutomationsList from './AutomationsList';
|
|
import TriggersList from './TriggersList';
|
|
|
|
export default function AutomationPanel({ location }: PanelBaseProps) {
|
|
const { data, status } = useAutomationSettings();
|
|
const settingsRef = useScrollIntoView<HTMLDivElement>('settings', location);
|
|
const triggersRef = useScrollIntoView<HTMLDivElement>('triggers', location);
|
|
const automationsRef = useScrollIntoView<HTMLDivElement>('automations', location);
|
|
|
|
const isLoading = status === 'pending';
|
|
const automationState = isLoading ? undefined : data.enabledAutomations;
|
|
const oscInputState = isLoading ? undefined : data.enabledOscIn;
|
|
|
|
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}
|
|
automationState={automationState}
|
|
oscInputState={oscInputState}
|
|
/>
|
|
</div>
|
|
<div ref={automationsRef}>
|
|
<AutomationsList automations={data.automations} enabledAutomations={automationState} />
|
|
</div>
|
|
<div ref={triggersRef}>
|
|
<TriggersList triggers={data.triggers} automations={data.automations} enabledAutomations={automationState} />
|
|
</div>
|
|
</Panel.Section>
|
|
</>
|
|
);
|
|
}
|