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

JSAB2-75 Leaderboard #16

Merged
merged 18 commits into from
Dec 11, 2019
Merged

JSAB2-75 Leaderboard #16

merged 18 commits into from
Dec 11, 2019

Conversation

GuJialu
Copy link
Collaborator

@GuJialu GuJialu commented Dec 10, 2019

No description provided.

@HanqingZ
Copy link
Collaborator

Suggestion: add scrollView to leaderboard part. So no matter the size of the screen, user can still check all 10 first players

@GuJialu GuJialu changed the title JSAB2-75, Leaderboard JSAB2-75 Leaderboard Dec 10, 2019

function Leaderboard() {
return (
<>
Copy link
Collaborator

@HanqingZ HanqingZ Dec 11, 2019

Choose a reason for hiding this comment

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

Maybe we can use instead of <> ---> Just advice

},
});

function RowTopTen({
Copy link
Contributor

Choose a reason for hiding this comment

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

RowTopTen is not a lucky name, it's not fixed that we want to render the first 10 users, it can change. The component has nothing to do with how many do we want to render. Now we only render 3 of them. Please rename it to something more general.

function Leaderboard() {
return (
<ScrollView>
<RowTopTen rank={1} username="fdas" gold={20} crown={10} />
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't hardcode ranking, username, gold, and crown (which should be kingdoms, or amountOfGold and amountOfKingdoms)

create a mocked user list which contains users with the amount of gold, and kingdoms, and map through that array

(crown is just the icon, it represents the amount of kingdoms)

you don't have to deal with the logic of sorting, you can create an already sorted mocked list and just map through it.
ranking (1,2,3,4,...) should not be hardcoded, calculate it somehow please

Suggested change
<RowTopTen rank={1} username="fdas" gold={20} crown={10} />
// add something like this with a few users and map through it
let users = [
{
username: 'user1',
gold: 100,
kingdoms: 1
},
{
username: 'user2',
gold: 200,
kingdoms: 2
},
{
username: 'user with a very long username',
gold: 300,
kingdoms: 3
},
]

<View style={styles.rowFlex}>
<Text style={styles.text}>{rank}</Text>
<Image style={styles.userAvatar} source={userAvatar} />
<Text style={styles.text}>{username}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

if the username is too long, the amount of gold won't be seen. Please fix this. For this you'll need to change on the styling just a little bit, give the text a width, and because of this you can't use the text styling for all of the texts here.
Handling too long text is really easy in React Native, it's only adding one attribute to the Text:) let me know if you need help

</View>
<View style={styles.userInfo}>
<Image source={crownIcon} style={styles.icon} />
<Text style={styles.text}>{crown}</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<Text style={styles.text}>{crown}</Text>
<Text style={styles.text}>{kingdom}</Text>

});

function RowTopTen({
rank, username, gold, crown,
Copy link
Contributor

Choose a reason for hiding this comment

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

crown is the icon name, but it represents the kingdom, please rename

Copy link
Contributor

Choose a reason for hiding this comment

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

@GuJialu naming --> amountOfGold, amountOfKingdoms, or something similar

Copy link
Contributor

@evasimonyi evasimonyi left a comment

Choose a reason for hiding this comment

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

almost perfect! :)

frontend/src/Leaderboard/index.jsx Outdated Show resolved Hide resolved
frontend/src/Leaderboard/RankRow.jsx Outdated Show resolved Hide resolved
frontend/src/Leaderboard/RankRow.jsx Outdated Show resolved Hide resolved
frontend/src/Leaderboard/index.jsx Outdated Show resolved Hide resolved
frontend/src/Leaderboard/index.jsx Outdated Show resolved Hide resolved
GuJialu and others added 3 commits December 11, 2019 17:01
Co-Authored-By: evasimonyi <30794349+evasimonyi@users.noreply.github.com>
Co-Authored-By: evasimonyi <30794349+evasimonyi@users.noreply.github.com>
frontend/src/Leaderboard/RankRow.jsx Outdated Show resolved Hide resolved
frontend/src/Leaderboard/RankRow.jsx Outdated Show resolved Hide resolved
GuJialu and others added 2 commits December 11, 2019 17:44
Co-Authored-By: evasimonyi <30794349+evasimonyi@users.noreply.github.com>
Co-Authored-By: evasimonyi <30794349+evasimonyi@users.noreply.github.com>
@evasimonyi evasimonyi merged commit 8ff2c06 into development Dec 11, 2019
@evasimonyi evasimonyi deleted the JSAB2-75-leaderboard branch December 11, 2019 09:47
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.

5 participants