Skip to content

A local-first personal finance app

prevent the account balance graph from showing on small screen sizes (#5816)

Matt Fiddamane9f3925124fb
diff --git a/packages/desktop-client/src/components/accounts/Header.tsx b/packages/desktop-client/src/components/accounts/Header.tsx
index 4484f11d98..41eadac911 100644
--- a/packages/desktop-client/src/components/accounts/Header.tsx
+++ b/packages/desktop-client/src/components/accounts/Header.tsx
@@ -1,7 +1,6 @@
import React, {
type ComponentProps,
type ReactNode,
- useEffect,
useRef,
useState,
} from 'react';
@@ -204,7 +203,7 @@ export function AccountHeader({
const isUsingServer = syncServerStatus !== 'no-server';
const isServerOffline = syncServerStatus === 'offline';
const [_, setExpandSplitsPref] = useLocalPref('expand-splits');
- const [showNetWorthChartPref, setShowNetWorthChartPref] = useSyncedPref(
+ const [showNetWorthChartPref, _setShowNetWorthChartPref] = useSyncedPref(
`show-account-${accountId}-net-worth-chart`,
);
const showNetWorthChart = showNetWorthChartPref === 'true';
@@ -233,30 +232,6 @@ 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',
diff --git a/upcoming-release-notes/5816.md b/upcoming-release-notes/5816.md
new file mode 100644
index 0000000000..8c37c82abd
--- /dev/null
+++ b/upcoming-release-notes/5816.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [matt-fidd]
+---
+
+Prevent the account balance graph from showing on small screen sizes