Add Manual Migration component. #2858
Conversation
a1833d7
to
cd6e574
|
PR has r+ on design. |
|
Overall looks to be functioning as expected except for the "Cancel" from wizard. A bunch of various nits/renamings. |
| @@ -49,6 +49,7 @@ class Base extends React.Component { | |||
| <div className="outer-wrapper"> | |||
| <main> | |||
| {prefs.showSearch && <Search />} | |||
| <ManualMigration /> | |||
Mardak
Jul 21, 2017
Member
Looks like we should be able to conditionally show this like the adjacent components. Probably !pref.migrationExpired ?
Looks like we should be able to conditionally show this like the adjacent components. Probably !pref.migrationExpired ?
Mardak
Jul 21, 2017
Member
Or maybe even match the show pattern with showMigration and have it start true then goes false when expired.
Or maybe even match the show pattern with showMigration and have it start true then goes false when expired.
| <FormattedMessage id="manual_migration_explanation_msg" /> | ||
| </p> | ||
| <div className="manual-migration-actions actions"> | ||
| <button onClick={() => this._cancelTour()}> |
Mardak
Jul 21, 2017
Member
Pass in a bound-from-outside-render method to avoid unnecessary render. See #2928 for examples
Pass in a bound-from-outside-render method to avoid unnecessary render. See #2928 for examples
|
|
||
| render() { | ||
| if (this.props.values.migrationExpired === true) { | ||
| return null; |
Mardak
Jul 21, 2017
Member
No need for this check if Base handles not even creating the component.
No need for this check if Base handles not even creating the component.
|
|
||
| module.exports = connect(state => state.Prefs)(ManualMigration); | ||
| module.exports._unconnected = ManualMigration; | ||
| module.exports.ManualMigration = ManualMigration; |
Mardak
Jul 21, 2017
Member
Any particular reason to export as both _unconnected and ManualMigration?
Any particular reason to export as both _unconnected and ManualMigration?
| @@ -81,6 +82,21 @@ const PREFS_CONFIG = new Map([ | |||
| "provider_name": "Pocket", | |||
| "provider_icon": "pocket" | |||
| }` | |||
| }], | |||
| ["migrationExpired", { | |||
| title: "Boolean flag that will always be true once the migration period has passed.", | |||
Mardak
Jul 21, 2017
Member
Not sure if this is better named as "migrationDismissed" or "migrationDone" or as it is right now could be fine. The description is not as accurate in that there's multiple ways that it becomes true.
Not sure if this is better named as "migrationDismissed" or "migrationDone" or as it is right now could be fine. The description is not as accurate in that there's multiple ways that it becomes true.
| @@ -20,6 +20,7 @@ const {TelemetryFeed} = Cu.import("resource://activity-stream/lib/TelemetryFeed. | |||
| const {TopSitesFeed} = Cu.import("resource://activity-stream/lib/TopSitesFeed.jsm", {}); | |||
| const {DummySectionFeed} = Cu.import("resource://activity-stream/lib/DummySectionFeed.jsm", {}); | |||
| const {TopStoriesFeed} = Cu.import("resource://activity-stream/lib/TopStoriesFeed.jsm", {}); | |||
| const {ManualMigration} = Cu.import("resource://activity-stream/lib/ManualMigration.jsm", {}); | |||
Mardak
Jul 21, 2017
Member
nit: restore alphabetical
nit: restore alphabetical
| isExpiredStub.returns(true); | ||
|
|
||
| instance.checkMigrationStatus(false); | ||
| assert.calledOnce(setStatusStub); |
Mardak
Jul 21, 2017
Member
nit: newline between test and check
nit: newline between test and check
|
|
||
| assert.calledOnce(migrationSpy); | ||
|
|
||
| assert.calledTwice(fakePrefs.get); |
Mardak
Jul 21, 2017
Member
nit: excess newline?
nit: excess newline?
|
|
||
| # LOCALIZATION NOTE (manual_migration_explanation_msg): This message is show to encourage users to | ||
| # import their browser profile from another browsers they might be using. | ||
| manual_migration_explanation_msg=Try Firefox with your favorite sites, bookmarks, and passwords from another browser. |
Mardak
Jul 21, 2017
Member
Let's just do manual_migration_explanation
Let's just do manual_migration_explanation
| manual_migration_explanation_msg=Try Firefox with your favorite sites, bookmarks, and passwords from another browser. | ||
| # LOCALIZATION NOTE (manual_migration_cancel_btn): This message is shown on a button that cancels the | ||
| # process of importing a browser profile into Firefox. | ||
| manual_migration_cancel_btn=No Thanks |
Mardak
Jul 21, 2017
Member
And looks like the pattern is _button
And looks like the pattern is _button
|
@Mardak what would be the expected behavior of cancel compared to how the current implementation works. |
|
Bryant says cancel is the least important one but the spec says to also dismiss the manual migration message if the user hits cancel: #2787 (comment) If there's no similar "Migration:Ended" event for "Migration:Cancel" then that would need to be added to mozilla-central, but this PR can land without that given its lower priority. |
|
@Mardak can you have another look at this? Thanks. |
|
Almost there. Still a couple of issues with default prefs and |
| <FormattedMessage id="manual_migration_explanation" /> | ||
| </p> | ||
| <div className="manual-migration-actions actions"> | ||
| <button onClick={this._cancelTour(this.props.dispatch)}> |
Mardak
Jul 24, 2017
Member
This does avoid the bind call directly within render but it's still binding a function so that every potential render of ManualMigration will force a rerendering because it's not === due to a new function. You should just do the usual bind in constructor.
This does avoid the bind call directly within render but it's still binding a function so that every potential render of ManualMigration will force a rerendering because it's not === due to a new function. You should just do the usual bind in constructor.
| ["migrationExpired", { | ||
| title: "Boolean flag that decides whether to show the migration message or not.", | ||
| value: false, | ||
| value_local_dev: false |
Mardak
Jul 24, 2017
Member
The other review comment asked about why value_local_dev is needed. You addressed the last one but left these untouched.
The other review comment asked about why value_local_dev is needed. You addressed the last one but left these untouched.
| ["migrationRemainingDays", { | ||
| title: "Number of days to show the manual migration message", | ||
| value: 4, | ||
| value_local_dev: 2 |
Mardak
Jul 24, 2017
Member
Same thing here value_local_dev to be explicit.
Same thing here value_local_dev to be explicit.
| <button onClick={this._cancelTour(this.props.dispatch)}> | ||
| <FormattedMessage id="manual_migration_cancel_button" /> | ||
| </button> | ||
| <button className="done" onClick={this._launchTour(this.props.dispatch)}> |
Mardak
Jul 24, 2017
Member
This is also effectively binding.
This is also effectively binding.
| } | ||
| } | ||
|
|
||
| module.exports = connect(state => state.Prefs)(ManualMigration); |
Mardak
Jul 24, 2017
Member
Selecting Prefs shouldn't be needed anymore?
Selecting Prefs shouldn't be needed anymore?
|
Thanks! |
Still waiting on spec for the messages, button text.
Fixes #2787