-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fixes #263 - Added fetching and rendering of data from the backend to the frontend #346
Conversation
Added the fetching of posts from frontend Made small CSS changes to fix some rendered elements Templated <article> tag for rendering
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.
So we reviewed your PR in class today and we love what you're doing but agreed that it's way too big for just one PR, this can be broken up into smaller PR's (someone suggested dividing it up into 2 seperate PR's one for fetching and another for rendering). We found a few areas that will be problematic as well
I also think everything in |
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 have a lot of JS in index.html. This could all be written in a different file and imported in the html file.
src/frontend/index.html
Outdated
|
||
let close = document.querySelector('#mobile-burger-close'); | ||
<script> | ||
$(() => { |
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.
JavaScript in .js
files please.
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.
Moved to main.js, would appreciate any resources on how to keep code in the front end in modular files as I was struggling with that
Thanks for the feedback @cindyledev @miggs125 @humphd its greatly appreciated! Will be putting up a new commit in the coming days addressing the issues brought up. In regards to having the Javascript in separate files, I had all the code separated into modular files initially (UI tools in one, fetching in another, etc.) but was getting a lot of eslint errors where it was picking up variables as unused between files because they weren't really linked anywhere other than the <script> tags in the HTML. Wasn't able to fix that so would it be alright to have everything in one (separate) .js file for now and maybe have someone file an issue / PR to make things more modular and correctly integrated or adjust eslint settings in the future? |
So, I've got a commit waiting and ready to go with all the fixes specified including dropping the CSS changes. I previously added these to address UX / UI issues that arose when I added dummy data to better represent typical posts. The following is a screenshot of a mobile view with the proposed changes: As you can see this will greatly impact the way that posts are rendered. @humphd @miggs125 @cindyledev I think everything else that was mentioned has been fixed and will put up the PR when I hear back regarding the CSS changes. Thanks again for taking the time to look things over! |
@lucacataldo the discussions of splitting this up aren't aimed at having you throw changes away; rather, we're trying to improve the reviewability of the work, and isolate changes to their own PRs. Doing the fixes to CSS is important, and we need that. But the question is: do we need it in the same PR as one which adds data fetching? If it's not possible for you to separate these, then please go ahead and do it all at once. But in future, I want all of us to try and think about how to keep our changes simple, focused on doing only 1 thing, and making it easier for them to get reviewed, tested, and merged. |
@humphd totally understandable and it was a mistake on my part to go down the rabbit hole so to speak. Will definitely keep this in mind in the future. As for now, I am going to give it a shot to minimize the amount of CSS added in this PR and file a new issue for the other smaller fixes. |
Review Changes 1
caught up with upstream
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, I really like that you moved a lot of the scripts in the index.html
file to it's own JS file! I'll be keeping an eye on your #366 for the css improvements so lemme know when the PR for that is up :)
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.
One issue to clear up, the rest looks ready to go.
package.json
Outdated
"jest-watch":"cross-env MOCK_REDIS=1 jest --watch", | ||
"start": "node src", | ||
"jest-watch": "cross-env MOCK_REDIS=1 jest --watch", | ||
"start": "node src/backend", |
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.
None of these files should be changed in your branch as far as I can tell. We've had people overwrite these already in the past few days, I'm not eager to repeat it. If I'm wrong and you do need these to be updated, let me know why.
acd9f91
to
85a65f2
Compare
@lucacataldo see my work in #426, which takes what you have here, and connects it into the new backend we just merged. You could use that to update your code in this PR. |
deleted dummy data since we're hooked into the backend now reverted accidental changes to package.json (i think)
Closing and continuing in my other PR with new changes added. |
Added the fetching & rendering of posts in frontend. This includes fetching post & participant data using jQuery (currently dummy data in src/frontend/dummy_data), and rendering it using a templated
element. I picked some posts from the current planet that included elements I though would bring up some edge cases and adjusted CSS accordingly so that when this gets hooked into the actual routes it'll be a bit less garbled and legible. Also, since pagination.js dialogue.js are no longer relevant or being used, I removed them.