-
Notifications
You must be signed in to change notification settings - Fork 21
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
Splash page #131
Conversation
manatarms
commented
Jun 20, 2017
- This PR adds a new splash page and corresponding tests
- Upgrades yarn deps and adds new eslint rules
- Fixes eslint errors
@thellimist I told @manatarms to make the other changes around |
@@ -0,0 +1,73 @@ | |||
{ |
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.
Matches www-next
* @param {string} integrationName - Will append channel depending on integration name. | ||
*/ | ||
|
||
export function generateChannelLink(pageURL, integrationName) { |
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.
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' }}> |
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.
instead of <p>
we can use <Text>
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 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?
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.
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.
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.
<Text>
isn't deprecated, please use it here.
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.
Coolios. There's also a bunch of <p>
tags on Login, should I switch those out too
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.
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'; |
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 this be import SplashPage
and import LoginPage
?
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.
It should totally be that.
src/selectors/generateChannelLink.js
Outdated
break; | ||
default: | ||
channelName = ''; | ||
} |
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.
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.
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.
Are you thinking of an error param if someone tries to append a channel directly?
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.
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.' | ||
}; |
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.
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
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.
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.
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.
@manatarms I think this and svg are the only things left.
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.
Yup spoke to Eric, he'll give me the svgs. I'll merge after that.
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.
@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.
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.
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
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.
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' | ||
); | ||
}); |
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.
could you add magento and default cases here?
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.
I'll do it once I change talk with Garrett about the channel names
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.
We only need to test
generateChannelLink('htttp://www.example.com', 'something')
generateChannelLink('htttp://www.example.com', '')
generateChannelLink('htttp://www.example.com')
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.
Sure. Some of these tests were from the switch case. Will change
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.
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.
I recommend using svg format for icons instead of png. |
@sejoker Good call. @manatarms worked with Eric to get those assets in SVG, he'll update the PR next week. |
Okay this looks good to go! Would appreciate a final look. |
@@ -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); |
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.
It's a small detail but this will produce Wordpress
rather than WordPress
. Check if Garrett is OK with it.