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

Peer to Peer Review #4

Open
3 tasks
RiyaBulia12 opened this issue Sep 2, 2022 · 0 comments
Open
3 tasks

Peer to Peer Review #4

RiyaBulia12 opened this issue Sep 2, 2022 · 0 comments

Comments

@RiyaBulia12
Copy link

Hello @fullstop125 👋 ,

Congratulations! Good job so far! 🎉 I know you've been very diligent and committed to implementing this project, and we, as a team, appreciate your effort! But there are some issues that you still need to work on in this project but you are almost there!

so-close

Suggested Changes ♻️

  • Right now the hosted gh-pages are not updated. Please update the dist folder so anyone can see your amazing working project :)
  • Its considered as a good UI if you give a message in case of error. How about adding some user-friendly messages when user try to add empty fields to the leaderboard table.
  • Also its a good practice to stick to the DRY approach. Following are 2 changes we found that can be improved:
  1. remove .value from the getElementID (on line 12 & 13) and use .value, variables name for the elements wherever needed
    const userName = document.getElementById('user-name').value;
    const userScore = document.getElementById('user-score').value;
    const data = {
    user: userName,
    score: userScore,
    };
    addScore(data);
    document.getElementById('user-name').value = '';
    document.getElementById('user-score').value = '';
  2. you can remove the URL and id and declare it globally and use it accordingly
    'https://us-central1-js-capstone-backend.cloudfunctions.net/api/games/X4mL8Vzhgd1d2gWBxpQW/scores',
    );
    const { result } = await response.json();
    let string = '';
    result.map((score) => {
    string += ` <tr><td class="scores"> ${score.user}</td>
    <td class="scores">${score.score}</td> </tr>
    `;
    return score;
    });
    scores.innerHTML = string;
    };
    const addScore = async (score) => {
    await fetch(
    'https://us-central1-js-capstone-backend.cloudfunctions.net/api/games/X4mL8Vzhgd1d2gWBxpQW/scores',
    {

Cheers and Happy coding!👏👏👏 💻

Please feel free to reach out or leave any questions or comments on the issue if you find anything unclear

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

No branches or pull requests

1 participant