From f0e6e394e36359fe75be17caee59fb54f8dea602 Mon Sep 17 00:00:00 2001 From: Mike Clark Date: Wed, 8 Nov 2023 22:17:42 +0000 Subject: [PATCH] sidebarcategory to typescript --- .../src/components/budget/ExpenseGroup.js | 1 - ...SidebarCategory.js => SidebarCategory.tsx} | 25 ++++++++++++++++--- upcoming-release-notes/1879.md | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) rename packages/desktop-client/src/components/budget/{SidebarCategory.js => SidebarCategory.tsx} (87%) diff --git a/packages/desktop-client/src/components/budget/ExpenseGroup.js b/packages/desktop-client/src/components/budget/ExpenseGroup.js index 14c7322091a..87d146a59cd 100644 --- a/packages/desktop-client/src/components/budget/ExpenseGroup.js +++ b/packages/desktop-client/src/components/budget/ExpenseGroup.js @@ -13,7 +13,6 @@ function ExpenseGroup({ collapsed, editingCell, dragState, - itemPos, MonthComponent, onEditName, onSave, diff --git a/packages/desktop-client/src/components/budget/SidebarCategory.js b/packages/desktop-client/src/components/budget/SidebarCategory.tsx similarity index 87% rename from packages/desktop-client/src/components/budget/SidebarCategory.js rename to packages/desktop-client/src/components/budget/SidebarCategory.tsx index 01e5d70cd48..cafb97c6ecc 100644 --- a/packages/desktop-client/src/components/budget/SidebarCategory.js +++ b/packages/desktop-client/src/components/budget/SidebarCategory.tsx @@ -1,4 +1,6 @@ -import React, { useState } from 'react'; +import React, { type CSSProperties, type Ref, useState } from 'react'; + +import { type CategoryEntity } from 'loot-core/src/types/models'; import CheveronDown from '../../icons/v1/CheveronDown'; import { theme } from '../../style'; @@ -6,9 +8,26 @@ import Button from '../common/Button'; import Menu from '../common/Menu'; import View from '../common/View'; import NotesButton from '../NotesButton'; +import { type OnDragChangeCallback } from '../sort'; import { InputCell } from '../table'; import { Tooltip } from '../tooltips'; +type SidebarCategoryProps = { + innerRef: Ref; + category: CategoryEntity; + dragPreview?: boolean; + dragging?: boolean; + editing: boolean; + style: CSSProperties; + borderColor: string; + isLast?: boolean; + onDragChange?: OnDragChangeCallback; + onEditName: (id: string) => void; + onSave: (group) => void; + onDelete: (id: string) => Promise; + onHideNewCategory: () => void; +}; + function SidebarCategory({ innerRef, category, @@ -16,15 +35,13 @@ function SidebarCategory({ dragging, editing, style, - borderColor = theme.tableBorder, isLast, onDragChange, - onEditMonth, onEditName, onSave, onDelete, onHideNewCategory, -}) { +}: SidebarCategoryProps) { const temporary = category.id === 'new'; const [menuOpen, setMenuOpen] = useState(false); diff --git a/upcoming-release-notes/1879.md b/upcoming-release-notes/1879.md index 0fa06b0f1c7..2d93e1f5b98 100644 --- a/upcoming-release-notes/1879.md +++ b/upcoming-release-notes/1879.md @@ -3,4 +3,4 @@ category: Maintenance authors: [MikesGlitch] --- -Convert BudgetSummaries, MonthPicker components to Typescript. +Convert BudgetSummaries, MonthPicker, SidebarCategory components to Typescript.