Open
Conversation
scripts/main.js
Outdated
| const hashtags = e.target.value; | ||
| const pattern = /^#([A-Za-z0-9_-]+)$/; | ||
|
|
||
| if (pattern.test(hashtags) && hashtags.length <= 200) { |
scripts/main.js
Outdated
|
|
||
| if (pattern.test(postTextValue) && postTextValue.length <= count) { | ||
| textValidate.textContent = 'Данные введены корректно'; | ||
| const sumsCounter = count - Number(postTextValue.length); |
There was a problem hiding this comment.
postTextValue.length и так число
scripts/main.js
Outdated
| const textLength = e.target.value.length; | ||
| const postTextValue = e.target.value; | ||
| const pattern = /^([A-Za-z0-9_-]+)$/; | ||
| const count = 2000; |
There was a problem hiding this comment.
Это константа, а они пишутся капсом
scripts/main.js
Outdated
| } else if (postTextValue === '') { | ||
| textValidate.textContent = 'Поле обязательно для заполнения'; | ||
| postPublishButton.disabled = true; | ||
| } else if (postTextValue.length === 2000) { |
There was a problem hiding this comment.
Нужно вынести в константу и сослаться на нее
scripts/main.js
Outdated
| textValidate.textContent = 'Поле обязательно для заполнения'; | ||
| postPublishButton.disabled = true; | ||
| } else if (postTextValue.length === 2000) { | ||
| const sumsCounter = count - Number(postTextValue.length); |
scripts/utils.js
Outdated
|
|
||
| const timer = setTimeout(() => { | ||
| clonMessage.remove(); | ||
| }, 2000); |
scripts/utils.js
Outdated
| const timer = setTimeout(() => { | ||
| clonMessage.remove(); | ||
| }, 2000); | ||
| return timer |
There was a problem hiding this comment.
Ты возвращаешь значение, но нигде не используешь его. Нужно ли возвращать?
scripts/utils.js
Outdated
|
|
||
| export const createElement = (content) => { | ||
| const {image, text, tags, created_at, likes, comments, id} = content; | ||
| const randomAvatar = `https://avatars.dicebear.com/api/avataaars/${(Math.random() + 1)}.svg`; |
scripts/utils.js
Outdated
| const newDateComments = dateCommnents.toLocaleDateString("ru", optionsComments); | ||
|
|
||
| const commentsItem = document.createElement('div'); | ||
| commentsItem.className = 'comments__item'; |
There was a problem hiding this comment.
Определись, ты либо используешь classList, либо className
scripts/utils.js
Outdated
| .finally(() => { | ||
| closePreviewPostModal(); | ||
| }) | ||
| return response |
There was a problem hiding this comment.
Возвращаемое значение не используется
scripts/utils.js
Outdated
| } | ||
| }) | ||
| .catch(() => showMessage(messageFail, 'Ошибка', 'Повторите попытку снова')) | ||
| return response |
| photoCount.textContent = data.length; | ||
| photosContent.innerHTML = ''; | ||
| data.forEach((content) => { | ||
| const elementHTML = createElement(content); |
There was a problem hiding this comment.
Множественная вставка в DOM без фрагмента
|
|
||
| const toggleLoader = () => { | ||
| const loader = document.querySelector('#loader'); | ||
| loader.classList.remove('hidden'); |
There was a problem hiding this comment.
Зачем сначала убирать класс hidden и тут же его добавлять? Прямо сразу же
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.