-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
# Conflicts: # js/src/ui/Icons/index.js
# Conflicts: # js/src/modals/CreateAccount/NewAccount/newAccount.js # js/src/modals/CreateAccount/NewImport/newImport.js # js/src/modals/CreateAccount/RawKey/rawKey.js # js/src/modals/CreateAccount/RecoveryPhrase/recoveryPhrase.js # js/src/modals/CreateAccount/createAccount.js
Changes Unknown when pulling 7ecae24 on jg-dev-features into ** on master**. |
import React, { Component, PropTypes } from 'react'; | ||
|
||
import defaults, { MODES } from './defaults'; | ||
import Store from './store'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really related to this PR, but I always wondered why we had [module].css
, [module].js
files, but always (almost) store.js
file ? Seems a bit inconsistent no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When used internally to the module is it just "THE store". When accesses extrenally, we do it via ui/Features/store
so the intent is 100% clear. IMHO option having featureStore
doesn't add much if any value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what about having styles.css
in ui/Features
that would contain the Component style ? It would be "THE style" of the Component. I think it solves the issue when you have multiple tabs open with all the same names (even if the path is added in some editors). One way or the other is fine, it just seems a bit strange
const onCheck = () => feature.mode === MODES.DEVELOPMENT && this.store.toggleActive(key); | ||
|
||
return ( | ||
<ListItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to have separate methods for rendering each item.
|
||
export default class Features extends Component { | ||
static propTypes = { | ||
visible: PropTypes.bool.isRequired |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this prop be passed ? I would thought it could be read from the local storage so we could have access to it even in Production, no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. will take a look.
leftCheckbox={ | ||
<Checkbox | ||
checked={ this.store.active[key] } | ||
disabled={ feature.mode === MODES.TESTING } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand the utility of these checkboxes. Aren't they supposed to toggle which features are shown ? Currently they are disabled in DEV mode. Anyhow I think it would be good to have these available in any environment. (would be hidden in PROD of course)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends, think it is a bit misleading though -
- DEVELOPMENT - it is toggle-able, but off by default - can develop and test without affecting dev mode
- TESTING - it is enabled by default, but off for production (in this cse you are probably right, should still be selectable)
- PRODUCTION - cannot be switched off, has gone live
{ this.renderModes() } | ||
<LanguageSelector /> | ||
<Features /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks a bit strange, right in the middle between two features : language and logs. Would be better on top or on bottom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checkboxes won't toggle (I think it's because an @observer
is missing), and it seems that the values written to localStorage gets overwritten on load of the Features component.
} | ||
|
||
@action setActiveFeatures = (features = {}, isProduction) => { | ||
this.active = Object.assign({}, features, this.getDefaultActive(isProduction)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the defaults be first, not to overwrite the passed features
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was method to the madness, what it was I don't recall - it has been a bit too long between writing this. Tested specifically for this behaviour -
ui/Features/Store @action setActiveFeatures overrides with defaults:
However, now that dev mode is toggle-able, it would make sense to do it the other way around.
import Store from './store'; | ||
import styles from './features.css'; | ||
|
||
export default class Features extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an @observer
here
Feature selector for development mode -