From 049185ec49bb894e6ad5eb7dbff88cf5720d4418 Mon Sep 17 00:00:00 2001 From: Kirill Date: Wed, 19 Jun 2024 14:10:46 +0500 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D1=89=D0=B8=D1=82=D0=B0=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/presenter/board-presenter.js | 14 ++++++++------ src/presenter/point-presenter.js | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/presenter/board-presenter.js b/src/presenter/board-presenter.js index e94a75c..565d353 100644 --- a/src/presenter/board-presenter.js +++ b/src/presenter/board-presenter.js @@ -3,10 +3,9 @@ import EventListView from '../view/event-list-view.js'; import SortView from '../view/sort-view.js'; import PointPresenter from './point-presenter.js'; import TripInfoView from '../view/trip-info-view.js'; -import {sortPointDay, sortPointPrice, sortPointTime} from '../utils.js'; +import {sortPointDay, sortPointPrice, sortPointTime, filter, sort} from '../utils.js'; import {FilterType, SortType, UpdateType, UserAction, TimeLimit} from '../const.js'; import FilterPresenter from '../presenter/filter-presenter.js'; -import { filter, sort} from '../utils.js'; import NewPointPresenter from '../presenter/new-point-presenter.js'; import MessageView from '../view/message-view.js'; import UiBlocker from '../framework/ui-blocker/ui-blocker.js'; @@ -30,7 +29,6 @@ export default class BoardPresenter { #newPointButtonPresenter = null; #currentSortType = SortType.DAY; - #isCreating = false; #sortComponent = null; #tripInfoComponent = null; @@ -44,6 +42,7 @@ export default class BoardPresenter { upperLimit: TimeLimit.UPPER_LIMIT }); + #isCreating = false; #isLoading = false; constructor({tripContainer, destinationsModel, @@ -130,10 +129,10 @@ export default class BoardPresenter { #renderFilters = () => { this.#filterPresenter = new FilterPresenter( this.#tripFliterElement, - this.#filterModel + this.#filterModel, ); - this.#filterPresenter .init(); + this.#filterPresenter.init(); }; #renderMessage = () => { @@ -179,7 +178,9 @@ export default class BoardPresenter { this.#renderLoading(); return; } - this.#renderTripInfo(); + if (this.points.length) { + this.#renderTripInfo(); + } this.#renderSort(); this.#renderPoints(); }; @@ -189,6 +190,7 @@ export default class BoardPresenter { remove(this.#messageComponent); remove(this.#sortComponent); remove(this.#tripInfoComponent); + this.#sortComponent = null; if (resetSortType) { diff --git a/src/presenter/point-presenter.js b/src/presenter/point-presenter.js index c0baeb9..e29617a 100644 --- a/src/presenter/point-presenter.js +++ b/src/presenter/point-presenter.js @@ -73,6 +73,7 @@ export default class PointPresenter { destroy = () => { remove(this.#pointComponent); remove(this.#pointEditComponent); + document.removeEventListener('keydown', this.#escKeyDownHandler); }; setSaving = () => {