A local-first personal finance app
[Feature] Account Net Worth Graph (#5037)
passabilities.ethe30a38ced8d1
diff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-7-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-7-chromium-linux.pngindex 1cec61bc9d..fce1272d39 100644Binary files a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-7-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-7-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-8-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-8-chromium-linux.pngindex fc34984e22..743c89ef7a 100644Binary files a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-8-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-8-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-9-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-9-chromium-linux.pngindex 801bb6bf6d..bf4cdcf3cd 100644Binary files a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-9-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-category-9-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-7-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-7-chromium-linux.pngindex c1a615ce72..80d21c3ef0 100644Binary files a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-7-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-7-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-8-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-8-chromium-linux.pngindex ebd242fdbb..f208de733f 100644Binary files a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-8-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-8-chromium-linux.png differdiff --git a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-9-chromium-linux.png b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-9-chromium-linux.pngindex 6ff7ec0a9c..44170d23ce 100644Binary files a/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-9-chromium-linux.png and b/packages/desktop-client/e2e/transactions.test.ts-snapshots/Transactions-filters-transactions-by-date-9-chromium-linux.png differdiff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsxindex e40f09c7a7..5dfac76e1b 100644--- a/packages/desktop-client/src/components/accounts/Account.tsx+++ b/packages/desktop-client/src/components/accounts/Account.tsx@@ -215,6 +215,8 @@ type AccountInternalProps = {filterConditions: RuleConditionEntity[];showBalances?: boolean;setShowBalances: (newValue: boolean) => void;+ showNetWorthChart: boolean;+ setShowNetWorthChart: (newValue: boolean) => void;showCleared?: boolean;setShowCleared: (newValue: boolean) => void;showReconciled: boolean;@@ -758,7 +760,8 @@ class AccountInternal extends PureComponent<| 'toggle-balance'| 'remove-sorting'| 'toggle-cleared'- | 'toggle-reconciled',+ | 'toggle-reconciled'+ | 'toggle-net-worth-chart',) => {const accountId = this.props.accountId!;const account = this.props.accounts.find(@@ -861,6 +864,13 @@ class AccountInternal extends PureComponent<);}break;+ case 'toggle-net-worth-chart':+ if (this.props.showNetWorthChart) {+ this.props.setShowNetWorthChart(false);+ } else {+ this.props.setShowNetWorthChart(true);+ }+ break;default:}};@@ -1741,6 +1751,7 @@ class AccountInternal extends PureComponent<tableRef={this.table}isNameEditable={isNameEditable ?? false}workingHard={workingHard ?? false}+ accountId={accountId}account={account}filterId={filterId}savedFilters={this.props.savedFilters}@@ -1941,6 +1952,9 @@ export function Account() {const [showBalances, setShowBalances] = useSyncedPref(`show-balances-${params.id}`,);+ const [showNetWorthChart, setShowNetWorthChart] = useSyncedPref(+ `show-account-${params.id}-net-worth-chart`,+ );const [hideCleared, setHideCleared] = useSyncedPref(`hide-cleared-${params.id}`,);@@ -1978,6 +1992,8 @@ export function Account() {setShowBalances={showBalances =>setShowBalances(String(showBalances))}+ showNetWorthChart={String(showNetWorthChart) === 'true'}+ setShowNetWorthChart={val => setShowNetWorthChart(String(val))}showCleared={String(hideCleared) !== 'true'}setShowCleared={val => setHideCleared(String(!val))}showReconciled={String(hideReconciled) !== 'true'}diff --git a/packages/desktop-client/src/components/accounts/Balance.tsx b/packages/desktop-client/src/components/accounts/Balance.tsxindex db5e4fdeab..d3e2577e00 100644--- a/packages/desktop-client/src/components/accounts/Balance.tsx+++ b/packages/desktop-client/src/components/accounts/Balance.tsx@@ -39,7 +39,6 @@ function DetailedBalance({return (<Textstyle={{- marginLeft: 15,borderRadius: 4,padding: '4px 6px',color: theme.pillText,@@ -167,10 +166,10 @@ function MoreBalances({ balanceQuery }: MoreBalancesProps) {});return (- <View style={{ flexDirection: 'row' }}>+ <><DetailedBalance name={t('Cleared total:')} balance={cleared ?? 0} /><DetailedBalance name={t('Uncleared total:')} balance={uncleared ?? 0} />- </View>+ </>);}@@ -199,9 +198,11 @@ export function Balances({<Viewstyle={{flexDirection: 'row',+ flexWrap: 'wrap',alignItems: 'center',marginTop: -5,marginLeft: -5,+ gap: 10,}}><Buttondiff --git a/packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx b/packages/desktop-client/src/components/accounts/BalanceHistoryGraph.tsxsimilarity index 50%rename from packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsxrename to packages/desktop-client/src/components/accounts/BalanceHistoryGraph.tsxindex 9a95959e08..99a2577917 100644--- a/packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx+++ b/packages/desktop-client/src/components/accounts/BalanceHistoryGraph.tsx@@ -1,4 +1,11 @@-import React, { useState, useEffect, useMemo } from 'react';+import React, {+ useState,+ useEffect,+ useMemo,+ type CSSProperties,+ type Ref,+} from 'react';+import AutoSizer from 'react-virtualized-auto-sizer';import { SpaceBetween } from '@actual-app/components/space-between';import { styles } from '@actual-app/components/styles';@@ -6,24 +13,23 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';import { subMonths, format, eachMonthOfInterval } from 'date-fns';-import { LineChart, Line, YAxis, Tooltip as RechartsTooltip } from 'recharts';+import { AreaChart, Area, YAxis, Tooltip as RechartsTooltip } from 'recharts';import * as monthUtils from 'loot-core/shared/months';-import { q } from 'loot-core/shared/query';import { integerToCurrency } from 'loot-core/shared/util';import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';import { LoadingIndicator } from '@desktop-client/components/reports/LoadingIndicator';import { useLocale } from '@desktop-client/hooks/useLocale';+import * as query from '@desktop-client/queries';import { aqlQuery } from '@desktop-client/queries/aqlQuery';-const CHART_HEIGHT = 70;-const CHART_WIDTH = 280;const LABEL_WIDTH = 70;-const TOTAL_WIDTH = CHART_WIDTH + LABEL_WIDTH;type BalanceHistoryGraphProps = {- accountId: string;+ accountId?: string;+ style?: CSSProperties;+ ref?: Ref<HTMLDivElement>;};type Balance = {@@ -31,7 +37,11 @@ type Balance = {balance: number;};-export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {+export function BalanceHistoryGraph({+ accountId,+ style,+ ref,+}: BalanceHistoryGraphProps) {const locale = useLocale();const [balanceData, setBalanceData] = useState<Array<{ date: string; balance: number }>@@ -49,6 +59,10 @@ export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {if (firstBalance === 0) return 0;return ((lastBalance - firstBalance) / Math.abs(firstBalance)) * 100;}, [balanceData]);+ const color = useMemo(+ () => (percentageChange >= 0 ? theme.noticeTextLight : theme.errorText),+ [percentageChange],+ );useEffect(() => {async function fetchBalanceHistory() {@@ -61,18 +75,18 @@ export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {const [starting, totals]: [number, Balance[]] = await Promise.all([aqlQuery(- q('transactions')+ query+ .transactions(accountId).filter({- account: accountId,date: { $lt: monthUtils.firstDayOfMonth(startDate) },}).calculate({ $sum: '$amount' }),).then(({ data }) => data),aqlQuery(- q('transactions')+ query+ .transactions(accountId).filter({- account: accountId,$and: [{ date: { $gte: monthUtils.firstDayOfMonth(startDate) } },{ date: { $lte: monthUtils.lastDayOfMonth(endDate) } },@@ -156,88 +170,127 @@ export function BalanceHistoryGraph({ accountId }: BalanceHistoryGraphProps) {// State to track if the chart is hovered (used to conditionally render PrivacyFilter)const [isHovered, setIsHovered] = useState(false);- if (loading) {- return (- <div style={{ width: TOTAL_WIDTH, height: CHART_HEIGHT, marginTop: 10 }}>- <LoadingIndicator />- </div>- );- }-return (- <div style={{ width: TOTAL_WIDTH, marginTop: 10 }}>- <div- style={{- display: 'flex',- alignItems: 'stretch',- justifyContent: 'space-between',- }}- onMouseEnter={() => setIsHovered(true)}- onMouseLeave={() => setIsHovered(false)}- >- <LineChart- data={balanceData}- width={CHART_WIDTH}- height={CHART_HEIGHT}- onMouseMove={state => {- if (state && state.activePayload && state.activePayload[0]) {- setHoveredValue(state.activePayload[0].payload);- }- }}- >- <YAxis domain={['dataMin', 'dataMax']} hide={true} />- <RechartsTooltip- contentStyle={{ display: 'none' }}- isAnimationActive={false}- />- <Line- type="monotone"- dataKey="balance"- stroke={- percentageChange >= 0 ? theme.noticeTextLight : theme.errorText- }- strokeWidth={2}- dot={false}- animationDuration={0}- />- </LineChart>-- <SpaceBetween- direction="vertical"- style={{- alignItems: 'flex-end',- justifyContent: 'space-between',- width: LABEL_WIDTH,- textAlign: 'right',- ...styles.verySmallText,- }}- >- {percentageChange === 0 ? (- <div />- ) : (- <Text- style={{- color:- percentageChange >= 0- ? theme.noticeTextLight- : theme.errorText,- }}- >- {percentageChange >= 0 ? '+' : ''}- {percentageChange.toFixed(1)}%- </Text>- )}-- {hoveredValue && (- <View>- <Text style={{ fontWeight: 800 }}>{hoveredValue.date}</Text>- <PrivacyFilter activationFilters={[() => !isHovered]}>- <Text>{integerToCurrency(hoveredValue.balance)}</Text>- </PrivacyFilter>+ <View ref={ref} style={{ margin: 10, ...style }}>+ <AutoSizer>+ {({ width, height }: { width: number; height: number }) => {+ if (loading) {+ return (+ <div style={{ width, height }}>+ <LoadingIndicator />+ </div>+ );+ }++ return (+ <View style={{ width }}>+ <div+ style={{+ display: 'flex',+ alignItems: 'stretch',+ justifyContent: 'space-between',+ }}+ onMouseEnter={() => setIsHovered(true)}+ onMouseLeave={() => setIsHovered(false)}+ >+ <AreaChart+ data={balanceData}+ width={width - LABEL_WIDTH}+ height={height}+ >+ <defs>+ <linearGradient+ id="fillLight"+ x1="0.9"+ y1="0"+ x2="0.3"+ y2="1"+ >+ <stop stopColor={theme.noticeTextLight} stopOpacity={1} />+ <stop+ offset="90%"+ stopColor={theme.noticeTextLight}+ stopOpacity={0.2}+ />+ </linearGradient>+ <linearGradient+ id="fillError"+ x1="0.9"+ y1="0"+ x2="0.3"+ y2="1"+ >+ <stop stopColor={theme.errorText} stopOpacity={1} />+ <stop+ offset="90%"+ stopColor={theme.errorText}+ stopOpacity={0.2}+ />+ </linearGradient>+ </defs>+ <YAxis domain={['dataMin', 'dataMax']} hide={true} />+ <RechartsTooltip+ contentStyle={{+ display: 'none',+ }}+ labelFormatter={(label, items) => {+ const data = items[0]?.payload;+ if (data) {+ setHoveredValue(data);+ }+ return '';+ }}+ isAnimationActive={false}+ />+ <Area+ type="monotone"+ dataKey="balance"+ stroke={color}+ strokeWidth={2}+ animationDuration={0}+ fill={+ color === theme.noticeTextLight+ ? 'url(#fillLight)'+ : 'url(#fillError)'+ }+ />+ </AreaChart>++ <SpaceBetween+ direction="vertical"+ style={{+ alignItems: 'flex-end',+ justifyContent: 'space-between',+ width: LABEL_WIDTH,+ textAlign: 'right',+ ...styles.verySmallText,+ }}+ >+ {percentageChange === 0 ? (+ <div />+ ) : (+ <Text style={{ color }}>+ {percentageChange >= 0 ? '+' : ''}+ {percentageChange.toFixed(1)}%+ </Text>+ )}++ {hoveredValue && (+ <View>+ <Text style={{ fontWeight: 800 }}>+ {hoveredValue.date}+ </Text>+ <PrivacyFilter activationFilters={[() => !isHovered]}>+ <Text>{integerToCurrency(hoveredValue.balance)}</Text>+ </PrivacyFilter>+ </View>+ )}+ </SpaceBetween>+ </div></View>- )}- </SpaceBetween>- </div>- </div>+ );+ }}+ </AutoSizer>+ </View>);}diff --git a/packages/desktop-client/src/components/accounts/Header.tsx b/packages/desktop-client/src/components/accounts/Header.tsxindex be149ee586..4484f11d98 100644--- a/packages/desktop-client/src/components/accounts/Header.tsx+++ b/packages/desktop-client/src/components/accounts/Header.tsx@@ -1,6 +1,7 @@import React, {type ComponentProps,type ReactNode,+ useEffect,useRef,useState,} from 'react';@@ -42,6 +43,7 @@ import {import { type TableRef } from './Account';import { Balances } from './Balance';+import { BalanceHistoryGraph } from './BalanceHistoryGraph';import { ReconcileMenu, ReconcilingMessage } from './Reconcile';import { AnimatedRefresh } from '@desktop-client/components/AnimatedRefresh';@@ -55,6 +57,7 @@ import { useDateFormat } from '@desktop-client/hooks/useDateFormat';import { useLocale } from '@desktop-client/hooks/useLocale';import { useLocalPref } from '@desktop-client/hooks/useLocalPref';import { useSplitsExpanded } from '@desktop-client/hooks/useSplitsExpanded';+import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';import { useSyncServerStatus } from '@desktop-client/hooks/useSyncServerStatus';type AccountHeaderProps = {@@ -62,6 +65,7 @@ type AccountHeaderProps = {isNameEditable: boolean;workingHard: boolean;accountName: string;+ accountId?: string;account?: AccountEntity;filterId?: SavedFilter;savedFilters: TransactionFilterEntity[];@@ -137,6 +141,7 @@ export function AccountHeader({isNameEditable,workingHard,accountName,+ accountId,account,filterId,savedFilters,@@ -199,6 +204,10 @@ export function AccountHeader({const isUsingServer = syncServerStatus !== 'no-server';const isServerOffline = syncServerStatus === 'offline';const [_, setExpandSplitsPref] = useLocalPref('expand-splits');+ const [showNetWorthChartPref, setShowNetWorthChartPref] = useSyncedPref(+ `show-account-${accountId}-net-worth-chart`,+ );+ const showNetWorthChart = showNetWorthChartPref === 'true';const dateFormat = useDateFormat() || 'MM/dd/yyyy';const locale = useLocale();@@ -223,6 +232,32 @@ export function AccountHeader({}}+ const graphRef = useRef<HTMLDivElement>(null);+ useEffect(() => {+ const handleResize = () => {+ const ele = graphRef.current;+ if (!ele) return;+ const clone = ele.cloneNode(true) as HTMLDivElement;+ Object.assign(clone.style, {+ visibility: 'hidden',+ display: 'flex',+ });+ ele.after(clone);+ if (clone.clientHeight < window.innerHeight * 0.15) {+ setShowNetWorthChartPref('true');+ } else {+ setShowNetWorthChartPref('false');+ }+ clone.remove();+ };++ window.addEventListener('resize', handleResize);++ return () => {+ window.removeEventListener('resize', handleResize);+ };+ }, [setShowNetWorthChartPref]);+useHotkeys('ctrl+f, cmd+f, meta+f',() => {@@ -269,41 +304,63 @@ export function AccountHeader({<><View style={{ ...styles.pageContent, paddingBottom: 10, flexShrink: 0 }}><View- style={{ marginTop: 2, marginBottom: 10, alignItems: 'flex-start' }}+ style={{+ flexDirection: 'column',+ marginTop: 2,+ justifyContent: 'space-between',+ gap: 10,+ }}><Viewstyle={{- flexDirection: 'row',- alignItems: 'center',- gap: 3,+ flexGrow: 1,+ alignItems: 'flex-start',+ gap: 10,}}>- {!!account?.bank && (- <AccountSyncSidebar+ <View+ style={{+ flexDirection: 'row',+ alignItems: 'center',+ gap: 3,+ }}+ >+ {!!account?.bank && (+ <AccountSyncSidebar+ account={account}+ failedAccounts={failedAccounts}+ accountsSyncing={accountsSyncing}+ />+ )}+ <AccountNameFieldaccount={account}- failedAccounts={failedAccounts}- accountsSyncing={accountsSyncing}+ accountName={accountName}+ isNameEditable={isNameEditable}+ saveNameError={saveNameError}+ onSaveName={onSaveName}/>- )}- <AccountNameField+ </View>++ <Balances+ balanceQuery={balanceQuery}+ showExtraBalances={showExtraBalances}+ onToggleExtraBalances={onToggleExtraBalances}account={account}- accountName={accountName}- isNameEditable={isNameEditable}- saveNameError={saveNameError}- onSaveName={onSaveName}+ isFiltered={isFiltered}+ filteredAmount={filteredAmount}/></View>- </View>-- <Balances- balanceQuery={balanceQuery}- showExtraBalances={showExtraBalances}- onToggleExtraBalances={onToggleExtraBalances}- account={account}- isFiltered={isFiltered}- filteredAmount={filteredAmount}- />+ <BalanceHistoryGraph+ ref={graphRef}+ accountId={accountId}+ style={{+ height: 'calc(5vh + 5vw)',+ margin: 0,+ display: showNetWorthChart ? 'flex' : 'none',+ }}+ />+ </View><Stackspacing={2}direction="row"@@ -484,6 +541,7 @@ export function AccountHeader({<AccountMenuaccount={account}canSync={canSync}+ showNetWorthChart={showNetWorthChart}canShowBalances={canCalculateBalance ? canCalculateBalance() : false}@@ -523,6 +581,12 @@ export function AccountHeader({]: []),{ name: 'export', text: t('Export') },+ {+ name: 'toggle-net-worth-chart',+ text: showNetWorthChart+ ? t('Hide balance chart')+ : t('Show balance chart'),+ },]}/></Dialog>@@ -531,7 +595,6 @@ export function AccountHeader({</View>)}</Stack>-{filterConditions?.length > 0 && (<FiltersStackconditions={filterConditions}@@ -615,39 +678,38 @@ function AccountNameField({setEditingName(false);};- if (editingName) {- return (- <>- <InitialFocus>- <Input- defaultValue={accountName}- onEnter={handleSave}- onUpdate={handleSave}- onEscape={() => setEditingName(false)}- style={{- fontSize: 25,- fontWeight: 500,- marginTop: -3,- marginBottom: -4,- marginLeft: -6,- paddingTop: 2,- paddingBottom: 2,- width: Math.max(20, accountName.length) + 'ch',- }}- />- </InitialFocus>- {saveNameError && (- <View style={{ color: theme.warningText }}>{saveNameError}</View>- )}- </>- );- } else {- if (isNameEditable) {- return (+ return (+ <View style={{ flexShrink: 0, alignItems: 'center' }}>+ {editingName ? (+ <>+ <InitialFocus>+ <Input+ defaultValue={accountName}+ onEnter={handleSave}+ onUpdate={handleSave}+ onEscape={() => setEditingName(false)}+ style={{+ fontSize: 25,+ fontWeight: 500,+ marginTop: -3,+ marginBottom: -4,+ marginLeft: -6,+ paddingTop: 2,+ paddingBottom: 2,+ width: Math.max(20, accountName.length) + 'ch',+ }}+ />+ </InitialFocus>+ {saveNameError && (+ <View style={{ color: theme.warningText }}>{saveNameError}</View>+ )}+ </>+ ) : (<Viewstyle={{flexDirection: 'row',alignItems: 'center',+ whiteSpace: 'nowrap',gap: 3,'& .hover-visible': {opacity: 0,@@ -672,46 +734,40 @@ function AccountNameField({: accountName}</View>- {account && (- <NotesButton- id={`account-${account.id}`}- defaultColor={theme.pageTextSubdued}- />- )}- <Button- variant="bare"- aria-label={t('Edit account name')}- className="hover-visible"- onPress={() => setEditingName(true)}- >- <SvgPencil1- style={{- width: 11,- height: 11,- color: theme.pageTextSubdued,- }}- />- </Button>- </View>- );- } else {- return (- <View- style={{ fontSize: 25, fontWeight: 500, marginBottom: -1 }}- data-testid="account-name"- >- {account && account.closed- ? t('Closed: {{ accountName }}', { accountName })- : accountName}+ <View style={{ flexDirection: 'row', width: 50 }}>+ {isNameEditable && account && (+ <NotesButton+ id={`account-${account.id}`}+ defaultColor={theme.pageTextSubdued}+ />+ )}+ {isNameEditable && (+ <Button+ variant="bare"+ aria-label={t('Edit account name')}+ className="hover-visible"+ onPress={() => setEditingName(true)}+ >+ <SvgPencil1+ style={{+ width: 11,+ height: 11,+ color: theme.pageTextSubdued,+ }}+ />+ </Button>+ )}+ </View></View>- );- }- }+ )}+ </View>+ );}type AccountMenuProps = {account: AccountEntity;canSync: boolean;+ showNetWorthChart: boolean;showBalances: boolean;canShowBalances: boolean;showCleared: boolean;@@ -727,13 +783,15 @@ type AccountMenuProps = {| 'toggle-balance'| 'remove-sorting'| 'toggle-cleared'- | 'toggle-reconciled',+ | 'toggle-reconciled'+ | 'toggle-net-worth-chart',) => void;};function AccountMenu({account,canSync,+ showNetWorthChart,showBalances,canShowBalances,showCleared,@@ -769,6 +827,12 @@ function AccountMenu({} as const,]: []),+ {+ name: 'toggle-net-worth-chart',+ text: showNetWorthChart+ ? t('Hide balance chart')+ : t('Show balance chart'),+ },{name: 'toggle-cleared',text: showCleareddiff --git a/packages/desktop-client/src/components/sidebar/Account.tsx b/packages/desktop-client/src/components/sidebar/Account.tsxindex d5a12b953e..d902287cfe 100644--- a/packages/desktop-client/src/components/sidebar/Account.tsx+++ b/packages/desktop-client/src/components/sidebar/Account.tsx@@ -23,12 +23,11 @@ import { css, cx } from '@emotion/css';import * as Platform from 'loot-core/shared/platform';import { type AccountEntity } from 'loot-core/types/models';-import { BalanceHistoryGraph } from './BalanceHistoryGraph';-import {reopenAccount,updateAccount,} from '@desktop-client/accounts/accountsSlice';+import { BalanceHistoryGraph } from '@desktop-client/components/accounts/BalanceHistoryGraph';import { Link } from '@desktop-client/components/common/Link';import { Notes } from '@desktop-client/components/Notes';import {@@ -334,7 +333,10 @@ export function Account<FieldName extends SheetFields<'account'>>({</Button></SpaceBetween>{showBalanceHistory === 'true' && account && (- <BalanceHistoryGraph accountId={account.id} />+ <BalanceHistoryGraph+ accountId={account.id}+ style={{ minWidth: 350, minHeight: 70 }}+ />)}{accountNote && (<Notesdiff --git a/packages/loot-core/src/types/prefs.ts b/packages/loot-core/src/types/prefs.tsindex 1adfa7558f..e00aa5347b 100644--- a/packages/loot-core/src/types/prefs.ts+++ b/packages/loot-core/src/types/prefs.ts@@ -19,6 +19,7 @@ export type SyncedPrefs = Partial<| 'currencySymbolPosition'| 'currencySpaceBetweenAmountAndSymbol'| 'defaultCurrencyCode'+ | `show-account-${string}-net-worth-chart`| `side-nav.show-balance-history-${string}`| `show-balances-${string}`| `show-extra-balances-${string}`diff --git a/upcoming-release-notes/5037.md b/upcoming-release-notes/5037.mdnew file mode 100644index 0000000000..7f581aade2--- /dev/null+++ b/upcoming-release-notes/5037.md@@ -0,0 +1,6 @@+---+category: Features+authors: [passabilities]+---++Adds net worth graph for each account page.