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

Final project #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Final project #81

wants to merge 1 commit into from

Conversation

Paris22
Copy link

@Paris22 Paris22 commented Nov 17, 2022

No description provided.

@@ -1,74 +1,113 @@
import fetchJson from '../../utils/fetch-json.js';

const BACKEND_URL = process.env.BACKEND_URL;
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍 лайк за использование переменных окружения

this.label = label;
this.link = link;
this.value = value;
this.formatHeading = formatHeading;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good

@@ -0,0 +1,123 @@
export default class DoubleSlider {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good лайк за DubleSlider

}

get leftPercents() {
return (((this.selected.from - this.min) / this.width) * 100).toFixed(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍

}

get rightPercents() {
return (((this.max - this.selected.to) / this.width) * 100).toFixed(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍

to.textContent = this.formatValue(this.selected.to);
}

unsubscribe() {
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍

this.updateView();
};

destroy() {
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍

@@ -0,0 +1,50 @@
export default class NotificationMessage {
static NotificationObj;
Copy link
Contributor

Choose a reason for hiding this comment

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

с маленькой буквы должно быть имя

this.element = wrapper.firstElementChild;
}

show(targetElement = document.body) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good

import escapeHtml from '../../utils/escape-html.js';
import fetchJson from '../../utils/fetch-json.js';

const IMGUR_CLIENT_ID = process.env.IMGUR_CLIENT_ID;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good лайк за использование переменных окружения

}
const escTitle = escapeHtml(catTitle.join(' > '));
catTitle.pop();
return `<option value="${value.id}">${escTitle}</option>`;
Copy link
Contributor

Choose a reason for hiding this comment

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

обратите внимание на использование конструктора new Option

catTitle.push(value.title);
if (value.subcategories) {
const subCatOptionsText = this.getCategoryOptionsTemplate(value.subcategories, catTitle);
catTitle.pop();
Copy link
Contributor

Choose a reason for hiding this comment

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

очень аккуратно с методом pop можете смутировать catTitle и нанести вред другим частям программы

},
body: JSON.stringify(product)
this.subElements.productForm.addEventListener('submit', this.submitForm);
this.subElements.productForm.elements['uploadImage'].addEventListener('click', event => {
Copy link
Contributor

Choose a reason for hiding this comment

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

а почему обращение через квадратные скобки?

this.getImgItemText(newImgItem)
);
} catch (error) {
new NotificationMessage(`${error}`, {
Copy link
Contributor

Choose a reason for hiding this comment

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

лучше использовать error.message

createImagesList() {
const {imageListContainer} = this.subElements;
const {images} = this.formData;
fillFormData(data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

задайте значение по умолчанию, это упростит проверку

remove() {
this.element.remove();
async render() {
let categories, data;
Copy link
Contributor

Choose a reason for hiding this comment

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

🔴 please don't do this
пожалуйста, на каждую переменную свое ключевое слово

let categories, data;
if (this.productId) {
this.urlProd.searchParams.set('id', this.productId);
[categories, data] = await Promise.all([fetchJson(this.urlCat), fetchJson(this.urlProd)]);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good

itemElem.remove();
getIndexOfList(node) {
let index = 0;
for (const iterator of node.parentElement.children) {
Copy link
Contributor

Choose a reason for hiding this comment

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

пожалуйста не привязывайтесь к children

@@ -1,14 +1,14 @@
import fetchJson from "../../utils/fetch-json.js";

const BACKEND_URL = 'https://course-js.javascript.ru';
const BACKEND_URL = process.env.BACKEND_URL;
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍


sortListChange = event => {

const subcategoryList = [...event.target.children];
Copy link
Contributor

Choose a reason for hiding this comment

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

не привязывайтесь к children
лучше сделайте явный поиск по какому-то селектору

this.subElements.categoriesContainer.append(this.getCategoryElement(item));
});
} catch (error) {

Copy link
Contributor

Choose a reason for hiding this comment

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

а как же обработка ошибки?
throw тогда в некуда отработает


return this.element;
destroy() {
for (const component of Object.values(this.components)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good

subElements = {};
usedComponents = {};

get template() {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good

range: {createdAt_gte: createdAt_gte, createdAt_lte: createdAt_lte}
});

this.subElements['rangePickerContainer'].append(this.usedComponents.rangePicker.element);
Copy link
Contributor

Choose a reason for hiding this comment

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

почему обращение через квадратные скобки, а не через точку?

@@ -4,7 +4,7 @@ export default async function(path, match) {
main.classList.add('is-loading');

const { default: Page } = await import(/* webpackChunkName: "[request]" */`../pages/${path}/index.js`);
const page = new Page();
const page = new Page(match);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 good

components = {};

constructor([,match] = []) {
this.productId = match;
Copy link
Contributor

Choose a reason for hiding this comment

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

good 👍

Copy link
Contributor

@dosandk dosandk left a comment

Choose a reason for hiding this comment

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

good 👍
неплохая работа, посмотрите пожалуйста комменты

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.

2 participants