Skip to content

Commit d0f369b

Browse files
committed
feat: colored negative account balances in sidebar
in the sidebar, color negative account balances in red
1 parent 0f8a1ae commit d0f369b

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

Diff for: packages/desktop-client/src/components/sidebar/Account.tsx

+25-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { type AccountEntity } from 'loot-core/types/models';
2424
import { useContextMenu } from '../../hooks/useContextMenu';
2525
import { useNotes } from '../../hooks/useNotes';
2626
import { useDispatch } from '../../redux';
27+
import { makeAmountFullStyle } from '../budget/util';
2728
import { Link } from '../common/Link';
2829
import { Notes } from '../Notes';
2930
import {
@@ -34,7 +35,7 @@ import {
3435
type OnDropCallback,
3536
} from '../sort';
3637
import { type SheetFields, type Binding } from '../spreadsheet';
37-
import { CellValue } from '../spreadsheet/CellValue';
38+
import { CellValue, CellValueText } from '../spreadsheet/CellValue';
3839

3940
export const accountNameStyle: CSSProperties = {
4041
marginTop: -2,
@@ -217,7 +218,29 @@ export function Account<FieldName extends SheetFields<'account'>>({
217218
name
218219
)
219220
}
220-
right={<CellValue binding={query} type="financial" />}
221+
right={
222+
<CellValue binding={query} type="financial">
223+
{props => {
224+
const value = props.value as number;
225+
226+
return (
227+
<CellValueText
228+
{...props}
229+
value={value}
230+
style={
231+
account
232+
? makeAmountFullStyle(value, {
233+
positiveColor: theme.sidebarItemText,
234+
negativeColor: theme.errorTextMenu,
235+
zeroColor: theme.sidebarItemText,
236+
})
237+
: null
238+
}
239+
/>
240+
);
241+
}}
242+
</CellValue>
243+
}
221244
/>
222245
</Link>
223246
{account && (

Diff for: upcoming-release-notes/4681.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: Features
3+
authors: [tostasmistas]
4+
---
5+
6+
Color negative account balances in the sidebar

0 commit comments

Comments
 (0)