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

правки #19

Merged
merged 2 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions src/const.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,3 @@
// export const TYPES = ['taxi', 'bus', 'train', 'ship', 'drive', 'flight', 'check-in', 'sightseeing', 'restaurant'];

// export const OFFERS = [
// 'Add luggage',
// 'Switch to comfort class',
// 'Add meal',
// 'Choose seats',
// 'Add a child safety seat'
// ];

// export const CITIES = ['Magnolia', 'Greed Island', 'Soul Society', 'Amestris', 'Death City', 'Karakura', 'Z-City', 'Alubarna', 'Aincrad'];

// export const DESCRIPTIONS = [
// 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
// 'Maecenas dapibus sed enim in ultrices.',
// 'Praesent non ex turpis.',
// 'Nunc mollis sed tortor a faucibus.',
// 'Morbi ac convallis erat, vel volutpat nisl.',
// 'Phasellus a interdum lacus. Aenean consectetur magna vel diam fringilla, at commodo sem placerat.',
// 'Etiam a pellentesque massa.',
// 'Sed sed nisi sed augue convallis suscipit in sed felis.',
// 'Aliquam erat volutpat.'
// ];

// export const Duration = {
// MIN: 60,
// HOUR: 10,
// DAY: 3
// };

// export const DateFormat = {
// LONG: 'YYYY-MM-DDTHH:mm',
// SHORT: 'MMM DD'
// };

// export const Price = {
// MIN: 0,
// MAX: 1000
// };

// export const MILLISECONDS_IN_DAY = 86400000;

// export const MILLISECONDS_IN_HOUR = 3600000;

// export const Mode = {
// DEFAULT: 'DEFAULT',
// EDITING: 'EDITING'
// };

// export const UserAction = {
// UPDATE_POINT: 'UPDATE_POINT',
// ADD_POINT: 'ADD_POINT',
// DELETE_POINT: 'DELETE_POINT'
// };

// export const UpdateType = {
// PATCH: 'PATCH',
// MAJOR: 'MAJOR',
// INIT: 'INIT'
// };

// export const POINT_COUNT_PER_STEP = 7;

// export const ApiServiceMethod = {
// GET: 'GET',
// PUT: 'PUT',
// POST: 'POST',
// DELETE: 'DELETE'
// };

// export const TimeLimit = {
// LOWER_LIMIT: 350,
// UPPER_LIMIT: 1000,
// };
export const TYPES = ['taxi', 'bus', 'train', 'ship', 'drive', 'flight', 'check-in', 'sightseeing', 'restaurant'];

export const FilterType = {
Expand Down
2 changes: 1 addition & 1 deletion src/model/point-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class PointModel extends Observable{
const points = await this.#pointsApiService.points;
this.#points = points.map(this.#adaptToClient);
} catch (error){
this.#points = null;
this.#points = [];
}
this._notify(UpdateType.INIT);
}
Expand Down
1 change: 0 additions & 1 deletion src/presenter/point-presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export default class PointPresenter{
UserAction.UPDATE_POINT,
UpdateType.MINOR,
update);
// this.#editPointComponent.reset(update);
};

#handleDeleteClick = (point) => {
Expand Down
3 changes: 2 additions & 1 deletion src/presenter/trip-presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TripPresenter {
this.#filtersModel = filtersModel;

this.#newPointPresenter = new NewPointPresenter({
pointListContainer: this.#container,
pointListContainer: this.#component.element,
onFavoriteChange: this.#handleViewAction,
onDestroy: onNewPointDestroy,
destinationsModel: this.#destinationsModel,
Expand Down Expand Up @@ -75,6 +75,7 @@ class TripPresenter {
createPoint() {
this.#currentSortType = SortType.DEFAULT;
this.#filtersModel.setFilter(UpdateType.MAJOR, FilterType.EVERYTHING);
render(this.#component, this.#container);
this.#newPointPresenter.init();
}

Expand Down
9 changes: 8 additions & 1 deletion src/view/edit-point-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,14 @@ export default class EditingPointView extends AbstractStatefulView{

#changeDestinationHandler = (event) => {
event.preventDefault();
const destination = this.#destinations.find((dest) => dest.name === event.target.value);
const inputDestinationName = event.target.value;
const destination = this.#destinations.find((dest) => dest.name === inputDestinationName);

if (!destination) {
event.target.value = this._state.destination.name;
return;
}

this.updateElement({
destination: destination.id,
});
Expand Down
133 changes: 0 additions & 133 deletions src/view/new-point-view.js

This file was deleted.

Loading