A local-first personal finance app
Goal Templates keyboard shortcut (#7912)
youngcw000d9574537f
diff --git a/packages/desktop-client/src/components/budget/DynamicBudgetTable.tsx b/packages/desktop-client/src/components/budget/DynamicBudgetTable.tsxindex 88a8debc8f..21ac27bef3 100644--- a/packages/desktop-client/src/components/budget/DynamicBudgetTable.tsx+++ b/packages/desktop-client/src/components/budget/DynamicBudgetTable.tsx@@ -9,6 +9,7 @@ import { View } from '@actual-app/components/view';import * as monthUtils from '@actual-app/core/shared/months';import { FeatureErrorFallback } from '#components/FeatureErrorFallback';+import { useFeatureFlag } from '#hooks/useFeatureFlag';import { useGlobalPref } from '#hooks/useGlobalPref';import { useBudgetMonthCount } from './BudgetMonthCountContext';@@ -47,10 +48,12 @@ const DynamicBudgetTable = ({maxMonths = 3,monthBounds,onMonthSelect,+ onBudgetAction,...props}: DynamicBudgetTableProps) => {const { setDisplayMax } = useBudgetMonthCount();const [categoryExpandedStatePref] = useGlobalPref('categoryExpandedState');+ const isGoalTemplatesEnabled = useFeatureFlag('goalTemplatesEnabled');const categoryExpandedState = categoryExpandedStatePref ?? 0;const numPossible = getNumPossibleMonths(@@ -122,6 +125,18 @@ const DynamicBudgetTable = ({},[_onMonthSelect, startMonth, numMonths],);+ useHotkeys(+ 'shift+t',+ () => {+ onBudgetAction(startMonth, 'overwrite-goal-template', null);+ },+ {+ preventDefault: true,+ scopes: ['app'],+ enabled: isGoalTemplatesEnabled,+ },+ [onBudgetAction, startMonth, isGoalTemplatesEnabled],+ );return (<View@@ -146,6 +161,7 @@ const DynamicBudgetTable = ({startMonth={startMonth}numMonths={numMonths}monthBounds={monthBounds}+ onBudgetAction={onBudgetAction}{...props}/></ErrorBoundary>diff --git a/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx b/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsxindex d23f35546b..a4bc5f1257 100644--- a/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx+++ b/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx@@ -13,6 +13,7 @@ import * as Platform from '@actual-app/core/shared/platform';import { Modal, ModalCloseButton, ModalHeader } from '#components/common/Modal';import { Search } from '#components/common/Search';+import { useFeatureFlag } from '#hooks/useFeatureFlag';type KeyIconProps = {shortcut: string;@@ -151,6 +152,7 @@ export function KeyboardShortcutModal() {const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(null,);+ const isGoalTemplatesEnabled = useFeatureFlag('goalTemplatesEnabled');// In future, we may move this to state and pull overrides from config/db// This would allow us to drive our shortcuts from state instead of hardcoding them@@ -232,6 +234,16 @@ export function KeyboardShortcutModal() {shortcut: '→',description: t('View next month'),},+ ...(isGoalTemplatesEnabled+ ? [+ {+ id: 'overwrite-with-templates',+ shortcut: 'T',+ shift: true,+ description: t('Overwrite with budget templates'),+ },+ ]+ : []),],},{@@ -417,7 +429,7 @@ export function KeyboardShortcutModal() {],},],- [t, ctrl],+ [t, ctrl, isGoalTemplatesEnabled],);const { isSearching, isInCategory, currentCategory, itemsToShow } =diff --git a/upcoming-release-notes/7912.md b/upcoming-release-notes/7912.mdnew file mode 100644index 0000000000..9e143244a8--- /dev/null+++ b/upcoming-release-notes/7912.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [youngcw]+---++Add keyboard shortcut for overwrite templates