Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ (tooltip) refactoring to react-aria (vol.4) #2724

Merged
merged 11 commits into from May 15, 2024
Merged

Conversation

MatissJanis
Copy link
Member

Follow-up to #2631

This should move the majority (if not all) of the Tooltip components used in the reports page.

@trafico-bot trafico-bot bot added the 🚧 WIP Still work-in-progress, please don't review and don't merge label May 7, 2024
Copy link

netlify bot commented May 7, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit b2e1cd7
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6643b5a181d83c0008ca8e12
😎 Deploy Preview https://deploy-preview-2724.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -1,11 +1,11 @@
import React, { type ComponentProps, memo, useState } from 'react';
import React, { type ComponentProps, memo, useRef, useState } from 'react';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation when reviewing:
Screenshot 2024-05-07 at 17 28 22

Copy link
Contributor

github-actions bot commented May 7, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 4.72 MB → 4.72 MB (-725 B) -0.01%
Changeset
File Δ Size
src/components/budget/rollover/TransferMenu.tsx 🆕 +2.38 kB 0 B → 2.38 kB
src/components/budget/rollover/HoldMenu.tsx 🆕 +1.65 kB 0 B → 1.65 kB
src/components/budget/rollover/CoverMenu.tsx 🆕 +1.62 kB 0 B → 1.62 kB
src/components/budget/rollover/BalanceMovementMenu.tsx 🆕 +1.34 kB 0 B → 1.34 kB
src/components/budget/rollover/RolloverComponents.tsx 📈 +668 B (+5.58%) 11.69 kB → 12.34 kB
src/components/budget/SidebarCategory.tsx 📈 +96 B (+1.99%) 4.71 kB → 4.8 kB
src/components/budget/SidebarGroup.tsx 📈 +104 B (+1.88%) 5.4 kB → 5.5 kB
src/components/common/Menu.tsx 📈 +93 B (+1.69%) 5.38 kB → 5.48 kB
src/components/budget/rollover/budgetsummary/ToBudget.tsx 📈 +27 B (+1.37%) 1.93 kB → 1.96 kB
src/components/budget/report/ReportComponents.tsx 📉 -2 B (-0.02%) 10.84 kB → 10.84 kB
src/components/budget/report/BalanceTooltip.tsx 📉 -2 B (-0.31%) 639 B → 637 B
src/components/budget/rollover/budgetsummary/BudgetSummary.tsx 📉 -44 B (-0.59%) 7.28 kB → 7.24 kB
src/components/budget/BudgetTotals.tsx 📉 -158 B (-4.81%) 3.21 kB → 3.06 kB
src/components/budget/rollover/budgetsummary/ToBudgetAmount.tsx 📉 -184 B (-8.57%) 2.1 kB → 1.92 kB
src/components/budget/rollover/TransferTooltip.tsx 🔥 -2.84 kB (-100%) 2.84 kB → 0 B
src/components/budget/rollover/CoverTooltip.tsx 🔥 -1.99 kB (-100%) 1.99 kB → 0 B
src/components/budget/rollover/HoldTooltip.tsx 🔥 -1.75 kB (-100%) 1.75 kB → 0 B
src/components/budget/rollover/BalanceTooltip.tsx 🔥 -1.69 kB (-100%) 1.69 kB → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
static/js/wide.js 262.4 kB → 261.78 kB (-634 B) -0.24%
static/js/index.js 3 MB → 3 MB (-91 B) -0.00%

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 59.81 kB 0%
static/js/usePreviewTransactions.js 790 B 0%
static/js/AppliedFilters.js 20.54 kB 0%
static/js/ReportRouter.js 1.23 MB 0%

Copy link
Contributor

github-actions bot commented May 7, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.2 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.2 MB 0%

};

function Cover({ onSubmit }: CoverProps) {
export function CoverTooltip({ onSubmit, onClose }: CoverTooltipProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider renaming this as it's no longer a tooltip. Maybe CoverMenu?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't want to do too much changes in this PR, but that makes sense :)
Updated

initialAmount?: number;
showToBeBudgeted?: boolean;
onSubmit: (amount: number, categoryId: string) => void;
onClose: () => void;
};

