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

Fixes #263 - Added fetching and rendering of data from the backend to the frontend #346

Closed
wants to merge 7 commits into from

Conversation

lucacataldo
Copy link
Contributor

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.

Added the fetching of posts from frontend
Made small CSS changes to fix some rendered elements
Templated <article> tag for rendering
Copy link
Contributor

@cindyorangis cindyorangis left a 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

  1. In participants.json, the urls there are not valid, they should be https://google.ca
  2. In posts.json, the guids should not be "null", something like 123 would be better than "null"
  3. These lines
    Annotation 2019-11-26 135138
    in index.html just disappeared and we don't know where they went or why they were deleted/replaced

@cindyorangis
Copy link
Contributor

I also think everything in main.css can be a separate PR by itself as well

@miggs125 miggs125 self-requested a review November 27, 2019 02:05
Copy link
Contributor

@miggs125 miggs125 left a 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/dummy_data/participants.json Outdated Show resolved Hide resolved
src/frontend/dummy_data/posts.json Outdated Show resolved Hide resolved
src/frontend/dummy_data/posts.json Outdated Show resolved Hide resolved
src/frontend/dummy_data/posts.json Outdated Show resolved Hide resolved
src/frontend/index.html Outdated Show resolved Hide resolved
src/frontend/index.html Outdated Show resolved Hide resolved

let close = document.querySelector('#mobile-burger-close');
<script>
$(() => {
Copy link
Contributor

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.

Copy link
Contributor Author

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

src/frontend/style/main.css Outdated Show resolved Hide resolved
@lucacataldo
Copy link
Contributor Author

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?

@lucacataldo
Copy link
Contributor Author

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:

image

As you can see this will greatly impact the way that posts are rendered.

@humphd @miggs125 @cindyledev
I'll leave it up to you guys as to whether or not to include them or not since I can personally see valid arguments for both including and not including them. 🤷‍♂

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!

@humphd
Copy link
Contributor

humphd commented Nov 28, 2019

@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.

@lucacataldo
Copy link
Contributor Author

@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.

@lucacataldo
Copy link
Contributor Author

@cindyledev @humphd @miggs125 changes have been pushed, have a look and let me know if there's anything that's still outstanding!

cindyorangis
cindyorangis previously approved these changes Nov 28, 2019
Copy link
Contributor

@cindyorangis cindyorangis left a 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 :)

Copy link
Contributor

@humphd humphd left a 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",
Copy link
Contributor

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.

@humphd
Copy link
Contributor

humphd commented Dec 3, 2019

@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.

humphd added a commit to humphd/telescope that referenced this pull request Dec 3, 2019
deleted dummy data since we're hooked into the backend now
reverted accidental changes to package.json (i think)
humphd added a commit to humphd/telescope that referenced this pull request Dec 5, 2019
@humphd
Copy link
Contributor

humphd commented Dec 5, 2019

Closing and continuing in my other PR with new changes added.

@humphd humphd closed this Dec 5, 2019
humphd added a commit that referenced this pull request Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants