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

[TS migration] Reafactor tooltips.js to use typescript #2073

Merged
merged 14 commits into from
Dec 17, 2023

Conversation

IzStriker
Copy link
Contributor

Link to: #1483

Converted tooltips.js to tooltips.tsx and created types where I was able to work them out.

Let me know if you have any feedback

Copy link

netlify bot commented Dec 12, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 3747e22
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/657f5d8d9a3428000817520f
😎 Deploy Preview https://deploy-preview-2073.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.

Copy link
Contributor

github-actions bot commented Dec 12, 2023

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
16 3.09 MB → 3.09 MB (+186 B) +0.01%
Changeset
File Δ Size
src/components/tooltips.tsx 🆕 +11.12 kB 0 B → 11.12 kB
src/components/tooltips.js 🔥 -10.83 kB (-100%) 10.83 kB → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/main.js 1.26 MB → 1.26 MB (+186 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/665.chunk.js 824.28 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/444.chunk.js 156.11 kB 0%
static/js/231.chunk.js 117.38 kB 0%
static/js/wide-components.chunk.js 114.99 kB 0%
static/js/reports.chunk.js 76.98 kB 0%
static/js/narrow-components.chunk.js 51.17 kB 0%
static/js/226.chunk.js 28.94 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/resize-observer-polyfill.chunk.js 8.88 kB 0%
static/css/main.css 7.41 kB 0%
asset-manifest.json 2.07 kB 0%
index.html 1.66 kB 0%
static/media/browser-server.js 911 B 0%

Copy link
Contributor

github-actions bot commented Dec 12, 2023

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
2 2.23 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.24 MB 0%
xfo.xfo.kcab.worker.js 1014.46 kB 0%

@IzStriker IzStriker changed the title Reafactor tooltips.js to use typescript [Draft] Reafactor tooltips.js to use typescript Dec 14, 2023
@IzStriker IzStriker marked this pull request as draft December 14, 2023 07:30
@IzStriker IzStriker changed the title [Draft] Reafactor tooltips.js to use typescript Reafactor tooltips.js to use typescript Dec 14, 2023
@IzStriker IzStriker marked this pull request as ready for review December 14, 2023 21:38
@IzStriker IzStriker changed the title Reafactor tooltips.js to use typescript [TS migration] Reafactor tooltips.js to use typescript Dec 14, 2023
Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

Sweet! Thanks for taking your time to help with the TS migration. Let me know what you think about my comments. :)

packages/desktop-client/src/components/tooltips.tsx Outdated Show resolved Hide resolved
packages/desktop-client/src/components/tooltips.tsx Outdated Show resolved Hide resolved
packages/desktop-client/src/components/tooltips.tsx Outdated Show resolved Hide resolved
@@ -138,9 +184,10 @@ export class Tooltip extends Component {
}

const box = contentEl.getBoundingClientRect();
const anchorEl = this.target.parentNode;
const anchorEl = this.target.parentNode as HTMLElement;
Copy link
Member

Choose a reason for hiding this comment

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

❓ question: ‏same question here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is necessary because .partentNode is of type ParentNode which you can't call getBoundingClientRect on.

Copy link
Member

Choose a reason for hiding this comment

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

Might need to add a type guard here. That would solve the problem.

In my experience manual type coercions tend to lead to subtle bugs that are very hard to catch. Hence why I'm so nitpicky about them. Sorry about that.

@IzStriker
Copy link
Contributor Author

@MatissJanis Thanks for your patience, hopefully this is good.

Copy link
Member

@MatissJanis MatissJanis left a comment

Choose a reason for hiding this comment

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

No; thank YOU for your patience :)

Great job!

@MatissJanis MatissJanis merged commit d4c8b5f into actualbudget:master Dec 17, 2023
19 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed ✅ Approved labels Dec 17, 2023
@IzStriker IzStriker deleted the reafactor-tooltips branch December 20, 2023 05:24
FlorianLang06 pushed a commit to FlorianLang06/actual that referenced this pull request Mar 7, 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.

2 participants