Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

feat(wallet): system settings screen #2200

Merged
merged 28 commits into from
May 21, 2019

Conversation

mrfelton
Copy link
Member

@mrfelton mrfelton commented May 14, 2019

Description:

Add new system settings screen for managing global config options.

Note: This PR implements the base functionality in a basic way. Still waiting for final designs.

Motivation and Context:

fix #1535
fix #1536
fix #2099

How Has This Been Tested?

Manually

Screenshots:

image

Types of changes:

Feature

Checklist:

  • My code follows the code style of this project.
  • I have reviewed and updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes where needed.
  • All new and existing tests passed.
  • My commits have been squashed into a concise set of changes.

@mrfelton mrfelton added the type: enhancement New feature or request label May 14, 2019
@mrfelton mrfelton added this to the v0.5.0-beta milestone May 14, 2019
@mrfelton mrfelton self-assigned this May 14, 2019
@mrfelton mrfelton requested a review from korhaliv May 14, 2019 20:56
@mrfelton mrfelton force-pushed the feat/1535-settings-page branch 2 times, most recently from f038212 to b4abd39 Compare May 15, 2019 10:04
@coveralls
Copy link

coveralls commented May 15, 2019

Coverage Status

Coverage decreased (-0.02%) to 20.537% when pulling d9cd800 on mrfelton:feat/1535-settings-page into 1d25603 on LN-Zap:feat/settings.

Copy link
Member

@korhaliv korhaliv left a comment

Choose a reason for hiding this comment

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

Some feedback

electron/updater.js Outdated Show resolved Hide resolved
renderer/components/Settings/Settings.js Outdated Show resolved Hide resolved
renderer/components/Settings/messages.js Outdated Show resolved Hide resolved
renderer/components/Settings/messages.js Outdated Show resolved Hide resolved
renderer/components/UI/Select.js Outdated Show resolved Hide resolved
renderer/components/UI/TransactionFeeInput.js Outdated Show resolved Hide resolved
renderer/components/UI/TransactionFeeInput.js Outdated Show resolved Hide resolved
renderer/components/UI/messages.js Outdated Show resolved Hide resolved
renderer/containers/ModalStack.js Outdated Show resolved Hide resolved
renderer/store/db.js Show resolved Hide resolved
@mrfelton
Copy link
Member Author

I've addressed all these issues @korhaliv . Ready for re-review.

@mrfelton mrfelton requested a review from korhaliv May 19, 2019 12:56
@mrfelton mrfelton changed the base branch from next to feat/settings May 20, 2019 09:39
Copy link
Member

@korhaliv korhaliv left a comment

Choose a reason for hiding this comment

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

Some more feedback

await autoUpdater.checkForUpdates()
updaterLog.info('Automatic Updates enabled')
this.isActive = true
autoUpdater.checkForUpdates()
const oneHour = 60 * 60 * 1000
Copy link
Member

Choose a reason for hiding this comment

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

Let's extract this into the config ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

package.json Outdated
@@ -350,8 +350,10 @@
"lodash.merge": "4.6.1",
"lodash.partition": "4.6.0",
"lodash.pick": "4.4.0",
"lodash.set": "^4.3.2",
Copy link
Member

Choose a reason for hiding this comment

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

Looks like set was added not in exact mode

const { isSettingsMenuOpen, closeSettingsMenu } = this.props
if (
this.menuRef &&
(this.menuRef && !this.menuRef.contains(event.target)) &&
Copy link
Member

Choose a reason for hiding this comment

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

redundant this.menuRef check

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, removed

this.menuRef &&
(this.menuRef && !this.menuRef.contains(event.target)) &&
(this.buttonRef && !this.buttonRef.contains(event.target)) &&
isSettingsMenuOpen
Copy link
Member

Choose a reason for hiding this comment

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

I'd move this to be the first check since it's faster than contains

Copy link
Member Author

Choose a reason for hiding this comment

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

good call. done

{isSettingsMenuOpen ? <AngleUp width="0.6em" /> : <AngleDown width="0.6em" />}
</Flex>
</Flex>
<Box ref={this.setWrapperRef}>{isSettingsMenuOpen && this.renderSettingsMenu()}</Box>
Copy link
Member

Choose a reason for hiding this comment

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

Is isSettingsMenuOpen check is purposely applied to the inner render func and not to the wrapping Box ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No! Updated.

@@ -32,19 +32,21 @@ export const receiveLocale = (event, locale) => dispatch => {

export const initLocale = () => async (dispatch, getState) => {
Copy link
Member

Choose a reason for hiding this comment

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

async can go looks like

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, setLocale is an async method so I've updated this to await it.

const userCurrency = state.settings.fiatTicker
if (userCurrency) {
dispatch(setFiatTicker(userCurrency))
const currentConfig = settingsSelectors.currentConfig(state)
Copy link
Member

Choose a reason for hiding this comment

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

Here too

Copy link
Member Author

Choose a reason for hiding this comment

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

Same here. Added missing await

@@ -150,6 +137,8 @@ const tickerSelectors = {}

tickerSelectors.currency = currencySelector
tickerSelectors.tickerLoading = tickerLoadingSelector
tickerSelectors.fiatTicker = fiatTickerSelector
tickerSelectors.fiatTickers = fiatTickersSelector
Copy link
Member

Choose a reason for hiding this comment

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

Ideally i'd like to have this named differently. LIke fiatTicker and allFilatTicker or fiatTickerList

Copy link
Member Author

Choose a reason for hiding this comment

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

The ticker reducer is exceptionally bad in terms of its naming and this issue of pluralised vs singular is a recurring one throughout our code codebase. I know this has come up several times and I have given the same response every time - but I really don't want to get into renaming things as part of this PR.

We need to do a wider cleanup of all of our reducers and standardize a bunch of things like this.

@@ -0,0 +1,10 @@
const renameKeys = (keysMap, obj) =>
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a desc please and/or some basic tests in order to know how to use this

Copy link
Member Author

Choose a reason for hiding this comment

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

This method was actually never used in the end so I have removed it completely

* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
const difference = (object, base) => {
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, some tests would be great for this kind of utils, as they may be tricky sometimes

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a few basic tests for this.

@mrfelton mrfelton changed the base branch from feat/settings to next May 21, 2019 18:13
@mrfelton mrfelton changed the base branch from next to feat/settings May 21, 2019 18:13
Copy link
Member

@korhaliv korhaliv left a comment

Choose a reason for hiding this comment

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

Tested ACK 38a5650

@mrfelton mrfelton merged commit c1c4f20 into LN-Zap:feat/settings May 21, 2019
@mrfelton mrfelton deleted the feat/1535-settings-page branch May 21, 2019 19:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants