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

dashboard.jsx: Add environment REPOSITORIES #81

Merged
merged 1 commit into from Jul 25, 2018

Conversation

li-boxuan
Copy link
Member

Closes #3

@@ -12,12 +12,24 @@ import CurrentUserStore from '../user-store';
import AsyncButton from './async-button';
import Time from './time';

const SAMPLE_REPOS = [
let SAMPLE_REPOS = [
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to change this to let since you still could do push. Also, uppercase words in a variable name must be use const.

@@ -304,7 +316,6 @@ class ExamplesPanel extends Component {
{' Example Boards of GitHub Repositories'}
</span>
);

Copy link
Member

Choose a reason for hiding this comment

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

Give a new line space for readability.

{repoOwner: 'huboard', repoName: 'huboard'},
{repoOwner: 'openstax', repoNames: ['tutor-js', 'tutor-server'], comment: ' (multiple repositories)'},
{repoOwner: 'jquery', repoName: 'jquery'}
];

try {
const repos = REPOSITORIES;
if (repos) {
Copy link
Member

Choose a reason for hiding this comment

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

Use double negation characters !!repos to convert it to a boolean. This is much safer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, It makes code harder to read and understand, and it is not used anywhere in the original project.

Copy link
Member

Choose a reason for hiding this comment

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

Well, if you are fine with it then ok.

});
};
} catch (error) {
console.log('warning:', error);
Copy link
Member

Choose a reason for hiding this comment

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

Give a single whitespace after warning:.

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't that done by console.log automatically?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, you were right. I just see it passed on the second parameter.

Copy link
Member

Choose a reason for hiding this comment

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

console.warn to get colored output.

@wisn
Copy link
Member

wisn commented Jul 22, 2018

@jayvdb ready to be merged. Who the one that responsible for this repo, someone with write access that good in JavaScript?

@gitmate-bot
Copy link

Sorry @wisn, you do not have the necessary permission levels to perform the action.

@jayvdb jayvdb requested review from blazeu and andrewda July 23, 2018 01:55
SAMPLE_REPOS.push({
repoOwner, repoNames
});
};
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary semicolon

@@ -18,6 +18,18 @@ const SAMPLE_REPOS = [
{repoOwner: 'jquery', repoName: 'jquery'}
];

try {
Copy link
Member

Choose a reason for hiding this comment

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

What causes this code to require a try/catch?

Copy link
Member Author

Choose a reason for hiding this comment

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

When not in production mode, REPOSITORIES will be undefined, leading to an exception.

Maybe I should change that logic a bit in webpack.config.js?

Copy link
Member

Choose a reason for hiding this comment

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

You have all your code wrapped in an if statement, though, so none of the code will be run if REPOSITORIES is undefined, right?

Copy link
Member

@blazeu blazeu Jul 23, 2018

Choose a reason for hiding this comment

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

Check for the type instead, typeof REPOSITORIES !== 'undefined'

const repoOwner = repos.split(':')[0];
const repoNames = repos.substring(repos.indexOf(':') + 1).split('|');
SAMPLE_REPOS.push({
repoOwner, repoNames
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add comment: ' (from prefetch config)'
or comment: ' (repositories config)' hmm..

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

Copy link
Member

Choose a reason for hiding this comment

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

err, i mean comment property :p

see the original SAMPLE_REPOS

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 :p

@li-boxuan li-boxuan force-pushed the fix_routing branch 2 times, most recently from 3344c76 to bafa12b Compare July 24, 2018 14:19
@jayvdb
Copy link
Member

jayvdb commented Jul 25, 2018

ack 892b87f

@jayvdb
Copy link
Member

jayvdb commented Jul 25, 2018

@gitmate-bot ff

@gitmate-bot
Copy link

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently ⚠️

@gitmate-bot gitmate-bot merged commit 892b87f into coala:master Jul 25, 2018
@gitmate-bot
Copy link

Automated fastforward with GitMate.io was successful! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

6 participants