From ad4fe217f163ea5f841ebb0dec9c50d8076cedaf Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 20 Jan 2024 10:20:23 +0000 Subject: [PATCH 1/3] :fire: removing unused variables (batch 2) --- .eslintrc.js | 1 - .../src/browser-preload.browser.js | 10 +-- .../src/components/FatalError.tsx | 2 +- .../src/components/FixedSizeList.tsx | 67 +++++++------------ .../src/components/ManageRules.tsx | 2 +- .../src/components/accounts/Account.jsx | 4 +- .../src/components/accounts/MobileAccount.jsx | 2 +- .../src/components/budget/MobileBudget.tsx | 9 +-- .../components/budget/MobileBudgetTable.jsx | 10 +-- .../src/components/budget/SidebarCategory.tsx | 2 +- .../src/components/budget/SidebarGroup.tsx | 6 +- .../src/components/budget/index.tsx | 2 +- .../budget/report/BalanceTooltip.tsx | 2 +- .../budget/rollover/CoverTooltip.tsx | 2 +- .../budget/rollover/TransferTooltip.tsx | 2 +- .../rollover/budgetsummary/BudgetSummary.tsx | 2 +- .../src/components/common/Menu.tsx | 2 +- .../components/modals/CategoryGroupMenu.tsx | 2 +- .../src/components/modals/CategoryMenu.tsx | 2 +- .../src/components/modals/EditRule.jsx | 4 +- .../src/components/modals/Notes.tsx | 2 +- .../src/components/modals/SingleInput.tsx | 2 +- .../payees/ManagePayeesWithData.jsx | 4 +- .../src/components/reports/ChooseGraph.tsx | 7 -- .../src/components/reports/Header.jsx | 1 - .../components/reports/graphs/AreaGraph.tsx | 2 +- .../components/reports/graphs/BarGraph.tsx | 2 +- .../reports/graphs/BarLineGraph.tsx | 5 +- .../components/reports/graphs/DonutGraph.tsx | 2 +- .../components/reports/graphs/LineGraph.tsx | 5 +- .../reports/graphs/NetWorthGraph.tsx | 9 +-- .../components/reports/graphs/SankeyGraph.tsx | 2 +- .../reports/graphs/StackedBarGraph.tsx | 2 +- .../reports/graphs/tableGraph/ReportTable.tsx | 3 - .../graphs/tableGraph/ReportTableHeader.tsx | 4 -- .../graphs/tableGraph/ReportTableList.tsx | 2 - .../graphs/tableGraph/ReportTableTotals.tsx | 4 -- .../components/reports/reports/CashFlow.tsx | 1 - .../spreadsheets/cash-flow-spreadsheet.tsx | 6 +- 39 files changed, 67 insertions(+), 133 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d757f5187a8..44dc06216df 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -57,7 +57,6 @@ module.exports = { '@typescript-eslint/no-unused-vars': [ 'warn', { - args: 'none', varsIgnorePattern: '^_', ignoreRestSiblings: true, }, diff --git a/packages/desktop-client/src/browser-preload.browser.js b/packages/desktop-client/src/browser-preload.browser.js index 37bd1f53719..ca5bc118d90 100644 --- a/packages/desktop-client/src/browser-preload.browser.js +++ b/packages/desktop-client/src/browser-preload.browser.js @@ -51,7 +51,7 @@ global.Actual = { window.location.reload(); }, - openFileDialog: async ({ filters = [], properties }) => { + openFileDialog: async ({ filters = [] }) => { return new Promise(resolve => { let createdElement = false; // Attempt to reuse an already-created file input. @@ -91,7 +91,7 @@ global.Actual = { .uploadFile(filename, ev.target.result) .then(() => resolve([filepath])); }; - reader.onerror = function (ev) { + reader.onerror = function () { alert('Error reading file'); }; } @@ -107,7 +107,7 @@ global.Actual = { }); }, - saveFile: (contents, defaultFilename, dialogTitle) => { + saveFile: (contents, defaultFilename) => { const temp = document.createElement('a'); temp.style = 'display: none'; temp.download = defaultFilename; @@ -121,9 +121,9 @@ global.Actual = { openURLInBrowser: url => { window.open(url, '_blank'); }, - onEventFromMain: (type, handler) => {}, + onEventFromMain: () => {}, applyAppUpdate: () => {}, - updateAppMenu: isBudgetOpen => {}, + updateAppMenu: () => {}, ipcConnect: () => {}, getServerSocket: async () => { diff --git a/packages/desktop-client/src/components/FatalError.tsx b/packages/desktop-client/src/components/FatalError.tsx index f15b6852610..ebed6c72ee6 100644 --- a/packages/desktop-client/src/components/FatalError.tsx +++ b/packages/desktop-client/src/components/FatalError.tsx @@ -131,7 +131,7 @@ function SharedArrayBufferOverride() { > setUnderstand(!understand)} + onChange={() => setUnderstand(!understand)} />{' '} I understand the risks, run Actual in the unsupported fallback mode diff --git a/packages/desktop-client/src/components/FixedSizeList.tsx b/packages/desktop-client/src/components/FixedSizeList.tsx index 2e74b00d5f8..b2257a0a099 100644 --- a/packages/desktop-client/src/components/FixedSizeList.tsx +++ b/packages/desktop-client/src/components/FixedSizeList.tsx @@ -2,7 +2,6 @@ import { createRef, PureComponent, - type ReactElement, type ReactNode, type Ref, type MutableRefObject, @@ -11,7 +10,6 @@ import { import memoizeOne from 'memoize-one'; -import { useResizeObserver } from '../hooks/useResizeObserver'; import { type CSSProperties } from '../style'; import { View } from './common/View'; @@ -20,16 +18,6 @@ const IS_SCROLLING_DEBOUNCE_INTERVAL = 150; const defaultItemKey: FixedSizeListProps['itemKey'] = (index: number) => index; -type ResizeObserverProps = { - onResize: Parameters[0]; - children: (ref: Ref) => ReactElement; -}; - -function ResizeObserver({ onResize, children }: ResizeObserverProps) { - const ref = useResizeObserver(onResize); - return children(ref); -} - type FixedSizeListProps = { className?: string; direction?: 'rtl' | 'ltr'; @@ -262,33 +250,29 @@ export class FixedSizeList extends PureComponent< const estimatedTotalSize = this.getEstimatedTotalSize(); return ( - - {headerRef => ( -
- {header} -
- {items} -
-
- )} -
+
+ {header} +
+ {items} +
+
); } @@ -305,10 +289,6 @@ export class FixedSizeList extends PureComponent< } }; - onHeaderResize = (rect: { height: number }) => { - // this.setState({ headerHeight: rect.height }); - }; - anchor() { const itemKey = this.props.itemKey || defaultItemKey; @@ -499,6 +479,7 @@ export class FixedSizeList extends PureComponent< return style; }; + // eslint-disable-next-line @typescript-eslint/no-unused-vars _getItemStyleCache = memoizeOne((_, __, ___) => ({})); _getRangeToRender() { diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx index 6e82621f92f..0bcbfe254b4 100644 --- a/packages/desktop-client/src/components/ManageRules.tsx +++ b/packages/desktop-client/src/components/ManageRules.tsx @@ -230,7 +230,7 @@ function ManageRulesContent({ dispatch( pushModal('edit-rule', { rule, - onSave: async newRule => { + onSave: async () => { await loadRules(); setLoading(false); }, diff --git a/packages/desktop-client/src/components/accounts/Account.jsx b/packages/desktop-client/src/components/accounts/Account.jsx index e61c46c68ad..5f94f95ea70 100644 --- a/packages/desktop-client/src/components/accounts/Account.jsx +++ b/packages/desktop-client/src/components/accounts/Account.jsx @@ -228,7 +228,7 @@ class AccountInternal extends PureComponent { } }; - const onUndo = async ({ tables, messages, undoTag }) => { + const onUndo = async ({ tables, messages }) => { await maybeRefetch(tables); // If all the messages are dealing with transactions, find the @@ -517,7 +517,7 @@ class AccountInternal extends PureComponent { }); } }, - mappedData => { + () => { return data; }, ); diff --git a/packages/desktop-client/src/components/accounts/MobileAccount.jsx b/packages/desktop-client/src/components/accounts/MobileAccount.jsx index aaaed0db57e..b8d4bb6ce77 100644 --- a/packages/desktop-client/src/components/accounts/MobileAccount.jsx +++ b/packages/desktop-client/src/components/accounts/MobileAccount.jsx @@ -43,7 +43,7 @@ const getSchedulesTransform = memoizeOne((id, hasSearch) => { }; }); -function PreviewTransactions({ accountId, children }) { +function PreviewTransactions({ children }) { const scheduleData = useCachedSchedules(); if (scheduleData == null) { diff --git a/packages/desktop-client/src/components/budget/MobileBudget.tsx b/packages/desktop-client/src/components/budget/MobileBudget.tsx index 2a426909a4c..b1b59f76c8c 100644 --- a/packages/desktop-client/src/components/budget/MobileBudget.tsx +++ b/packages/desktop-client/src/components/budget/MobileBudget.tsx @@ -408,19 +408,15 @@ function BudgetInner(props: BudgetInnerProps) { await sync(); }} > - {({ refreshing, onRefresh }) => ( + {({ onRefresh }) => ( - // } editMode={editMode} onEditMode={flag => setEditMode(flag)} onShowBudgetSummary={onShowBudgetSummary} @@ -438,9 +434,6 @@ function BudgetInner(props: BudgetInnerProps) { onBudgetAction={applyBudgetAction} onRefresh={onRefresh} onSwitchBudgetType={onSwitchBudgetType} - onSaveNotes={onSaveNotes} - onEditGroupNotes={onEditGroupNotes} - onEditCategoryNotes={onEditCategoryNotes} savePrefs={savePrefs} pushModal={pushModal} onEditGroup={onEditGroup} diff --git a/packages/desktop-client/src/components/budget/MobileBudgetTable.jsx b/packages/desktop-client/src/components/budget/MobileBudgetTable.jsx index 3c2251d77b3..cb75b90eef9 100644 --- a/packages/desktop-client/src/components/budget/MobileBudgetTable.jsx +++ b/packages/desktop-client/src/components/budget/MobileBudgetTable.jsx @@ -145,7 +145,7 @@ function BudgetCell({ }); } - function onAmountClick(e) { + function onAmountClick() { onEdit?.(categoryId); } @@ -243,7 +243,6 @@ const ExpenseCategory = memo(function ExpenseCategory({ blank, style, month, - editMode, onEdit, isEditingBudget, onEditBudget, @@ -569,7 +568,6 @@ const IncomeGroupTotals = memo(function IncomeGroupTotals({ budgeted, balance, style, - editMode, onEdit, }) { const listItemRef = useRef(); @@ -657,7 +655,6 @@ const IncomeCategory = memo(function IncomeCategory({ balance, month, style, - editMode, onEdit, onBudgetAction, isEditingBudget, @@ -1122,7 +1119,6 @@ function BudgetGroups({ export function BudgetTable({ type, categoryGroups, - categories, month, monthBounds, editMode, @@ -1143,9 +1139,6 @@ export function BudgetTable({ onBudgetAction, onRefresh, onSwitchBudgetType, - onSaveNotes, - onEditGroupNotes, - onEditCategoryNotes, savePrefs, pushModal, onEditGroup, @@ -1154,7 +1147,6 @@ export function BudgetTable({ onEditCategoryBudget, openBalanceActionMenuId, onOpenBalanceActionMenu, - ...props }) { const { width } = useResponsive(); const show3Cols = width >= 360; diff --git a/packages/desktop-client/src/components/budget/SidebarCategory.tsx b/packages/desktop-client/src/components/budget/SidebarCategory.tsx index 04bd471d24b..8ca35fde6b9 100644 --- a/packages/desktop-client/src/components/budget/SidebarCategory.tsx +++ b/packages/desktop-client/src/components/budget/SidebarCategory.tsx @@ -154,7 +154,7 @@ export function SidebarCategory({ > displayed} + formatter={() => displayed} width="flex" exposed={editing || temporary} onUpdate={value => { diff --git a/packages/desktop-client/src/components/budget/SidebarGroup.tsx b/packages/desktop-client/src/components/budget/SidebarGroup.tsx index c298e3d28e3..bbdd36b3603 100644 --- a/packages/desktop-client/src/components/budget/SidebarGroup.tsx +++ b/packages/desktop-client/src/components/budget/SidebarGroup.tsx @@ -27,7 +27,6 @@ type SidebarGroupProps = { collapsed: boolean; dragPreview?: boolean; innerRef?: ConnectDragSource; - borderColor?: string; style?: CSSProperties; onEdit?: (id: string) => void; onSave?: (group: object) => Promise; @@ -44,7 +43,6 @@ export function SidebarGroup({ dragPreview, innerRef, style, - borderColor = theme.tableBorder, onEdit, onSave, onDelete, @@ -63,7 +61,7 @@ export function SidebarGroup({ userSelect: 'none', WebkitUserSelect: 'none', }} - onClick={e => { + onClick={() => { onToggleCollapse(group.id); }} > @@ -181,7 +179,7 @@ export function SidebarGroup({ > displayed} + formatter={() => displayed} width="flex" exposed={editing} onUpdate={value => { diff --git a/packages/desktop-client/src/components/budget/index.tsx b/packages/desktop-client/src/components/budget/index.tsx index 884567a27b5..3363140e6f7 100644 --- a/packages/desktop-client/src/components/budget/index.tsx +++ b/packages/desktop-client/src/components/budget/index.tsx @@ -533,7 +533,7 @@ const RolloverBudgetSummary = memo<{ month: string }>(props => { ); }); -export function Budget(props) { +export function Budget() { const startMonth = useSelector( state => state.prefs.local['budget.startMonth'], ); diff --git a/packages/desktop-client/src/components/budget/report/BalanceTooltip.tsx b/packages/desktop-client/src/components/budget/report/BalanceTooltip.tsx index 76eddb31928..bf806d12b90 100644 --- a/packages/desktop-client/src/components/budget/report/BalanceTooltip.tsx +++ b/packages/desktop-client/src/components/budget/report/BalanceTooltip.tsx @@ -38,7 +38,7 @@ export function BalanceTooltip({ {...tooltipProps} > { + onMenuSelect={() => { onBudgetAction(monthIndex, 'carryover', { category: categoryId, flag: !carryover, diff --git a/packages/desktop-client/src/components/budget/rollover/CoverTooltip.tsx b/packages/desktop-client/src/components/budget/rollover/CoverTooltip.tsx index bd822c9cb96..2f33e371f7d 100644 --- a/packages/desktop-client/src/components/budget/rollover/CoverTooltip.tsx +++ b/packages/desktop-client/src/components/budget/rollover/CoverTooltip.tsx @@ -48,7 +48,7 @@ export function CoverTooltip({ categoryGroups={categoryGroups} value={null} openOnFocus={true} - onUpdate={id => {}} + onUpdate={() => {}} onSelect={id => setCategory(id)} inputProps={{ inputRef: node, diff --git a/packages/desktop-client/src/components/budget/rollover/TransferTooltip.tsx b/packages/desktop-client/src/components/budget/rollover/TransferTooltip.tsx index 8671a1261c7..0d27946f138 100644 --- a/packages/desktop-client/src/components/budget/rollover/TransferTooltip.tsx +++ b/packages/desktop-client/src/components/budget/rollover/TransferTooltip.tsx @@ -98,7 +98,7 @@ export function TransferTooltip({ categoryGroups={categoryGroups} value={null} openOnFocus={true} - onUpdate={id => {}} + onUpdate={() => {}} onSelect={id => setCategory(id)} inputProps={{ onEnter: submit, placeholder: '(none)' }} /> diff --git a/packages/desktop-client/src/components/budget/rollover/budgetsummary/BudgetSummary.tsx b/packages/desktop-client/src/components/budget/rollover/budgetsummary/BudgetSummary.tsx index dc66bed7a9f..209ab5e31be 100644 --- a/packages/desktop-client/src/components/budget/rollover/budgetsummary/BudgetSummary.tsx +++ b/packages/desktop-client/src/components/budget/rollover/budgetsummary/BudgetSummary.tsx @@ -35,7 +35,7 @@ export function BudgetSummary({ } = useRollover(); const [menuOpen, setMenuOpen] = useState(false); - function onMenuOpen(e) { + function onMenuOpen() { setMenuOpen(true); } diff --git a/packages/desktop-client/src/components/common/Menu.tsx b/packages/desktop-client/src/components/common/Menu.tsx index dc67988c626..27c428aa339 100644 --- a/packages/desktop-client/src/components/common/Menu.tsx +++ b/packages/desktop-client/src/components/common/Menu.tsx @@ -163,7 +163,7 @@ export function Menu({ }} onMouseEnter={() => setHoveredIndex(idx)} onMouseLeave={() => setHoveredIndex(null)} - onClick={e => + onClick={() => !item.disabled && onMenuSelect && onMenuSelect(item.name) } > diff --git a/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx b/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx index bd8d3e5d112..6a1368b5a4b 100644 --- a/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx +++ b/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx @@ -137,7 +137,7 @@ export function CategoryGroupMenu({ notes={notes?.length > 0 ? notes : 'No notes'} editable={false} focused={false} - getStyle={editable => ({ + getStyle={() => ({ ...styles.mediumText, borderRadius: 6, ...((!notes || notes.length === 0) && { diff --git a/packages/desktop-client/src/components/modals/CategoryMenu.tsx b/packages/desktop-client/src/components/modals/CategoryMenu.tsx index f42bb96904b..2e2b79181f3 100644 --- a/packages/desktop-client/src/components/modals/CategoryMenu.tsx +++ b/packages/desktop-client/src/components/modals/CategoryMenu.tsx @@ -128,7 +128,7 @@ export function CategoryMenu({ notes={originalNotes?.length > 0 ? originalNotes : 'No notes'} editable={false} focused={false} - getStyle={editable => ({ + getStyle={() => ({ borderRadius: 6, ...((!originalNotes || originalNotes.length === 0) && { justifySelf: 'center', diff --git a/packages/desktop-client/src/components/modals/EditRule.jsx b/packages/desktop-client/src/components/modals/EditRule.jsx index 661cc799e8c..4d42814e53d 100644 --- a/packages/desktop-client/src/components/modals/EditRule.jsx +++ b/packages/desktop-client/src/components/modals/EditRule.jsx @@ -122,7 +122,7 @@ export function OpSelect({ ); } -function EditorButtons({ onAdd, onDelete, style }) { +function EditorButtons({ onAdd, onDelete }) { return ( <> {onDelete && ( @@ -310,7 +310,7 @@ const actionFields = [ 'date', 'amount', ].map(field => [field, mapField(field)]); -function ActionEditor({ ops, action, editorStyle, onChange, onDelete, onAdd }) { +function ActionEditor({ action, editorStyle, onChange, onDelete, onAdd }) { const { field, op, value, type, error, inputKey = 'initial' } = action; return ( diff --git a/packages/desktop-client/src/components/modals/Notes.tsx b/packages/desktop-client/src/components/modals/Notes.tsx index e36f2315217..76516325466 100644 --- a/packages/desktop-client/src/components/modals/Notes.tsx +++ b/packages/desktop-client/src/components/modals/Notes.tsx @@ -63,7 +63,7 @@ export function Notes({ modalProps, id, name, onSave }: NotesProps) { notes={notes} editable={true} focused={true} - getStyle={editable => ({ + getStyle={() => ({ borderRadius: 6, flex: 1, minWidth: 0, diff --git a/packages/desktop-client/src/components/modals/SingleInput.tsx b/packages/desktop-client/src/components/modals/SingleInput.tsx index 8c4daef9451..89f4b334799 100644 --- a/packages/desktop-client/src/components/modals/SingleInput.tsx +++ b/packages/desktop-client/src/components/modals/SingleInput.tsx @@ -81,7 +81,7 @@ export function SingleInput({ ...styles.mediumText, flexBasis: '50%', }} - onPointerUp={e => _onSubmit(value)} + onPointerUp={() => _onSubmit(value)} > {buttonText} diff --git a/packages/desktop-client/src/components/payees/ManagePayeesWithData.jsx b/packages/desktop-client/src/components/payees/ManagePayeesWithData.jsx index 338adbb08cd..a828c5e73f2 100644 --- a/packages/desktop-client/src/components/payees/ManagePayeesWithData.jsx +++ b/packages/desktop-client/src/components/payees/ManagePayeesWithData.jsx @@ -63,7 +63,7 @@ export function ManagePayeesWithData({ initialSelectedIds }) { }; }, []); - async function onUndo({ tables, messages, meta, url }, scroll = false) { + async function onUndo({ tables, messages, meta }) { if (!tables.includes('payees') && !tables.includes('payee_mapping')) { return; } @@ -83,7 +83,7 @@ export function ManagePayeesWithData({ initialSelectedIds }) { useEffect(() => { if (lastUndoState.current) { - onUndo(lastUndoState.current, true); + onUndo(lastUndoState.current); } return listen('undo-event', onUndo); diff --git a/packages/desktop-client/src/components/reports/ChooseGraph.tsx b/packages/desktop-client/src/components/reports/ChooseGraph.tsx index a4e0b5b21bf..d7b60ef04a3 100644 --- a/packages/desktop-client/src/components/reports/ChooseGraph.tsx +++ b/packages/desktop-client/src/components/reports/ChooseGraph.tsx @@ -26,7 +26,6 @@ type ChooseGraphProps = { graphType: string; balanceType: string; groupBy: string; - scrollWidth?: number; setScrollWidth?: (value: number) => void; months?: Month[]; viewLabels?: boolean; @@ -40,7 +39,6 @@ export function ChooseGraph({ graphType, balanceType, groupBy, - scrollWidth, setScrollWidth, months, viewLabels, @@ -139,10 +137,8 @@ export function ChooseGraph({ headerScrollRef={headerScrollRef} handleScroll={handleScroll} interval={mode === 'time' && data.monthData} - scrollWidth={scrollWidth} groupBy={groupBy} balanceType={balanceType} - compact={compact} /> ); diff --git a/packages/desktop-client/src/components/reports/Header.jsx b/packages/desktop-client/src/components/reports/Header.jsx index 34188780b6a..e3231f8d696 100644 --- a/packages/desktop-client/src/components/reports/Header.jsx +++ b/packages/desktop-client/src/components/reports/Header.jsx @@ -75,7 +75,6 @@ export function Header({ onDeleteFilter, onCondOpChange, headerPrefixItems, - selectGraph, }) { const location = useLocation(); const path = location.pathname; diff --git a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx index 26faf6cd888..28b47e3527e 100644 --- a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx @@ -173,7 +173,7 @@ export function AreaGraph({ ...(compact && { height: 'auto' }), }} > - {(width, height, portalHost) => + {(width, height) => data.monthData && (
diff --git a/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx b/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx index e17171b5635..7f4f9ec3bdd 100644 --- a/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx @@ -167,7 +167,7 @@ export function BarGraph({ ...(compact && { height: 'auto' }), }} > - {(width, height, portalHost) => + {(width, height) => data[splitData] && (
diff --git a/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx b/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx index fe659df811b..26e823288fb 100644 --- a/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx @@ -33,10 +33,9 @@ type PayloadItem = { type CustomTooltipProps = { active?: boolean; payload?: PayloadItem[]; - label?: string; }; -const CustomTooltip = ({ active, payload, label }: CustomTooltipProps) => { +const CustomTooltip = ({ active, payload }: CustomTooltipProps) => { if (active && payload && payload.length) { return (
- {(width, height, portalHost) => + {(width, height) => graphData && (
diff --git a/packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx b/packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx index 6a69bb2ec9b..6fb3ebc03f2 100644 --- a/packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/DonutGraph.tsx @@ -157,7 +157,7 @@ export function DonutGraph({ ...(compact && { height: 'auto' }), }} > - {(width, height, portalHost) => + {(width, height) => data[splitData] && (
diff --git a/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx b/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx index 4cba1f3e744..81952843991 100644 --- a/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx @@ -32,10 +32,9 @@ type PayloadItem = { type CustomTooltipProps = { active?: boolean; payload?: PayloadItem[]; - label?: string; }; -const CustomTooltip = ({ active, payload, label }: CustomTooltipProps) => { +const CustomTooltip = ({ active, payload }: CustomTooltipProps) => { if (active && payload && payload.length) { return (
- {(width, height, portalHost) => + {(width, height) => graphData && (
diff --git a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx index 9e9eb3fadd8..f3974f7e4ec 100644 --- a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.tsx @@ -22,16 +22,12 @@ type NetWorthGraphProps = { style?: CSSProperties; graphData; compact: boolean; - domain?: { - y?: [number, number]; - }; }; export function NetWorthGraph({ style, graphData, compact, - domain, }: NetWorthGraphProps) { const tickFormatter = tick => { return `${Math.round(tick).toLocaleString()}`; // Formats the tick values as strings with commas @@ -66,11 +62,10 @@ export function NetWorthGraph({ type CustomTooltipProps = { active?: boolean; payload?: PayloadItem[]; - label?: string; }; // eslint-disable-next-line react/no-unstable-nested-components - const CustomTooltip = ({ active, payload, label }: CustomTooltipProps) => { + const CustomTooltip = ({ active, payload }: CustomTooltipProps) => { if (active && payload && payload.length) { return (
- {(width, height, portalHost) => + {(width, height) => graphData && (
diff --git a/packages/desktop-client/src/components/reports/graphs/SankeyGraph.tsx b/packages/desktop-client/src/components/reports/graphs/SankeyGraph.tsx index d079a1a40e4..5f97bfcba80 100644 --- a/packages/desktop-client/src/components/reports/graphs/SankeyGraph.tsx +++ b/packages/desktop-client/src/components/reports/graphs/SankeyGraph.tsx @@ -114,7 +114,7 @@ export function SankeyGraph({ style, data, compact }: SankeyProps) { ...(compact && { height: 'auto' }), }} > - {(width, height, portalHost) => ( + {width => ( - {(width, height, portalHost) => + {(width, height) => data.monthData && (
diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx index 4d380951f1d..1669bb50bb6 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx @@ -26,7 +26,6 @@ type ReportTableProps = { data: DataEntity[]; mode: string; monthsCount: number; - compact: boolean; }; export function ReportTable({ @@ -39,7 +38,6 @@ export function ReportTable({ data, mode, monthsCount, - compact, }: ReportTableProps) { const contentRef = useRef(null); @@ -96,7 +94,6 @@ export function ReportTable({ mode={mode} groupBy={groupBy} renderItem={renderItem} - compact={compact} /> diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx index 7db0209fde0..35e29ff2dc6 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx @@ -9,23 +9,19 @@ import { View } from '../../../common/View'; import { Row, Cell } from '../../../table'; type ReportTableHeaderProps = { - scrollWidth?: number; groupBy: string; interval?: DataEntity[]; balanceType: string; headerScrollRef: RefProp; handleScroll: UIEventHandler; - compact: boolean; }; export function ReportTableHeader({ - scrollWidth, groupBy, interval, balanceType, headerScrollRef, handleScroll, - compact, }: ReportTableHeaderProps) { return ( ; handleScroll: UIEventHandler; - compact: boolean; }; export function ReportTableTotals({ data, - scrollWidth, balanceTypeOp, mode, monthsCount, totalScrollRef, handleScroll, - compact, }: ReportTableTotalsProps) { const [scrollWidthTotals, setScrollWidthTotals] = useState(0); diff --git a/packages/desktop-client/src/components/reports/reports/CashFlow.tsx b/packages/desktop-client/src/components/reports/reports/CashFlow.tsx index e1ad6356cb4..70f195efdab 100644 --- a/packages/desktop-client/src/components/reports/reports/CashFlow.tsx +++ b/packages/desktop-client/src/components/reports/reports/CashFlow.tsx @@ -110,7 +110,6 @@ export function CashFlow(): JSX.Element { conditionsOp={conditionsOp} onCondOpChange={onCondOpChange} headerPrefixItems={undefined} - selectGraph={undefined} /> 0').filter({ amount: { $gt: 0 } }), - makeQuery('amount < 0').filter({ amount: { $lt: 0 } }), + makeQuery().filter({ amount: { $gt: 0 } }), + makeQuery().filter({ amount: { $lt: 0 } }), ], data => { setData(recalculate(data, start, end, isConcise)); From 06a5dd67d290868f20525ecfe0476f6faa6f754f Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 20 Jan 2024 10:22:06 +0000 Subject: [PATCH 2/3] Release notes --- upcoming-release-notes/2256.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 upcoming-release-notes/2256.md diff --git a/upcoming-release-notes/2256.md b/upcoming-release-notes/2256.md new file mode 100644 index 00000000000..02d56a0c79f --- /dev/null +++ b/upcoming-release-notes/2256.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +Code clean-up: removing unused variables (pt.2) From c6727b15fcd64863e927045dee2d03aa27e10e3d Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 20 Jan 2024 21:49:06 +0000 Subject: [PATCH 3/3] Add back compact props --- packages/desktop-client/src/components/reports/ChooseGraph.tsx | 3 +++ .../src/components/reports/graphs/tableGraph/ReportTable.tsx | 3 +++ .../components/reports/graphs/tableGraph/ReportTableHeader.tsx | 2 ++ .../components/reports/graphs/tableGraph/ReportTableList.tsx | 2 ++ .../components/reports/graphs/tableGraph/ReportTableTotals.tsx | 2 ++ 5 files changed, 12 insertions(+) diff --git a/packages/desktop-client/src/components/reports/ChooseGraph.tsx b/packages/desktop-client/src/components/reports/ChooseGraph.tsx index d7b60ef04a3..a3149c39119 100644 --- a/packages/desktop-client/src/components/reports/ChooseGraph.tsx +++ b/packages/desktop-client/src/components/reports/ChooseGraph.tsx @@ -139,6 +139,7 @@ export function ChooseGraph({ interval={mode === 'time' && data.monthData} groupBy={groupBy} balanceType={balanceType} + compact={compact} /> ); diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx index 6813042b265..9aa4e7a923c 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx @@ -26,6 +26,7 @@ type ReportTableProps = { data: DataEntity[]; mode: string; monthsCount: number; + compact: boolean; }; export function ReportTable({ @@ -38,6 +39,7 @@ export function ReportTable({ data, mode, monthsCount, + compact, }: ReportTableProps) { const contentRef = useRef(null); @@ -95,6 +97,7 @@ export function ReportTable({ mode={mode} groupBy={groupBy} renderItem={renderItem} + compact={compact} /> diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx index 50778bac6de..4bb20248c32 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx @@ -14,6 +14,7 @@ type ReportTableHeaderProps = { balanceType: string; headerScrollRef: RefProp; handleScroll: UIEventHandler; + compact: boolean; }; export function ReportTableHeader({ @@ -22,6 +23,7 @@ export function ReportTableHeader({ balanceType, headerScrollRef, handleScroll, + compact, }: ReportTableHeaderProps) { return ( ; handleScroll: UIEventHandler; + compact: boolean; }; export function ReportTableTotals({ @@ -29,6 +30,7 @@ export function ReportTableTotals({ monthsCount, totalScrollRef, handleScroll, + compact, }: ReportTableTotalsProps) { const [scrollWidthTotals, setScrollWidthTotals] = useState(0);