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

Implement routing for modals - Closes #554 #750

Merged
merged 30 commits into from
Sep 26, 2017
Merged

Conversation

reyraa
Copy link
Contributor

@reyraa reyraa commented Sep 18, 2017

  • Defines routing for dialogs
  • Creates Relativelink component
  • Edits dialog component to work independently from its callees.
  • replaces all buttons which trigger action to open a dialog with a relative link to the corresponding route

Closes #554
Closes #553

@reyraa reyraa force-pushed the 554-routing-for-modals branch from 79bed75 to 0924d89 Compare September 19, 2017 10:12
@reyraa reyraa force-pushed the 554-routing-for-modals branch from 59145e7 to 66bd091 Compare September 21, 2017 14:10
@@ -32,6 +32,7 @@
"bitcore-mnemonic": "=1.1.1",
"copy-to-clipboard": "=3.0.6",
"flexboxgrid": "=6.3.1",
"history": "^4.7.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use = instead of ^.
We should set up this in .npmrc file like lisk-js guys did LiskArchive/lisk-elements#382

Copy link
Contributor Author

@reyraa reyraa Sep 25, 2017

Choose a reason for hiding this comment

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

TBH, I never liked this approach, choosing = we easily end up with outdated dependencies. if there's a breaking change in one of the dependencies, I prefer to get notified of somehow. that's exactly the reason I clean install my node modules every once in a while.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure it's a good idea, but please don't tell me to add it in this PR :-D

And I select option no. 3 from "network" select
When I fill in "http://localhost:4000" to "address" field
When I fill in "wagon stock borrow episode laundry kitten salute link globe zero feed marble" to "passphrase" field
And I click "login button"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these changes are not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

<I18nextProvider i18n={ i18n }>
<HeaderHOC />
</I18nextProvider>
</I18nextProvider></Router>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer <Router> on its own line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

});
}
// eslint-disable-next-line class-methods-use-this
getPassphraseValidationError(passphrase) {
Copy link
Contributor

Choose a reason for hiding this comment

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

functionality inside getPassphraseValidationError was moved to PassphraseInput component. Here it's reintroduced from a merging.

{getTabs(isDelegate).map((tab, index) =>
<Tab
key={index}
label={t(tab)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling t(tab) doesn't allow i18n-scanner to find tab names for the source*.json file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

break;
default:
type = false;
break;
}
const address = props.address !== props.senderId ? props.senderId : props.recipientId;
const template = type ?
<span className={sytles.smallButton}>{type}</span> :
<ClickToSend recipient={address} className='from-to' >
<span className={styles.smallButton}>{t(type)}</span> :
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling t(type) doesn't allow i18n-scanner to find type names for the source *.json file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -2,16 +2,17 @@ export const getSavedAccount = () => {
const savedAccounts = localStorage.getItem('accounts');
let account;
if (savedAccounts) {
account = JSON.parse(savedAccounts)[0];
account = JSON.parse(savedAccounts);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see why [0] was removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we aim to have multiple accounts there, I've implement the reducer to handle multiple. So I always should receive an array, even so currently the utility returns only one item.
There are also other problems with this utility which I found it irrelevant to this PR so I didn't touch.

Copy link
Contributor

Choose a reason for hiding this comment

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

then account should be accounts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a ticket to fix many other issues about this utility.

if (primary !== undefined) style += `${buttonStyle.primary} `;
if (disableWhenOffline !== undefined) style += `${offlineStyle.disableWhenOffline} `;
if (style !== '') style += ` ${buttonStyle.button}`;

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that https://github.com/JedWatson/classnames is better solution for dynamic classnames

Copy link
Contributor Author

@reyraa reyraa Sep 26, 2017

Choose a reason for hiding this comment

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

Seems a neat way to go, since we use string literal everywhere in the project, it's worth creating a ticket if we plan to use this.

const index = networksRaw.map((item, i) => {
return (item.name === network) ? i : null;
}).filter(item => item !== null)[0];
accountSaved({
Copy link
Contributor

Choose a reason for hiding this comment

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

.find(item => item ! == null); will return first element that not equal null

switch (action.type) {
case actionTypes.accountSaved:
store.dispatch(successToastDisplayed({ label: 'Account saved' }));
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

why not use return instead of break in the switch case? It will look more compact.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a ticket to fix many other issues about this utility.

@reyraa reyraa merged commit 0c8a733 into development Sep 26, 2017
@reyraa reyraa deleted the 554-routing-for-modals branch September 26, 2017 07:28
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.

3 participants