Skip to content

Conversation

@ivan-escribano
Copy link

No description provided.

function getDataComments(postId) {
const containerComments = document.getElementById("commentsContainer");
containerComments.textContent = "";
const commentsURL = `http://localhost:3000/comments`;

Choose a reason for hiding this comment

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

Create const variable on top --> More reusable code

Copy link

@RogerOliveDelgado RogerOliveDelgado left a comment

Choose a reason for hiding this comment

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

Great Job!

@@ -0,0 +1,611 @@
//!GENERAL VARIABLES

Choose a reason for hiding this comment

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

Well structured in functions, will be a good idea to refactor code in more files

postContainer.scrollTop + postContainer.clientHeight >=
postContainer.scrollHeight
) {
createSkeleton(4);

Choose a reason for hiding this comment

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

Don't kill me please. Will be fine to declare 4 as a variable, to avoid magic number

let idPost = post.id;
let imagePost = getImagesSplash(99);
removeSkeleton();
createHTMLpostSection(imagePost, titlePost, usernamePost, idPost);

Choose a reason for hiding this comment

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

Love function name, super clear :)

divsCarousel[0].classList.add("active");
}

async function createHTMLsliderSection(image, title, id) {

Choose a reason for hiding this comment

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

Should it work without async? There is no promise inside function.

carouselContent.append(div);
}

async function createHTMLpostSection(image, title, username, id) {

Choose a reason for hiding this comment

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

Same. Should async be written?

//!GET IMAGE FROM UNSPLASH SOURCE
function getImagesSplash(index) {
const randomNumber = randomIndex(index);
const srcImages = `https://source.unsplash.com/16${randomNumber}x9${randomNumber}/`;

Choose a reason for hiding this comment

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

Should be a good idea to define URL on top, to have a more maintainable code

}

async function fetchToServerPosts(id, info = true) {
const urlPost = `http://localhost:3000/posts/${id}`;

Choose a reason for hiding this comment

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

URL on top. Should this function be async? Not returning a value. I write a question, because we are not sure about it

// const result = await responseDELETE.text();
return false;
} catch (error) {
console.log(error);

Choose a reason for hiding this comment

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

We have used console.error(error), but we don't know what should be a better practice

@@ -0,0 +1,611 @@
//!GENERAL VARIABLES

Choose a reason for hiding this comment

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

GREAT JOB GUYS!!
25

@@ -0,0 +1,115 @@
@import url("https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Libre+Baskerville:wght@700&display=swap");

Choose a reason for hiding this comment

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

Great Job!!
6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants