Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Refactor syncTab.js with Aphrodite #8044

Merged
merged 1 commit into from
May 1, 2017
Merged

Refactor syncTab.js with Aphrodite #8044

merged 1 commit into from
May 1, 2017

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Apr 2, 2017

Closes #8042
Addresses #7989
Addresses #8054
Addresses #8587

  • Unified the modal dialog design of payments and sync

    • Copied the styles of modal dialog of payments to commonStyles.js, adding modalOverlay__dialog and modalOverlay__title to ModalOverlay on syncTab.js
    • Copied panelMargin, panelItemMargin, and panelPadding from payment.js to global.js
    • Added modalVeryLightGray, modalLightGray, and borderRadiusModal to global.js
    • Replaced linkButton with primaryButton
    • Set flex:1 to two elements under postSetupContent
    • TODO: refactor modalOverlay with Aphrodite to remove !important from syncTab.js and commonStyles.js
  • Introduced modalOverlay__footer and modalOverlay__footerButton

    • Removed advanceFooter and replaced paymentCommon.advanceFooter with them to make the styling of the modal dialog footer consistent
  • Removed styles under .syncContainer, #syncPassphrase, and #syncQR in preferences.less

    • Unified margins between buttons on dialog to 8px with globalStyles.spacing.overlayButtonMargin
      Aligned buttons to the right
  • Removed .formControl from forms.less

    • We no longer need it as commonStyles.formControl is applied manually, along with commonStyles.textbox, commonStyles.textbox__outlineable, and commonStyles.textbox__isSettings.

Also:

  • Changed settingsListContainerMargin into a variable to apply it to syncOverlayBody__form
  • Added "Done" button to the new device sync dialog
  • Replaced 'sync' with 'Sync'
  • Updated test code

Auditors:

Test plan 1:

  1. Open about:preferences#sync
  2. Verify you are able to sync two devices using the secret code
  3. Visit a site on device 1 and change shield setting, ensure that the saved site preference is synced to device 2
  4. Enable Browsing history sync on device 1, ensure the history is shown on device 2
  5. Import/Add bookmarks on device 1, ensure it is synced on device 2
  6. Ensure imported bookmark folder structure is maintained on device 2
  7. Ensure bookmark favicons are shown after sync
  8. Open about:preferences#payments
  9. Click "Add funds..."
  10. Make sure the style of the modal overlay dialog is same as that of sync dialog

Test Plan 2:

  1. Automated tests should pass
  2. Open about:preferences#sync
  3. Make the window small
  4. Scroll the page to the bottom
  5. Make sure there is 2rem margin between the reset sync button and the the border of the window

Test Plan 3:

  1. Open about:preferences#sync
  2. Open about:preferences#payments
  3. Make sure the headers appear exactly on the same place

Test Plan 4:

  1. Reset Sync
  2. Make sure margin-top of the buttons is set to 18px
  3. Enable Sync
  4. Make sure margin-top of DefaultSectionTitle is set to 2rem
  5. Disable Sync
  6. Make sure margin around the gray box is set to 15px

Test Plan 5:

  1. Enable Sync
  2. Click "Sync a new device"
  3. Click "Show secret QR code"
  4. Hover on the QR image
  5. Make sure the title appears

bravesync

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

@luixxiul
Copy link
Contributor Author

luixxiul commented Apr 2, 2017

Requesting a design review from @bradleyrichter: #8044 (comment)

@luixxiul
Copy link
Contributor Author

luixxiul commented Apr 3, 2017

@ayumi @diracdeltas Should "sync" be "Sync" except "sync code"? ie "Set up Sync" and "I am new to Sync"

@ayumi
Copy link
Contributor

ayumi commented Apr 3, 2017

@luixxiul "Sync" is correct, and i think "Sync code" too– like entering your Sync code words.

