Skip to content

Commit

Permalink
Merge pull request #4 from daniildevpro/module2-task1
Browse files Browse the repository at this point in the history
  • Loading branch information
keksobot authored Dec 25, 2024
2 parents bc37ae9 + d0d8676 commit 319f710
Show file tree
Hide file tree
Showing 23 changed files with 1,467 additions and 540 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.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"engines": {
"node": "20"
},
"dependencies": {
"dayjs": "1.11.7"
}
}
}
8 changes: 1 addition & 7 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="ru">

<head>
<meta charset="UTF-8">
Expand All @@ -19,21 +19,15 @@
<div class="trip-main__trip-controls trip-controls">
<div class="trip-controls__filters">
<h2 class="visually-hidden">Filter events</h2>
<!-- Фильтры -->
</div>
</div>
<!-- Кнопка создать новую точку маршрута (event) -->
</div>
</div>
</header>
<main class="page-body__page-main page-main">
<div class="page-body__container">
<section class="trip-events">
<h2 class="visually-hidden">Trip events</h2>

<!-- Сортировка -->

<!-- Контент -->
</section>
</div>
</main>
Expand Down
17 changes: 17 additions & 0 deletions src/const.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const POINT_COUNT = 3;


const FormatDate = {
DATE_TIME: 'YYYY-MM-DD',
DATE_POINT: 'MMM D',
DATE_SCHEDULE: 'HH:mm',
DATE_SLASHED: 'YY/MM/DD'
};

const MillisecondsInValue = {
MILLISECONDS_IN_HOUR: 1000 * 60 * 60,
MILLISECONDS_IN_DAY: 1000 * 60 * 60 * 24,
};


export { POINT_COUNT, FormatDate, MillisecondsInValue };
27 changes: 22 additions & 5 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
import FilterView from './view/filter-view.js';
import NewEventButtonView from './view/new-event-button-view.js';
import NewPointButtonView from './view/new-point-button-view.js';
import BoardPresenter from './presenter/board-presenter.js';
import PointsModel from './model/points-model.js';
import { getRandomPoint } from './mock/points.js';
import { destinations } from './mock/destinations.js';
import { offers } from './mock/offers.js';
import { POINT_COUNT } from './const.js';
import { render } from './render.js';
import EventListPresenter from './presenter/event-list-presenter.js';


const siteTripMainElement = document.querySelector('.trip-main');
const siteFiltersElement = siteTripMainElement.querySelector('.trip-controls__filters');
const siteTripEventsElement = document.querySelector('.trip-events');

const eventsListPresenter = new EventListPresenter(siteTripEventsElement);

const pointsModel = new PointsModel({
points: Array.from({ length: POINT_COUNT }, getRandomPoint),
destinations: destinations,
offers: offers
});


const boardPresenter = new BoardPresenter({
pointListContainer: siteTripEventsElement,
pointsModel,
});


render(new FilterView(), siteFiltersElement);
render(new NewEventButtonView(), siteTripMainElement);
render(new NewPointButtonView(), siteTripMainElement);

eventsListPresenter.init();

boardPresenter.init();
165 changes: 165 additions & 0 deletions src/mock/destinations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
export const destinations = [
{
'id': '2d1ec240-1e78-4183-b27e-7023f2ce9320',
'description': 'Kioto - famous for its crowded street markets with the best street food in Asia',
'name': 'Kioto',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/5.jpg',
'description': 'Kioto is a beautiful city'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/10.jpg',
'description': 'Kioto with an embankment of a mighty river as a centre of attraction'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/10.jpg',
'description': 'Kioto full of of cozy canteens where you can try the best coffee in the Middle East'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/20.jpg',
'description': 'Kioto in a middle of Europe'
}
]
},
{
'id': '496bf9c6-7644-4068-baa0-8b1577df8854',
'description': 'Amsterdam - middle-eastern paradise',
'name': 'Amsterdam',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/13.jpg',
'description': 'Amsterdam for those who value comfort and coziness'
}
]
},
{
'id': '97ba1bc6-b161-4015-b0a5-e1f31a3b972d',
'description': 'Venice - a true asian pearl',
'name': 'Venice',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/10.jpg',
'description': 'Venice famous for its crowded street markets with the best street food in Asia'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/12.jpg',
'description': 'Venice a true asian pearl'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/6.jpg',
'description': 'Venice in a middle of Europe'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/16.jpg',
'description': 'Venice in a middle of Europe'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/11.jpg',
'description': 'Venice a true asian pearl'
}
]
},
{
'id': '9bbe4200-020c-4f3c-9640-81648421f209',
'description': 'Berlin - famous for its crowded street markets with the best street food in Asia',
'name': 'Berlin',
'pictures': []
},
{
'id': 'c8eab9ce-c072-4114-9412-76f8023ba638',
'description': 'Helsinki - middle-eastern paradise',
'name': 'Helsinki',
'pictures': []
},
{
'id': '7d2cc347-4428-45cb-b406-ef07ed787acc',
'description': 'Sochi - with crowded streets',
'name': 'Sochi',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/3.jpg',
'description': 'Sochi with an embankment of a mighty river as a centre of attraction'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/18.jpg',
'description': 'Sochi a true asian pearl'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/13.jpg',
'description': 'Sochi a true asian pearl'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/9.jpg',
'description': 'Sochi with crowded streets'
}
]
},
{
'id': '21a059e3-af4a-4881-a3cc-40a381484c44',
'description': '',
'name': 'Vien',
'pictures': []
},
{
'id': '124c439f-1764-4bd2-917e-50973a77f227',
'description': 'Chamonix - a true asian pearl',
'name': 'Chamonix',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/11.jpg',
'description': 'Chamonix a perfect place to stay with a family'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/2.jpg',
'description': 'Chamonix famous for its crowded street markets with the best street food in Asia'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/19.jpg',
'description': 'Chamonix full of of cozy canteens where you can try the best coffee in the Middle East'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/19.jpg',
'description': 'Chamonix in a middle of Europe'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/4.jpg',
'description': 'Chamonix famous for its crowded street markets with the best street food in Asia'
}
]
},
{
'id': '53b6b366-1de8-447a-93ae-e71dc7d59aa7',
'description': 'Rome - with a beautiful old town',
'name': 'Rome',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/17.jpg',
'description': 'Rome with a beautiful old town'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/18.jpg',
'description': 'Rome in a middle of Europe'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/5.jpg',
'description': 'Rome for those who value comfort and coziness'
},
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/8.jpg',
'description': 'Rome with crowded streets'
}
]
},
{
'id': '1b17f449-8447-46a0-934e-fc54af3dd4ca',
'description': 'Oslo - with an embankment of a mighty river as a centre of attraction',
'name': 'Oslo',
'pictures': [
{
'src': 'https://22.objects.htmlacademy.pro/static/destinations/19.jpg',
'description': 'Oslo is a beautiful city'
}
]
}
];
Loading

0 comments on commit 319f710

Please sign in to comment.