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

Stevie's frontend challenge (incomplete) #119

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

S-Spiegl
Copy link

@S-Spiegl S-Spiegl commented Jun 6, 2022

No description provided.

@@ -0,0 +1,167 @@
(() => {
Copy link

Choose a reason for hiding this comment

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

I believe is good practice to .gitignore this file to avoid conflicts if working in a team. This file will anyway be autogenerated when running 'npm run build' locally

Comment on lines +20 to +23
setChits(chits) {
this.reset();
chits.forEach((chit) => this.chits.push(`${chit.user.handle}: ${chit.body}`));
}
Copy link

Choose a reason for hiding this comment

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

It might be easier to store everything that comes from the server into the chits array (including body, user, time, likes,...) and then, when displaying what you want to display, select what you want. In that case, this method could have just been something like this.chits = chits

@@ -0,0 +1,61 @@
class ChitterView {
Copy link

Choose a reason for hiding this comment

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

View methods are well explained and should work for using the page locally. It is missing the API interface

Comment on lines +25 to +27
document.querySelectorAll('.chit').forEach(chit => {
chit.remove();
});
Copy link

Choose a reason for hiding this comment

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

As a refactor suggestion, this could have been a separate method

Comment on lines +29 to +32
const chitEl = document.createElement('div')
chitEl.innerText = chit
chitEl.className = 'chit';
this.maincontainerEl.append(chitEl);
Copy link

Choose a reason for hiding this comment

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

Also separate this in a different method could look nice

@@ -0,0 +1,33 @@
class ChitterModel {
Copy link

Choose a reason for hiding this comment

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

Good. I think the model does what it is suppose to do and names are clear enough to be understood from someone who didn't write the code

headers: {
"Content-Type": 'application/json'
},
body: (`{"user": {"handle":"${username}", "password":"${password}"}}`)
Copy link
Author

Choose a reason for hiding this comment

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

doesn't need stringify because I've already added all the quotes to turn things into strings

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.

None yet

2 participants