Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splash page #131

Merged
merged 11 commits into from
Jun 28, 2017
Merged

Splash page #131

merged 11 commits into from
Jun 28, 2017

Conversation

manatarms
Copy link
Contributor

  • This PR adds a new splash page and corresponding tests
  • Upgrades yarn deps and adds new eslint rules
  • Fixes eslint errors

@jwineman
Copy link
Contributor

@thellimist I told @manatarms to make the other changes around package.json etc.

@jwineman jwineman requested review from thellimist and jwineman June 20, 2017 17:08
@@ -0,0 +1,73 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Matches www-next

* @param {string} integrationName - Will append channel depending on integration name.
*/

export function generateChannelLink(pageURL, integrationName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Talk to Garrett and see if we can rework the channel values so they can be generated dynamically. I want to avoid hard coding channel values so we don't have to modify code to add new ones.

: <LayoutRow>{this.props.children}</LayoutRow>}
<LayoutRow>
<LayoutColumn width={1 / 1}>
<p style={{ textAlign: 'center' }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of <p> we can use <Text>

Copy link
Contributor

@thellimist thellimist Jun 20, 2017

Choose a reason for hiding this comment

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

There are a few more places where <p> or <a> is used rather than the component. @jwineman is it worth to change every time someone uses non cf-ui elements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not a 100% sure but I think the Text component might get deprecated. So I didn't want to introduce it as a dep.

Copy link
Contributor

Choose a reason for hiding this comment

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

<Text> isn't deprecated, please use it here.

Copy link
Contributor Author

@manatarms manatarms Jun 20, 2017

Choose a reason for hiding this comment

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

Coolios. There's also a bunch of <p> tags on Login, should I switch those out too

Copy link
Contributor

Choose a reason for hiding this comment

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

We probably did that to inject those styles, if you can inject those styles without <p> great, if its a lot of work don't worry about it.

src/routes.js Outdated
@@ -9,6 +9,7 @@ import App from './containers/App/App';
import DNSManagementPage
from './containers/DNSManagementPage/DNSManagementPage';
import Login from './containers/LoginPage/LoginPage';
import Splash from './containers/SplashPage/SplashPage';
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be import SplashPage and import LoginPage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should totally be that.

break;
default:
channelName = '';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

generateChannelLink("url.com", "somethingisnotright") returns "url.com?channel="

It would be better to not generate the channel if it's going to be ''. But I think it may be better to put something there. It may allows us figure if something is wrong or if someone else has built there own custom integration using this code. Both are fine information I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you thinking of an error param if someone tries to append a channel directly?

Copy link
Contributor

@thellimist thellimist Jun 20, 2017

Choose a reason for hiding this comment

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

John mentioned allowing to make this dynamic which makes a lot of sense. If we the code stays like this for some reason, I'd suggest something like "Cloudflare Plugin Frontend". Talk to Garrett for this

'component.benefitsFeature.security.description': 'Cloudflare offers protections against vulnerabilities including DDoS protection.',
'component.benefitsFeature.insights.title': 'Insights',
'component.benefitsFeature.insights.description': 'Monitor bandwidth saved, threats blocked, and more with built-in analytics.'
};
Copy link
Contributor

@thellimist thellimist Jun 20, 2017

Choose a reason for hiding this comment

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

If we need to change the language, the tests will fail adding additional complexity. I'd suggest to import en.js rather than coping the translations

Copy link
Contributor

Choose a reason for hiding this comment

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

Tests should mock translations, not use them directly. We aren't testing the specific translations, we're testing that given the correct keys it uses their values.

Copy link
Contributor

Choose a reason for hiding this comment

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

@manatarms I think this and svg are the only things left.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup spoke to Eric, he'll give me the svgs. I'll merge after that.

Copy link
Contributor

Choose a reason for hiding this comment

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

@manatarms from my experience exporting svg's from Sketch worked the best. When I got them exported from Adobe Illustrator the format was not transferable into React component's. You can look in cf-ux/cf-component-signup/Security how we did the migration.

Copy link
Contributor

@thellimist thellimist Jun 28, 2017

Choose a reason for hiding this comment

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

I'm not sure what frontend best practices for tests are but I think this could cause confusion later on. It may be better to make it clear that these are mock values. Ignore me if I think incorrectly

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree mock values are better but this is a test so its probably safe to assume that even if the data looks real it is mocked.

expect(generateChannelLink('htttp://www.example.com', 'cpanel')).toBe(
'htttp://www.example.com?channel=Integration:%20CPanel'
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add magento and default cases here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do it once I change talk with Garrett about the channel names

Copy link
Contributor

Choose a reason for hiding this comment

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

We only need to test

generateChannelLink('htttp://www.example.com', 'something')
generateChannelLink('htttp://www.example.com', '')
generateChannelLink('htttp://www.example.com')

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. Some of these tests were from the switch case. Will change

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 the tests make sense because it tests for params and also we're returning specific things based on the integration. I think removing the magento and someNewChannel test makes sense but the rest should stay.

@sejoker
Copy link
Contributor

sejoker commented Jun 22, 2017

I recommend using svg format for icons instead of png.

@jwineman
Copy link
Contributor

@sejoker Good call. @manatarms worked with Eric to get those assets in SVG, he'll update the PR next week.

@manatarms
Copy link
Contributor Author

Okay this looks good to go! Would appreciate a final look.

@sejoker sejoker self-requested a review June 28, 2017 10:28
@@ -59,16 +59,20 @@ class SplashPage extends Component {
render() {
const { config } = this.props;

const integrationName = getConfigValue(config, 'integrationName');
const integrationNameCapital =
integrationName.charAt(0).toUpperCase() + integrationName.slice(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a small detail but this will produce Wordpress rather than WordPress. Check if Garrett is OK with it.

@manatarms manatarms merged commit b4b4c72 into master Jun 28, 2017
@manatarms manatarms deleted the splash-page branch June 28, 2017 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants