Skip to content

A local-first personal finance app

automation UI: open to the first automation (#7811)

Matt Fiddamane83567216f95
diff --git a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsBody.tsx b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsBody.tsx
index 49331d2857..7093453c39 100644
--- a/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsBody.tsx
+++ b/packages/desktop-client/src/components/modals/BudgetAutomationsModal/BudgetAutomationsBody.tsx
@@ -37,6 +37,7 @@ import { AutomationListRow } from './AutomationListRow';
import { BudgetAutomationMigrationWarning } from './BudgetAutomationMigrationWarning';
import { ConflictBanner } from './ConflictBanner';
import { EmptyState } from './EmptyState';
+import { NON_CONTRIBUTION_TYPES } from './TypePicker';
const RULE_LIST_WIDTH = 310;
@@ -158,7 +159,12 @@ export function BudgetAutomationsBody({
const locale = useLocale();
const [entries, setEntries] = useState<AutomationEntry[]>(initialEntries);
- const [activeIdx, setActiveIdx] = useState(0);
+ const initialContributionIdx = initialEntries.findIndex(
+ e => !NON_CONTRIBUTION_TYPES.has(e.displayType),
+ );
+ const [activeIdx, setActiveIdx] = useState(
+ initialContributionIdx >= 0 ? initialContributionIdx : 0,
+ );
const [saving, setSaving] = useState(false);
const [dryRun, setDryRun] = useState<{
budgeted: number;
diff --git a/upcoming-release-notes/7811.md b/upcoming-release-notes/7811.md
new file mode 100644
index 0000000000..66d11f52ee
--- /dev/null
+++ b/upcoming-release-notes/7811.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [matt-fidd]
+---
+
+Automation UI: select the first automation when the modal opens