export function TransferTooltip({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider renaming this as it's no longer a tooltip. Maybe TransferMenu?

position = 'bottom-right',
...props
}: HoldTooltipProps) {
export function HoldTooltip({ onSubmit, onClose }: HoldTooltipProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider renaming this as it's no longer a tooltip. Maybe HoldMenu?


import { BalanceMenu } from './BalanceMenu';
import { CoverTooltip } from './CoverTooltip';
import { TransferTooltip } from './TransferTooltip';

type BalanceTooltipProps = {
categoryId: string;
tooltip: { close: () => void };
month: string;
onBudgetAction: (month: string, action: string, arg?: unknown) => void;
onClose?: () => void;
};

export function BalanceTooltip({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as other tooltips

@MatissJanis MatissJanis changed the title [WIP] ♻️ (tooltip) refactoring to react-aria (vol.4) ♻️ (tooltip) refactoring to react-aria (vol.4) May 7, 2024
@trafico-bot trafico-bot bot added 🔍 Ready for Review Pull Request is not reviewed yet 🚧 WIP Still work-in-progress, please don't review and don't merge and removed 🚧 WIP Still work-in-progress, please don't review and don't merge 🔍 Ready for Review Pull Request is not reviewed yet labels May 7, 2024
month: string;
onBudgetAction: (month: string, action: string, arg?: unknown) => void;
onClose?: () => void;
};

export function BalanceTooltip({
export function BalancePopoverContent({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest BalanceMovementMenu here as we could potentially use this out of the context of popovers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! d0291ac

@joel-jeremy
Copy link
Contributor

The category / group popover is in the wrong position

@MatissJanis
Copy link
Member Author

The category / group popover is in the wrong position

Which one is it? Can you send a screenshot?

@joel-jeremy
Copy link
Contributor

@MatissJanis The popover appears on the top left part of the page
image

@MatissJanis
Copy link
Member Author

@joel-jeremy is it a specific category/group menu that appears like that or is it them all?

This is what I have:

Screen.Recording.2024-05-14.at.19.01.41.mov

@MatissJanis
Copy link
Member Author

Managed to reproduce.

Safari is OK. Chrome breaks.

@joel-jeremy
Copy link
Contributor

joel-jeremy commented May 14, 2024

Popover location is now fixed 👍 Found another one: When clicking on any of the options in the category group popover, it collapses/expands the category group. I believe this was fixed before?

@MatissJanis
Copy link
Member Author

Thanks for testing so carefully @joel-jeremy ! 🙇

Copy link
Contributor

@joel-jeremy joel-jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Just curious - why we chose different conventions for the Tooltip and Popover components. Popover uses triggerRef but Tooltip wraps the trigger element. Would it be possible to use a single pattern for both? Just thought to bring it up, but that's out of scope of this PR.

@trafico-bot trafico-bot bot added ✅ Approved Pull Request has been approved and can be merged and removed 🔍 Ready for Review Pull Request is not reviewed yet labels May 14, 2024
@MatissJanis
Copy link
Member Author

Just curious - why we chose different conventions for the Tooltip and Popover components. Popover uses triggerRef but Tooltip wraps the trigger element. Would it be possible to use a single pattern for both? Just thought to bring it up, but that's out of scope of this PR.

Ideally I would have liked them both to just wrap the trigger element (instead of using refs), but that's currently not possible. We'd need to port buttons too to react-aria to remove the triggerRef from Popover.

@MatissJanis MatissJanis merged commit 392f808 into master May 15, 2024
19 checks passed
@MatissJanis MatissJanis deleted the matiss/tooltip-5 branch May 15, 2024 07:35
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved Pull Request has been approved and can be merged labels May 15, 2024
MikesGlitch pushed a commit to MikesGlitch/actual that referenced this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Merged Pull Request has been merged successfully
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Web - Clicking category in drop down stopped working
2 participants