Skip to content

A local-first personal finance app

Allow categories to be added via a plus button in the group header (#6110)

Nik36f6a080a6c1
diff --git a/packages/component-library/src/Tooltip.tsx b/packages/component-library/src/Tooltip.tsx
index 99dfd6180f..3e2a3cca3f 100644
--- a/packages/component-library/src/Tooltip.tsx
+++ b/packages/component-library/src/Tooltip.tsx
@@ -15,12 +15,14 @@ type TooltipProps = Partial<ComponentProps<typeof AriaTooltip>> & {
children: ReactNode;
content: ReactNode;
triggerProps?: Partial<ComponentProps<typeof TooltipTrigger>>;
+ disablePointerEvents?: boolean;
};
export const Tooltip = ({
children,
content,
triggerProps = {},
+ disablePointerEvents = false,
...props
}: TooltipProps) => {
const triggerRef = useRef(null);
@@ -69,7 +71,14 @@ export const Tooltip = ({
>
{children}
- <AriaTooltip triggerRef={triggerRef} style={styles.tooltip} {...props}>
+ <AriaTooltip
+ triggerRef={triggerRef}
+ style={{
+ ...styles.tooltip,
+ ...(disablePointerEvents && { pointerEvents: 'none' }),
+ }}
+ {...props}
+ >
{content}
</AriaTooltip>
</TooltipTrigger>
diff --git a/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png b/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png
index 121bd40315..07710e72bc 100644
Binary files a/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png b/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png
index d488bda95b..7249dd457a 100644
Binary files a/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png b/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png
index 181484e4cd..cfb996ce99 100644
Binary files a/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.ts-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png differ
diff --git a/packages/desktop-client/src/components/NotesButton.tsx b/packages/desktop-client/src/components/NotesButton.tsx
index 3aaf11b26e..6fc93ca3bb 100644
--- a/packages/desktop-client/src/components/NotesButton.tsx
+++ b/packages/desktop-client/src/components/NotesButton.tsx
@@ -80,6 +80,7 @@ export function NotesButton({
css({
color: defaultColor,
...style,
+ padding: 4,
...(showPlaceholder && {
opacity: hasNotes || isOpen ? 1 : 0.3,
}),
diff --git a/packages/desktop-client/src/components/budget/SidebarGroup.tsx b/packages/desktop-client/src/components/budget/SidebarGroup.tsx
index 72ec2fc0cf..237ce0efd4 100644
--- a/packages/desktop-client/src/components/budget/SidebarGroup.tsx
+++ b/packages/desktop-client/src/components/budget/SidebarGroup.tsx
@@ -3,13 +3,15 @@ import React, { type CSSProperties, type RefCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
-import { SvgExpandArrow } from '@actual-app/components/icons/v0';
+import { SvgAdd, SvgExpandArrow } from '@actual-app/components/icons/v0';
import { SvgCheveronDown } from '@actual-app/components/icons/v1';
import { Menu } from '@actual-app/components/menu';
import { Popover } from '@actual-app/components/popover';
import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
+import { Tooltip } from '@actual-app/components/tooltip';
import { View } from '@actual-app/components/view';
+import { css, cx } from '@emotion/css';
import {
type CategoryEntity,
@@ -132,8 +134,6 @@ export function SidebarGroup({
onMenuSelect={type => {
if (type === 'rename') {
onEdit(group.id);
- } else if (type === 'add-category') {
- onShowNewCategory(group.id);
} else if (type === 'delete') {
onDelete(group.id);
} else if (type === 'toggle-visibility') {
@@ -146,7 +146,6 @@ export function SidebarGroup({
setMenuOpen(false);
}}
items={[
- { name: 'add-category', text: t('Add category') },
{ name: 'rename', text: t('Rename') },
!group.is_income && {
name: 'toggle-visibility',
@@ -166,7 +165,31 @@ export function SidebarGroup({
</Popover>
</View>
<View style={{ flex: 1 }} />
- <View style={{ flexShrink: 0 }}>
+ <View
+ style={{
+ flexShrink: 0,
+ flexDirection: 'row',
+ alignItems: 'center',
+ }}
+ >
+ <Tooltip content={t('Add category')} disablePointerEvents>
+ <Button
+ variant="bare"
+ aria-label={t('Add category')}
+ className={cx(
+ css({
+ color: theme.pageTextLight,
+ }),
+ 'hover-visible',
+ )}
+ onPress={() => {
+ onShowNewCategory?.(group.id);
+ }}
+ >
+ <SvgAdd style={{ width: 10, height: 10, flexShrink: 0 }} />
+ </Button>
+ </Tooltip>
+
<NotesButton
id={group.id}
style={dragPreview && { color: 'currentColor' }}
diff --git a/upcoming-release-notes/6110.md b/upcoming-release-notes/6110.md
new file mode 100644
index 0000000000..cc11dbfb6a
--- /dev/null
+++ b/upcoming-release-notes/6110.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [NikxDa]
+---
+
+Allow categories to be added via a plus button in the group header