@luixxiul luixxiul changed the base branch from master to refactoring-aphrodite April 6, 2017 09:22
@luixxiul luixxiul requested a review from NejcZdovc April 6, 2017 15:36
@luixxiul luixxiul changed the base branch from refactoring-aphrodite to master April 10, 2017 03:43
@luixxiul luixxiul added this to the 0.14.3 milestone Apr 10, 2017
@luixxiul luixxiul mentioned this pull request Apr 16, 2017
4 tasks
@cezaraugusto
Copy link
Contributor

sorry why is PR marked as blocked?

@luixxiul
Copy link
Contributor Author

luixxiul commented Apr 17, 2017

because it requires #8237 ("Brave Sync" header issue). See: Test Plan 3.

@luixxiul luixxiul removed the request for review from NejcZdovc April 22, 2017 05:53
@NejcZdovc
Copy link
Contributor

@luixxiul I think this is a good time, because we are refactoring to aphrodite and we are leaving leftovers that don't do anything. I searched for every class in the less file and it's not there. Can you double check and if you don't find it in our code base I would suggest to just delete it in this PR

@NejcZdovc
Copy link
Contributor

This way we keep our code clean and up to date, otherwise we have dead code and it's hard to track what needs to be removed and what not from a third person after a month or so.

cc @bsclifton

@luixxiul
Copy link
Contributor Author

Fine, if so would you mind searching unnecessary classes and ids of #8443

@luixxiul
Copy link
Contributor Author

@NejcZdovc done, review again. thanks

@bsclifton
Copy link
Member

++ on removing the dead code- thanks @luixxiul 😄

Copy link
Contributor

@NejcZdovc NejcZdovc left a comment

Choose a reason for hiding this comment

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

Looking really good, just few more small fixes and we are good to go

syncOverlay: true,
[css(styles.syncOverlayBody__wrapper)]: true
})}>
return <div className={css(styles.syncOverlayBody__wrapper)}>
<div className={css(styles.syncOverlayBody__label)} data-l10n-id='syncEnterPassphrase' />
<div className={css(styles.syncOverlayBody__form)}>
<textarea className={cx({
Copy link
Contributor

@NejcZdovc NejcZdovc Apr 30, 2017

Choose a reason for hiding this comment

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

We don't need cx here anymore

</ul>
<img className={css(styles.syncOverlayBody__syncQRImg)}
src={this.props.syncData.get('seedQr')}
title='Brave sync QR code'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please translate this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's the another task but I will

placeholder={this.defaultDeviceName} />
<div className={css(styles.syncOverlayBody__label)} data-l10n-id='syncDeviceNameInput' />
<div>
<input className={cx({
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need cx here anymore

return <div className={css(styles.syncOverlayBody__wrapper)}>
<div className={css(styles.syncOverlayBody__label)} data-l10n-id='syncEnterPassphrase' />
<div className={css(styles.syncOverlayBody__form)}>
<textarea className={cx({
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need cx here anymore

Closes #8042
Addresses #7989
Addresses #8054

- Unified the modal dialog design of payments and sync
  Copied the styles of modal dialog of payments to commonStyles.js, adding modalOverlay__dialog and modalOverlay__title to ModalOverlay on syncTab.js
  Copied panelMargin, panelItemMargin, and panelPadding from payment.js to global.js
  Added modalVeryLightGray, modalLightGray, and borderRadiusModal to global.js
  Replaced linkButton with primaryButton
  Set flex:1 to two elements under postSetupContent
  TODO: refactor modalOverlay with Aphrodite to remove !important from syncTab.js and commonStyles.js

- Introduced modalOverlay__footer and modalOverlay__footerButton
  Removed advanceFooter and replaced paymentCommon.advanceFooter with them to make the styling of the modal dialog footer consistent

- Removed styles under .syncContainer, #syncPassphrase, and #syncQR in preferences.less
  Unified margins between buttons on dialog to 8px with globalStyles.spacing.overlayButtonMargin
  Aligned buttons to the right

- Removed .formControl from forms.less
  We no longer need it as commonStyles.formControl is applied manually, along with commonStyles.textbox, commonStyles.textbox__outlineable, and commonStyles.textbox__isSettings.

Also:
- Changed settingsListContainerMargin into a variable to apply it to syncOverlayBody__form
- Added "Done" button to the new device sync dialog
- Added styles.section to unify the margin-bottom of each section
- Replaced 'sync' with 'Sync'
- Updated test code

Auditors:

Test plan 1:
1. Open about:preferences#sync
2. Verify you are able to sync two devices using the secret code
3. Visit a site on device 1 and change shield setting, ensure that the saved site preference is synced to device 2
4. Enable Browsing history sync on device 1, ensure the history is shown on device 2
5. Import/Add bookmarks on device 1, ensure it is synced on device 2
6. Ensure imported bookmark folder structure is maintained on device 2
7. Ensure bookmark favicons are shown after sync
8. Open about:preferences#payments
9. Click "Add funds..."
10. Make sure the style of the modal overlay dialog is same as that of sync dialog

Test Plan 2:
1. Automated tests should pass
2. Open about:preferences#sync
3. Make the window small
4. Scroll the page to the bottom
5. Make sure there is 2rem margin between the reset sync button and the the border of the window

Test Plan 3:
1. Open about:preferences#sync
2. Open about:preferences#payments
3. Make sure the headers appear exactly on the same place

Test Plan 4:
1. Reset Sync
2. Make sure margin-top of the buttons is set to 18px
3. Enable Sync
4. Make sure margin-top of DefaultSectionTitle is set to 2rem
5. Disable Sync
6. Make sure margin around the gray box is set to 15px

Test Plan 5:
1. Enable Sync
2. Click "Sync a new device"
3. Click "Show secret QR code"
4. Hover on the QR image
5. Make sure the title appears
@@ -74,7 +74,7 @@ class LedgerBackupFooter extends ImmutableComponent {
}

render () {
return <div className={css(paymentCommon.advanceFooter)}>
return <div className={css(commonStyles.modalOverlay__footer, commonStyles.modalOverlay__footerButton)}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this kind of styling will be removed with the PR on refactoring modalOverlay, which I will submit later.

@luixxiul luixxiul requested a review from srirambv May 1, 2017 04:29
@luixxiul
Copy link
Contributor Author

luixxiul commented May 1, 2017

Also asking @srirambv for manual test plans. thanks in advance.

Copy link
Contributor

@NejcZdovc NejcZdovc left a comment

Choose a reason for hiding this comment

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

LGTM

@srirambv
Copy link
Collaborator

srirambv commented May 1, 2017

@luixxiul popup still needs to be fixed. Buttons alligned next to the text. Should be on the next line
image

Copy link
Collaborator

@srirambv srirambv left a comment

Choose a reason for hiding this comment

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

popup confirmation modal needs rework. Buttons are aligned next to text. Should be below the texr

@luixxiul
Copy link
Contributor Author

luixxiul commented May 1, 2017

popup confirmation modal needs rework. Buttons are aligned next to text. Should be below the texr

@srirambv I confirmed that bug appeared also on the master branch. Let's address the issue with another PR.

Except that, looking good?

@srirambv
Copy link
Collaborator

srirambv commented May 1, 2017

@luixxiul Is the colour of the sync passphrase expected to chang from #ff0400 to D44600?
image

@luixxiul
Copy link
Contributor Author

luixxiul commented May 1, 2017

@srirambv Yes it is. color: globalStyles.color.braveDarkOrange

From this random color: https://github.com/brave/browser-laptop/pull/8044/files#diff-4b50ff14dadc9756719a577a72f520d6L653

@luixxiul luixxiul removed the request for review from bradleyrichter May 1, 2017 10:42
@srirambv
Copy link
Collaborator

srirambv commented May 1, 2017

@luixxiul I can open up an issue for the confirmation modal for a new PR. Apart from that everything else looks good 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify modal dialogs of payments and sync
6 participants