Skip to content

Commit

Permalink
Merge pull request #4 from licos87/module2-task1
Browse files Browse the repository at this point in the history
Шаблонизируй это
  • Loading branch information
AlSudar authored Sep 25, 2024
2 parents fc1805e + 1e6a88a commit e8b67d2
Show file tree
Hide file tree
Showing 17 changed files with 1,049 additions and 187 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
},
"engines": {
"node": "20"
},
"dependencies": {
"dayjs": "1.11.7"
}
}
4 changes: 4 additions & 0 deletions src/const.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const EVENT_TYPES = ['taxi', 'bus', 'train', 'ship', 'drive', 'flight', 'check-in', 'sightseeing', 'restaurant'];


export {EVENT_TYPES};
18 changes: 15 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
import {RenderPosition, render} from './render.js';
import ListPresenter from './presenter/list-presenter.js';
import SectionTripInfoView from './view/section-trip-info-view.js';
import NewEventButtonView from './view/new-event-button-view.js';
import TripFiltersFormView from './view/trip-filters-form-view.js';
import ListPresenter from './presenter/list-presenter.js';
import PointsTripModel from './model/points-trip-model.js';
import OffersTripsModel from './model/offers-trip-model.js';
import DestinationsTripModel from './model/destinations-trip-model.js';


const tripMain = document.querySelector('.trip-main');
const tripEventsElement = document.querySelector('.trip-events');
const tripControlsFilters = document.querySelector('.trip-controls__filters');
const pointsTripModel = new PointsTripModel();
pointsTripModel.init();
const offersTripModel = new OffersTripsModel();
offersTripModel.init();
const destinationsTripModel = new DestinationsTripModel();
destinationsTripModel.init();

render(new SectionTripInfoView(), tripMain, RenderPosition.AFTERBEGIN); // Заголовок, даты, общая цена
render(new NewEventButtonView(), tripMain); // Заголовок, кнопка добавить событие
render (new TripFiltersFormView(), tripControlsFilters); // Кнопки сортировки


const listPresenter = new ListPresenter({
listContainer: tripEventsElement
listContainer: tripEventsElement,
pointsTripModel,
destinationsTripModel,
offersTripModel,
});

listPresenter.init();


110 changes: 110 additions & 0 deletions src/mock/destinations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
const destinations = [
{
'id': 'f81cb09d-8504-4e61-99ea-5e2169a418d3',
'description': 'Paris - a true asian pearl',
'name': 'Paris',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/11.jpg',
'description': 'Paris full of of cozy canteens where you can try the best coffee in the Middle East'
}
]
},
{
'id': '75ae5832-8468-4c17-b2b6-1eec4dbeae36',
'description': 'Chamonix - with a beautiful old town',
'name': 'Chamonix',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/3.jpg',
'description': 'Chamonix famous for its crowded street markets with the best street food in Asia'
}
]
},
{
'id': 'e75d5a88-4377-406a-baf8-866561a7f580',
'description': 'Nagasaki - in a middle of Europe',
'name': 'Nagasaki',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/18.jpg',
'description': 'Nagasaki is a beautiful city'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/4.jpg',
'description': 'Nagasaki in a middle of Europe'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/4.jpg',
'description': 'Nagasaki middle-eastern paradise'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/10.jpg',
'description': 'Nagasaki is a beautiful city'
}
]
},
{
'id': '1bdc7e0a-17d6-411e-8ed9-ba413fd7860a',
'description': 'Geneva - a perfect place to stay with a family',
'name': 'Geneva',
'pictures': []
},
{
'id': 'e2225dee-32a6-4ede-865b-d42f35aa30a2',
'description': 'Rome - with an embankment of a mighty river as a centre of attraction',
'name': 'Rome',
'pictures': []
},
{
'id': '0a26a247-2fc5-45fb-a874-ed85317e3053',
'description': '',
'name': 'Den Haag',
'pictures': []
},
{
'id': '9aa8c921-d6b9-459b-8604-03c18f7dfc28',
'description': 'Berlin - with a beautiful old town',
'name': 'Berlin',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/11.jpg',
'description': 'Berlin middle-eastern paradise'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/7.jpg',
'description': 'Berlin with a beautiful old town'
}
]
},
{
'id': '46b14717-91f4-47d5-b540-86d6a523ba69',
'description': '',
'name': 'Monaco',
'pictures': []
},
{
'id': '55666483-8a52-42fb-adc3-c68bdcfecd0f',
'description': 'Venice - with an embankment of a mighty river as a centre of attraction',
'name': 'Venice',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/14.jpg',
'description': 'Venice famous for its crowded street markets with the best street food in Asia'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/18.jpg',
'description': 'Venice with crowded streets'
}
]
},
{
'id': 'a7f070d6-1b56-4c9b-975f-61078a860de1',
'description': '',
'name': 'Frankfurt',
'pictures': []
}
];


