-
Notifications
You must be signed in to change notification settings - Fork 793
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
feat(starred-count): show starred count #271
feat(starred-count): show starred count #271
Conversation
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.
Quick look at the code seems good! Thanks so much!
src/api/index.js
Outdated
const ENDPOINT = `https://api.github.com/users/${owner}/starred?per_page=1`; | ||
|
||
const requestPromise = new Promise((resolve, reject) => { | ||
const req = new XMLHttpRequest(); |
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.
You can use fetch
instead, quick example:
fetch('https://api.github.com/users/lex111/starred?per_page=1').then(function (response) {
console.log(response.headers.get('Link'));
});
{starCount} | ||
</Text> | ||
<Text style={styles.unitText}> | ||
{translate('common.star', language)} |
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 is better to use the plural (stars
), by analogy with other (repositories
, followers
).
src/locale/languages/fr.js
Outdated
@@ -288,6 +288,7 @@ export const fr = { | |||
}, | |||
common: { | |||
bio: 'BIO', | |||
star: 'étoiles', |
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 look at the key starsTitle
, then the stars are translated as "favoris".
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.
yes, it should be favoris. Merci beaucoup Mr @lex111 !
src/locale/languages/nl.js
Outdated
@@ -282,6 +284,7 @@ export const nl = { | |||
}, | |||
common: { | |||
bio: 'BIO', | |||
star: 'Sterren', |
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.
And here it will be simple - Stars
(again, if look at the key starsTitle
)
5ab1671 reduce the left and right margin of the badge in |
src/user/user.type.js
Outdated
@@ -8,3 +8,4 @@ export const GET_FOLLOWERS = createActionSet('GET_FOLLOWERS'); | |||
export const GET_FOLLOWING = createActionSet('GET_FOLLOWING'); | |||
export const SEARCH_USER_REPOS = createActionSet('SEARCH_USER_REPOS'); | |||
export const CHANGE_FOLLOW_STATUS = createActionSet('CHANGE_FOLLOW_STATUS'); | |||
export const GET_STAR_COUNT = createActionSet('CHANGE_FOLLOW_STATUS'); |
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.
Must be GET_STAR_COUNT
case GET_STAR_COUNT.PENDING: | ||
return { | ||
...state, | ||
starCount: ' ', |
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.
Probably it is possible to remove, after all in initialStore
already there is this key?
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.
@lex111 I have decided to remove it from initialStore
, and only add to it when GET_STAR_COUNT.PENDING
and GET_AUTH_STAR_COUNT.PENDING
are respectively dispatched.
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.
Well, I would still put it in initialStore
, and then it could only be added to GET_STAR_COUNT.SUCCESS
, but I'm ok.
src/locale/languages/nl.js
Outdated
@@ -282,6 +284,7 @@ export const nl = { | |||
}, | |||
common: { | |||
bio: 'BIO', | |||
stars: 'Stars', |
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.
Dutch should be: 'Sterren'
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.
Thanks for your help! Will change the translation
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 good! I added as a comment the dutch translation for 'stars'.
Overall this looks so solid :O :O Thanks so much @adrianhartanto0, there are literally just the few things @RolfKoenders and @lex111 noticed that I can see will need changing but otherwise this should be solid to merge 🎉 |
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.
Thanks a bunch @adrianhartanto0 🎉 🎉 🎉
This is to close #129. I followed the suggestion made by @RolfKoenders, and used
XMLHttpRequest
instead offetch
to retrieve the star count.I have also included a dutch and french translation for the "star" word using Google translate. @RolfKoenders @machour, could you please verify that the translated word is correct?