wp-calypso
wp-calypso copied to clipboard
refactor(sftp-card): tsx, styled to scss, removed unused classNames, fixed checkbox padding, fixed cleaning up of the password
Related to https://github.com/Automattic/wp-calypso/issues/95435
Proposed Changes
With this PR we are fixing the gap for Enable SSH access for this site
checkbox.
And also I decided to improve a few things:
- Rewrite sftp-card component to tsx
- Moved
styled
-css to.scss
, for consistency with most of the component in Calypso - Removed a bunch of unused classNames
- Fixed cleaning up of the password (thanks TSX for highlighting it).
I know that in Calypso we don't force to use tsx, but I advocate everybody to do it. 4-th point is good example, during rewriting it I faced a bug. It wasn't critical, but still.
4.1 We provided 3 arguments instead of 2 - the function expects
siteId, username
, but we providesiteId, currentUserId, username
. 4.2 Cleaning up process was incorrect - we invokeddestroy
function immediately during render process, instead of on unmounting. We can see that intention was to return it, but by mistake it was immediately invoked.
Testing Instructions
Main issues
- Have an Atomic site.
- Look for it in wordpress.com/sites.
- Click "Server Settings".
- Click "Create credentials".
- Turn on the "Enable SSH access for this site" toggle.
- Assert that checbox and input are not stacked
BEFORE | AFTER |
Refactor
- Smoke test that everything looks and works the same way as before
- TRy to reset password -> Open another tab (e.g. "Staging Site") -> Come back to "Server Settings" -> Assert that you see "Reset password" button