Skip to content
Snippets Groups Projects
Unverified Commit d77b54f2 authored by Yusef Ouda's avatar Yusef Ouda Committed by GitHub
Browse files

reorders 'Rename' above 'Hide' in menu popovers, adds debounce to sidebar animation (#3001)

* reorders 'Rename' above 'Hide' in menu popovers

* release notes

* adds debounce to sidebar animation

* bump debounce time

* release notes

* release notes

* Update debounce import

* Update index.tsx

* Update index.tsx

* Update index.tsx

* Update index.tsx

* Update index.tsx

* Update index.tsx

* Update index.tsx

* Update index.tsx

* removes event listener on titlebar, changes margins
parent ff36d1ef
No related branches found
No related tags found
No related merge requests found
...@@ -416,11 +416,6 @@ export function Titlebar({ style }: TitlebarProps) { ...@@ -416,11 +416,6 @@ export function Titlebar({ style }: TitlebarProps) {
sidebar.setHidden(false); sidebar.setHidden(false);
} }
}} }}
onPointerLeave={e => {
if (e.pointerType === 'mouse') {
sidebar.setHidden(true);
}
}}
onPointerUp={e => { onPointerUp={e => {
if (e.pointerType !== 'mouse') { if (e.pointerType !== 'mouse') {
sidebar.setHidden(!sidebar.hidden); sidebar.setHidden(!sidebar.hidden);
......
...@@ -106,11 +106,11 @@ export function SidebarCategory({ ...@@ -106,11 +106,11 @@ export function SidebarCategory({
setMenuOpen(false); setMenuOpen(false);
}} }}
items={[ items={[
{ name: 'rename', text: 'Rename' },
!categoryGroup?.hidden && { !categoryGroup?.hidden && {
name: 'toggle-visibility', name: 'toggle-visibility',
text: category.hidden ? 'Show' : 'Hide', text: category.hidden ? 'Show' : 'Hide',
}, },
{ name: 'rename', text: 'Rename' },
{ name: 'delete', text: 'Delete' }, { name: 'delete', text: 'Delete' },
]} ]}
/> />
......
...@@ -127,11 +127,11 @@ export function SidebarGroup({ ...@@ -127,11 +127,11 @@ export function SidebarGroup({
}} }}
items={[ items={[
{ name: 'add-category', text: 'Add category' }, { name: 'add-category', text: 'Add category' },
{ name: 'rename', text: 'Rename' },
!group.is_income && { !group.is_income && {
name: 'toggle-visibility', name: 'toggle-visibility',
text: group.hidden ? 'Show' : 'Hide', text: group.hidden ? 'Show' : 'Hide',
}, },
{ name: 'rename', text: 'Rename' },
onDelete && { name: 'delete', text: 'Delete' }, onDelete && { name: 'delete', text: 'Delete' },
]} ]}
/> />
......
import React from 'react'; import React from 'react';
import { useDebounceCallback } from 'usehooks-ts';
import { useGlobalPref } from '../../hooks/useGlobalPref'; import { useGlobalPref } from '../../hooks/useGlobalPref';
import { useResponsive } from '../../ResponsiveProvider'; import { useResponsive } from '../../ResponsiveProvider';
import { View } from '../common/View'; import { View } from '../common/View';
...@@ -14,25 +16,30 @@ export function FloatableSidebar() { ...@@ -14,25 +16,30 @@ export function FloatableSidebar() {
const { isNarrowWidth } = useResponsive(); const { isNarrowWidth } = useResponsive();
const sidebarShouldFloat = floatingSidebar || sidebar.alwaysFloats; const sidebarShouldFloat = floatingSidebar || sidebar.alwaysFloats;
const debouncedHideSidebar = useDebounceCallback(
() => sidebar.setHidden(true),
350,
);
return isNarrowWidth ? null : ( return isNarrowWidth ? null : (
<View <View
onMouseOver={ onMouseOver={
sidebarShouldFloat sidebarShouldFloat
? e => { ? e => {
debouncedHideSidebar.cancel();
e.stopPropagation(); e.stopPropagation();
sidebar.setHidden(false); sidebar.setHidden(false);
} }
: undefined : undefined
} }
onMouseLeave={ onMouseLeave={
sidebarShouldFloat ? () => sidebar.setHidden(true) : undefined sidebarShouldFloat ? () => debouncedHideSidebar() : undefined
} }
style={{ style={{
position: sidebarShouldFloat ? 'absolute' : undefined, position: sidebarShouldFloat ? 'absolute' : undefined,
top: 12, top: 8,
// If not floating, the -50 takes into account the transform below // If not floating, the -50 takes into account the transform below
bottom: sidebarShouldFloat ? 12 : -50, bottom: sidebarShouldFloat ? 8 : -50,
zIndex: 1001, zIndex: 1001,
borderRadius: sidebarShouldFloat ? '0 6px 6px 0' : 0, borderRadius: sidebarShouldFloat ? '0 6px 6px 0' : 0,
overflow: 'hidden', overflow: 'hidden',
...@@ -40,7 +47,7 @@ export function FloatableSidebar() { ...@@ -40,7 +47,7 @@ export function FloatableSidebar() {
!sidebarShouldFloat || sidebar.hidden !sidebarShouldFloat || sidebar.hidden
? 'none' ? 'none'
: '0 15px 30px 0 rgba(0,0,0,0.25), 0 3px 15px 0 rgba(0,0,0,.5)', : '0 15px 30px 0 rgba(0,0,0,0.25), 0 3px 15px 0 rgba(0,0,0,.5)',
transform: `translateY(${!sidebarShouldFloat ? -12 : 0}px) transform: `translateY(${!sidebarShouldFloat ? -8 : 0}px)
translateX(${ translateX(${
sidebarShouldFloat && sidebar.hidden ? '-100' : '0' sidebarShouldFloat && sidebar.hidden ? '-100' : '0'
}%)`, }%)`,
......
---
category: Bugfix
authors: [YusefOuda]
---
Moves "Rename" to first item in Category + Category Group menus. Adds debounce to sidebar animation.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment