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

Шаблонизируй это #4

Merged
merged 10 commits into from
Sep 19, 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
8 changes: 8 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 @@ -29,5 +29,8 @@
},
"engines": {
"node": "20"
},
"dependencies": {
"dayjs": "1.11.13"
}
}
24 changes: 24 additions & 0 deletions src/consts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const TIME_FORMAT = {
fullDateAndTime: 'DD/MM/YY HH:mm',
eventDate: 'MMM DD',
fullEventDate: 'YYYY-MM-DD',
eventTime: 'HH:mm',

};

const EVENT_TYPES = [
'taxi',
'bus',
'train',
'ship',
'drive',
'flight',
'check-in',
'sightseeing',
'restaurant'
];

const HOURS = 24;
const MINUTES = 60;

export {TIME_FORMAT, HOURS, MINUTES, EVENT_TYPES};
12 changes: 11 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import FiltersPresenter from './presenter/filters-presenter.js';
import EventsPresenter from './presenter/events-presenter.js';

import PointsModel from './model/points-model.js';
import DestinationsModel from './model/destinations-model.js';
import OffersModel from './model/offers-model.js';

const tripFiltersElement = document.querySelector(
'.trip-controls__filters');
const tripEventsElement = document.querySelector('.trip-events');


const filtersPresenter = new FiltersPresenter({
filtersContainer: tripFiltersElement,
});

const pointsModel = new PointsModel();
const destinationsModel = new DestinationsModel();
const offersModel = new OffersModel();

const eventsPresenter = new EventsPresenter({
eventsContainer: tripEventsElement,
pointsModel,
destinationsModel,
offersModel,
});

filtersPresenter.init();
Expand Down
150 changes: 150 additions & 0 deletions src/mock/destinations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
const mockDestinations = [
{
'id': 'ffa2d954-9e4d-4011-9c01-15b9578e8b14',
'description': 'Berlin - for those who value comfort and coziness',
'name': 'Berlin',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/2.jpg',
'description': 'Berlin for those who value comfort and coziness'
}
]
},
{
'id': '45f6cfaa-fbfc-4739-81f1-bbb923b0ca14',
'description': 'Valencia - for those who value comfort and coziness',
'name': 'Valencia',
'pictures': []
},
{
'id': 'fd27cea8-68aa-4b69-af55-6c0c0f01ea85',
'description': 'Geneva - famous for its crowded street markets with the best street food in Asia',
'name': 'Geneva',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/18.jpg',
'description': 'Geneva for those who value comfort and coziness'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/1.jpg',
'description': 'Geneva a true asian pearl'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/16.jpg',
'description': 'Geneva with an embankment of a mighty river as a centre of attraction'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/12.jpg',
'description': 'Geneva with crowded streets'
}
]
},
{
'id': 'eb033765-70a2-42c1-958e-8b9fca444110',
'description': '',
'name': 'Paris',
'pictures': []
},
{
'id': '4ca13167-832f-4620-9d1a-30d4044f4155',
'description': '',
'name': 'Barcelona',
'pictures': []
},
{
'id': '16bb8a7c-21c2-4cac-8392-fa9dd3916520',
'description': 'Helsinki - is a beautiful city',
'name': 'Helsinki',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/18.jpg',
'description': 'Helsinki in a middle of Europe'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/7.jpg',
'description': 'Helsinki is a beautiful city'
}
]
},
{
'id': '5fcf3b8e-5e47-4926-b4ab-fdae235aa85b',
'description': 'Saint Petersburg - in a middle of Europe',
'name': 'Saint Petersburg',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/8.jpg',
'description': 'Saint Petersburg middle-eastern paradise'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/12.jpg',
'description': 'Saint Petersburg famous for its crowded street markets with the best street food in Asia'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/17.jpg',
'description': 'Saint Petersburg a perfect place to stay with a family'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/4.jpg',
'description': 'Saint Petersburg middle-eastern paradise'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/19.jpg',
'description': 'Saint Petersburg full of of cozy canteens where you can try the best coffee in the Middle East'
}
]
},
{
'id': '5831d9de-0326-43a4-bd3c-12535883b5d1',
'description': 'Moscow - a true asian pearl',
'name': 'Moscow',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/4.jpg',
'description': 'Moscow in a middle of Europe'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/16.jpg',
'description': 'Moscow in a middle of Europe'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/2.jpg',
'description': 'Moscow middle-eastern paradise'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/10.jpg',
'description': 'Moscow is a beautiful city'
}
]
},
{
'id': 'ba8045d8-94da-4c45-a198-a8b9e22c9d3a',
'description': 'Madrid - a true asian pearl',
'name': 'Madrid',
'pictures': []
},
{
'id': '40b34cdf-7007-4c5d-8583-f2f643d5f815',
'description': 'Rotterdam - full of of cozy canteens where you can try the best coffee in the Middle East',
'name': 'Rotterdam',
'pictures': [
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/8.jpg',
'description': 'Rotterdam is a beautiful city'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/14.jpg',
'description': 'Rotterdam famous for its crowded street markets with the best street food in Asia'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/6.jpg',
'description': 'Rotterdam with an embankment of a mighty river as a centre of attraction'
},
{
'src': 'https://24.objects.htmlacademy.pro/static/destinations/4.jpg',
'description': 'Rotterdam in a middle of Europe'
}
]
}
];

export {mockDestinations};
Loading
Loading