export {destinations};
208 changes: 208 additions & 0 deletions src/mock/offers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
const offers = [
{
'type': 'taxi',
'offers': [
{
'id': 'ddc71da3-2662-41b4-88a3-2e4e70810c94',
'title': 'Upgrade to a business class',
'price': 76
},
{
'id': 'e5f2a8f0-b788-4538-9562-ba819bc5e110',
'title': 'Choose the radio station',
'price': 126
},
{
'id': '8af68438-bce3-4ff6-9781-9112a1f40915',
'title': 'Choose temperature',
'price': 199
},
{
'id': '9afaec64-fda7-4e90-ab77-d03281cf1fe3',
'title': 'Drive quickly, I\'m in a hurry',
'price': 64
},
{
'id': '713c26fb-1371-4fc7-9052-346633947f6d',
'title': 'Drive slowly',
'price': 153
}
]
},
{
'type': 'bus',
'offers': [
{
'id': '85602e4e-f4c8-4e9b-b049-303c30e2fd55',
'title': 'Infotainment system',
'price': 71
},
{
'id': '2e962c34-b507-45ff-b435-853c760699c0',
'title': 'Order meal',
'price': 187
},
{
'id': 'ab581f38-7a20-4c3a-83cf-2b7a79c2c538',
'title': 'Choose seats',
'price': 51
}
]
},
{
'type': 'train',
'offers': [
{
'id': '3f5a6dc0-3b8b-4ab2-a3ad-24cfb2c870b8',
'title': 'Book a taxi at the arrival point',
'price': 178
},
{
'id': '547aa918-5a19-4afa-8577-e279b9952824',
'title': 'Order a breakfast',
'price': 124
},
{
'id': '0359f6f0-9ec1-4be7-8edf-e731b233c3f1',
'title': 'Wake up at a certain time',
'price': 132
}
]
},
{
'type': 'flight',
'offers': [
{
'id': 'bcde7424-e148-47ea-a2d7-4b76e4b82535',
'title': 'Choose meal',
'price': 107
},
{
'id': 'e24d9ced-27d8-4af9-b424-319b350df937',
'title': 'Choose seats',
'price': 143
},
{
'id': '6a4657b0-e00d-4aef-85c8-eaf1889297f7',
'title': 'Upgrade to comfort class',
'price': 108
},
{
'id': 'c892c024-89b9-41f8-bfbc-9f16eeff7aab',
'title': 'Upgrade to business class',
'price': 177
},
{
'id': 'efac3f93-f9f4-4b11-becf-c81924e79e41',
'title': 'Add luggage',
'price': 184
},
{
'id': '70c534d5-5f42-4973-a5b2-0f8330c04ba8',
'title': 'Business lounge',
'price': 194
}
]
},
{
'type': 'check-in',
'offers': [
{
'id': '06e49025-cb13-40f1-b908-d407e40e7a03',
'title': 'Choose the time of check-in',
'price': 70
},
{
'id': '1eca0013-44d6-4f60-913b-be3cc92a451f',
'title': 'Choose the time of check-out',
'price': 187
},
{
'id': '83f3d48c-cb3f-44e5-80b4-a674920ba8c6',
'title': 'Add breakfast',
'price': 134
},
{
'id': 'ecf2e614-0070-48d4-99ce-ab895b5910b4',
'title': 'Laundry',
'price': 200
},
{
'id': '714695ba-92a5-423c-9bc7-c42827d83fe2',
'title': 'Order a meal from the restaurant',
'price': 196
}
]
},
{
'type': 'sightseeing',
'offers': []
},
{
'type': 'ship',
'offers': [
{
'id': '6337930e-7d99-4805-bf0c-1dc902817817',
'title': 'Choose meal',
'price': 169
},
{
'id': '41de9a8d-9e00-4ec1-b4ba-327841c21df7',
'title': 'Choose seats',
'price': 84
},
{
'id': '75db0a2b-75d3-4f38-ac08-7a77058182b8',
'title': 'Upgrade to comfort class',
'price': 179
},
{
'id': '8223d0e3-7121-4287-aef2-f3600dd6961c',
'title': 'Upgrade to business class',
'price': 177
},
{
'id': 'f2664b0c-3574-446d-9a30-f7c1093f92b7',
'title': 'Add luggage',
'price': 39
},
{
'id': 'b3560210-a2ee-4637-af88-f134eef531bf',
'title': 'Business lounge',
'price': 163
}
]
},
{
'type': 'drive',
'offers': [
{
'id': '04ac19c4-ff17-4a5f-a946-0843f5958daa',
'title': 'With automatic transmission',
'price': 80
},
{
'id': '02b51d1e-e704-4b0b-b884-7d560704ca45',
'title': 'With air conditioning',
'price': 52
}
]
},
{
'type': 'restaurant',
'offers': [
{
'id': 'dca55199-afd4-4ae7-87c6-d47826ee1d73',
'title': 'Choose live music',
'price': 141
},
{
'id': 'c5b65695-7818-47e0-bd47-c52edb15d383',
'title': 'Choose VIP area',
'price': 68
}
]
}
];

export {offers};
Loading

0 comments on commit e8b67d2

Please sign in to comment.