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

Maintenance: CreateAccount and CreateEncryptionKey to tsx #1755

Conversation

MikesGlitch
Copy link
Contributor

@MikesGlitch MikesGlitch commented Oct 1, 2023

Convert CreateAccount and CreateEncryptionKey components to TypeScript.

Relates to : #1483

@netlify
Copy link

netlify bot commented Oct 1, 2023

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit af935b6
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/651dd764741cbc0008b3c9e8
😎 Deploy Preview https://deploy-preview-1755.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.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 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 2.48 MB → 2.48 MB (+3 B) +0.00%
Changeset
File Δ Size
src/components/modals/CreateEncryptionKey.tsx 🆕 +10.46 kB 0 B → 10.46 kB
src/components/modals/CreateAccount.tsx 🆕 +6.91 kB 0 B → 6.91 kB
src/components/modals/countries.ts 🆕 +1.71 kB 0 B → 1.71 kB
src/components/autocomplete/Autocomplete.tsx 📈 +3 B (+0.01%) 21.99 kB → 22 kB
src/components/modals/CreateEncryptionKey.js 🔥 -10.46 kB (-100%) 10.46 kB → 0 B
src/components/modals/CreateAccount.js 🔥 -6.91 kB (-100%) 6.91 kB → 0 B
src/components/modals/countries.js 🔥 -1.71 kB (-100%) 1.71 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.12 MB → 1.12 MB (+3 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/678.chunk.js 420.74 kB 0%
static/media/Inter-italic.var.woff2 239.29 kB 0%
static/media/Inter-roman.var.woff2 221.86 kB 0%
static/js/713.chunk.js 156.56 kB 0%
static/js/wide-components.chunk.js 126.87 kB 0%
static/js/231.chunk.js 117.37 kB 0%
static/js/narrow-components.chunk.js 34.74 kB 0%
static/js/reports.chunk.js 29.23 kB 0%
static/js/473.chunk.js 13 kB 0%
static/js/389.chunk.js 12.77 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 903 B 0%

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 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.22 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.23 MB 0%
xfo.xfo.kcab.worker.js 1014.46 kB 0%

@MikesGlitch MikesGlitch marked this pull request as ready for review October 1, 2023 20:49
@MikesGlitch MikesGlitch changed the title updating CreateAccount and CreateEncryptionKey to tsx Updating CreateAccount and CreateEncryptionKey to tsx Oct 1, 2023
@MikesGlitch MikesGlitch changed the title Updating CreateAccount and CreateEncryptionKey to tsx Maintenance: CreateAccount and CreateEncryptionKey to tsx Oct 2, 2023
@MikesGlitch MikesGlitch force-pushed the maintenance/typescript-acc-and-encryptionkey branch 2 times, most recently from 1059cef to 220921f Compare October 4, 2023 17:55
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.

Overall LGTM! Would you mind taking a look at the one nitpick?

@@ -142,7 +152,9 @@ export default function CreateEncryptionKey({
<Input
type={showPassword ? 'text' : 'password'}
style={{ width: 300 }}
onChange={e => setPassword(e.target.value)}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
Copy link
Member

Choose a reason for hiding this comment

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

🥜 nitpick: ‏we should be able to automatically infer this type from the InputProps. If it's currently not happening: would you mind checking why? Maybe we're missing definition of onChange.

Once we solve it in InputProps, then we won't need to do this change anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Much better, thanks.

@MikesGlitch MikesGlitch force-pushed the maintenance/typescript-acc-and-encryptionkey branch from 220921f to 7aba017 Compare October 4, 2023 20:39
// preventDownshiftDefault is a downshift.js property - they don't have types for it on the React event
// Suggested way to make this work with typescript is to cast as any... https://github.com/downshift-js/downshift/issues/734
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(e as any).preventDownshiftDefault = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MatissJanis Fixing the Input.tsx types gave us an issue on this Autocomplete component by downshift.

The issue was that "preventDownshiftDefault" is not on the React.FocusEvent<HTMLInputElement, Element> - and rightly so 🤪 .

It's a known issue with downshift's types, here's the github issue: downshift-js/downshift#734

The suggested workaround is to type it as "any" so that's what I've done here.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Very informative comment :)

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 I just found a better way than (e as any). The types don't complain when I access it directly, like

e['preventDownshiftDefault'] = true;

I've seen that elsewhere in the autocomplete file, so I've updated with that.

@MikesGlitch MikesGlitch force-pushed the maintenance/typescript-acc-and-encryptionkey branch from 4dd1a1e to af935b6 Compare October 4, 2023 21:21
@MatissJanis MatissJanis merged commit f6e2d3b into actualbudget:master Oct 4, 2023
17 checks passed
@trafico-bot trafico-bot bot added ✨ Merged Pull Request has been merged successfully and removed 🔍 Ready for Review labels Oct 4, 2023
@MikesGlitch MikesGlitch deleted the maintenance/typescript-acc-and-encryptionkey branch October 4, 2023 21:37
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