diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c2421de0..44e7838f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,8 +3,6 @@ name: Lint on: push: branches: ['*'] - pull_request: - branches: ['*'] jobs: run-linters: diff --git a/.github/workflows/nodejs-build.yml b/.github/workflows/nodejs-build.yml index 4335e7e3..741a00e6 100644 --- a/.github/workflows/nodejs-build.yml +++ b/.github/workflows/nodejs-build.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - node-version: [20.x, 22.x] + node-version: [20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: diff --git a/.gitignore b/.gitignore index 05216bec..39227882 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules/ .idea/ -/components/precompiled-templates.js +precompiled-templates.js /images/ /nginx/ssl/ \ No newline at end of file diff --git a/components/AdCard/AdCard.hbs b/components/AdCard/AdCard.hbs deleted file mode 100644 index 1233ea0f..00000000 --- a/components/AdCard/AdCard.hbs +++ /dev/null @@ -1,106 +0,0 @@ -
- -
- Housing card image -
- - {{#each images}} -
- {{/each}} - -
-
- - - -
-
-

{{cityName}}

-

{{address}}

-
- - -

{{viewsCount}}

-
-
-
-
- User avatar -

{{adAuthor.name}}

-
- star - {{adAuthor.rating}} -
-
-
-
\ No newline at end of file diff --git a/components/AdCard/AdCard.ts b/components/AdCard/AdCard.ts deleted file mode 100644 index 5c877e6c..00000000 --- a/components/AdCard/AdCard.ts +++ /dev/null @@ -1,112 +0,0 @@ -'use strict'; - -const SCROLL_DELAY = 200; - -import router from '../../modules/Router'; -import { AdvertData } from '../../modules/Types'; -import ReactiveComponent from '../ReactiveComponent/ReactiveComponent'; - -interface AdCardState { - toShowIndex: number; -} - -/** Карточка объявления на главной странице */ -export default class AdCard extends ReactiveComponent { - #data; - currentImagePath: string; - - /** - * @param {object} data - информация о карточке - @param {HTMLDivElement} parent - родитель, в чьем списке детей будет карточка */ - constructor(parent: HTMLDivElement, data: AdvertData) { - super({ - parent: parent, - id: '' + data.id, - initialState: { - toShowIndex: 0, - }, - computedValues: { - currentImagePath: (state) => { - return data.images[state.toShowIndex as number].path; - }, - }, - templateData: data, - }); - this.currentImagePath = ''; - this.#data = data; - } - - addEventListeners() { - this.thisElement.onclick = () => { - router.navigateTo(`/ads/?id=${this.#data.id}`); - }; - - ( - this.thisElement.querySelector( - '.js-like-button' - ) as HTMLButtonElement - ).onclick = this.#addToFavorite; - - setTimeout(() => { - this.#addImageScrolling(); - }, 0); // setTimeout ensures the code will be called AFTER browser finished rendering innerHTML new content - } - - /** - * Функция, которая добавляет возможность скроллинга изображений карточки как в Ozonе - */ - #addImageScrolling() { - const imgElem: HTMLImageElement = - this.thisElement.querySelector('.js-main-img')!; - - const imagesAmount = Math.min(this.#data.images.length, 7); // We must only show max amount of 7! - const areaFraction = - imgElem.getBoundingClientRect().width / imagesAmount; - - const circles = this.thisElement.getElementsByClassName( - 'housing-card__circle' - ); - - imgElem.onmousemove = (e) => this.#onMouseMove(e, areaFraction); - imgElem.onmouseout = () => this.#onMouseOut(); - - circles[this.state.toShowIndex as number].classList.add( - 'housing-card__circle--fill' - ); - } - - /** - * Функция, которая показывает нужную фотографию в зависимости от позиции курсора - */ - #onMouseMove(e: MouseEvent, areaFraction: number) { - const rect = (e.target as HTMLElement).getBoundingClientRect(); - const x = e.clientX - rect.left; - if (x < 0) return; - - const toShowIndex = Math.floor(x / areaFraction); - if (toShowIndex === this.state.toShowIndex) { - return; - } - - // todo: fix this - setTimeout(() => { - this.state.toShowIndex = toShowIndex; - }, SCROLL_DELAY); - } - - /** - * Функция, которая показывает первую фотографию, когда курсор вне карточки - */ - #onMouseOut() { - setTimeout(() => { - if (this.state.toShowIndex !== 0) this.state.toShowIndex = 0; - }, SCROLL_DELAY); - } - - /** - * Вызывается при нажатии на кнопку добавить в избранное - */ - #addToFavorite() { - console.log('fav btn was clicked!'); - } -} diff --git a/components/AdListPage/AdListPage.hbs b/components/AdListPage/AdListPage.hbs deleted file mode 100644 index 649b4db0..00000000 --- a/components/AdListPage/AdListPage.hbs +++ /dev/null @@ -1,19 +0,0 @@ -
- {{#if isHost}} -
-

Список объявлений

- -
-
- {{#if empty}} -

Здесь пока пусто... 🕳️

- {{/if}} -
- {{else}} -

🚫Вы не являетесь хостом, - поэтому не можете создавать объявления.

-

Если вы хотите стать хостом, - пожалуйста, измените свой статус в настройках

- {{/if}} -
\ No newline at end of file diff --git a/components/AdListPage/AdListPage.sass b/components/AdListPage/AdListPage.sass deleted file mode 100644 index 3ca93e08..00000000 --- a/components/AdListPage/AdListPage.sass +++ /dev/null @@ -1,129 +0,0 @@ -@use '../../mixins' - -.ad-list-page - margin-top: 40px - width: 80% - margin: 0 auto - - &__title - font-weight: 500 - - &__upper-container - display: flex - justify-content: space-between - align-items: end - margin: 20px 0 - &__add-button - @include mixins.button - background-color: #FF5255 - - &__adverts-container - display: flex - flex-direction: column - gap: 10px - - &__no-adverts-text - margin-top: 50px - text-align: center - font-size: 26px - - &__not-host-message - margin-top: 90px - font-size: 40px - text-align: center - - -.horizontal-ad-card - border: 1px solid black - border-radius: 10px - display: flex - flex-direction: row - gap: 40px - padding: 15px - transition: 0.3s all - - &:hover - background-color: #cecece - border: 1px solid #4b4b4b - - &__img - width: 250px - border-radius: 10px - - &__info - display: flex - width: 100% - flex-direction: column - justify-content: space-between - position: relative - - &__notification-bell - position: absolute - width: 32px - top: 0px - right: 0px - cursor: pointer - - &__city - font-size: 32px - - &__address - font-size: 20px - - &__buttons-container - display: flex - gap: 30px - - &__open-btn - @include mixins.button - width: 200px - height: 38px - background-color: #5289FF - - &__edit-btn - @include mixins.button - height: 38px - - &__del-btn - @include mixins.button - background-color: #FF5900 - height: 38px - - -@media screen and (max-width: 900px) - $button-height: 20px - .ad-list-page - &__upper-container - display: flex - text-align: center - flex-direction: column - justify-content: center - align-items: center - - .horizontal-ad-card - border: 1px solid black - border-radius: 10px - width: 100% - display: flex - flex-direction: column - gap: 40px - padding: 10px - transition: 0.3s all - - &__buttons-container - flex-wrap: wrap - - &__open-btn - @include mixins.button - width: fit-content - height: $button-height - background-color: #5289FF - - &__edit-btn - @include mixins.button - height: $button-height - - &__del-btn - @include mixins.button - background-color: #FF5900 - height: $button-height \ No newline at end of file diff --git a/components/AdListPage/AdListPage.ts b/components/AdListPage/AdListPage.ts deleted file mode 100644 index 974af73b..00000000 --- a/components/AdListPage/AdListPage.ts +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -import ApiClient from '../../modules/ApiClient'; -import router from '../../modules/Router'; -import HorizontalAdCard from '../HorizontalAdCard/HorizontalAdCard'; - -import { HorizontalAdCardData } from '../HorizontalAdCard/HorizontalAdCard'; - -function AdListPage(data: HorizontalAdCardData[], isHost: boolean) { - const pageContainer = document.createElement('div'); - - const template = Handlebars.templates['AdListPage.hbs']; - - pageContainer.innerHTML = template({ - ...data, - empty: data.length === 0, - isHost: isHost, - }); - if (!isHost) { - return pageContainer; - } - - const advertListElement = pageContainer.querySelector('.js-advert-list'); - const createAdvertElement = pageContainer.querySelector( - '.js-add-btn' - ) as HTMLButtonElement; - createAdvertElement.onclick = () => - router.navigateTo('/ads/?action=create'); - - for (const d of data) { - const card = HorizontalAdCard( - { - id: d.id, - cityName: d.cityName, - address: d.address, - image: d.image, - }, - { - onOpen: (uuid: string) => router.navigateTo(`/ads/?id=${uuid}`), - onEdit: (uuid: string) => - router.navigateTo(`/ads/?id=${uuid}&action=edit`), - onDel: async (uuid: string) => { - await ApiClient.deleteAd(uuid); - router.navigateTo(location.href); - }, - } - ); - advertListElement?.appendChild(card); - } - - return pageContainer; -} - -export default AdListPage; diff --git a/components/EditAdvertPage/EditAdvertPage.hbs b/components/EditAdvertPage/EditAdvertPage.hbs deleted file mode 100644 index af839684..00000000 --- a/components/EditAdvertPage/EditAdvertPage.hbs +++ /dev/null @@ -1,91 +0,0 @@ -
-
- - -
- {{#each inputs}} - - {{#if this.isTextArea}} - - {{else if this.isSelect}} - - - {{else}} - }} - /> - {{/if}} - {{/each}} - -
-
- -
- -
- -
\ No newline at end of file diff --git a/components/HorizontalAdCard/HorizontalAdCard.hbs b/components/HorizontalAdCard/HorizontalAdCard.hbs deleted file mode 100644 index ad16ba4b..00000000 --- a/components/HorizontalAdCard/HorizontalAdCard.hbs +++ /dev/null @@ -1,34 +0,0 @@ -
- - -
- - - - -

{{cityName}}

-

{{address}}

-
- - - -
-
-
\ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index 0a92e8a7..69eb2414 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -12,7 +12,7 @@ export default [ }, }, { - ignores: ['dist/*', 'components/precompiled-templates.js', 'include/*'], + ignores: ['dist/*', 'precompiled-templates.js', 'src/include/*'], }, { languageOptions: { diff --git a/index.html b/index.html index a84e46e5..25931938 100644 --- a/index.html +++ b/index.html @@ -4,13 +4,15 @@ Путник — сервис для каучсерфинга - +
- + - + - + diff --git a/nginx/nginx.conf b/nginx/nginx.conf index b31af7d7..f17ad2b0 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -25,6 +25,10 @@ http { proxy_set_header X-Forwarded-Proto $scheme; } + location /images/default.png { + proxy_pass http://frontend:5173/default.png; + } + location /images/ { proxy_pass http://host.docker.internal:9000; # Minio proxy_set_header Host $host; diff --git a/package.json b/package.json index 8352cf8f..82034dd4 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "start": "npm run compile:templates && vite", "build": "npm run compile:templates && vite build", "preview": "vite preview", - "prestart": "npm run eslint:fix && npm run compile:templates", - "compile:templates": "node hbs-recompile.js", + "prestart": "npm run compile:templates", + "compile:templates": "node src/vite-plugins/hbs-recompile.js", "eslint:fix": "npx eslint --fix " }, "author": "", diff --git a/manifest.json b/public/manifest.json similarity index 93% rename from manifest.json rename to public/manifest.json index f87f4936..e43b9184 100644 --- a/manifest.json +++ b/public/manifest.json @@ -12,13 +12,13 @@ { "src": "/screenshots/wide-1.png", "type": "image/png", - "sizes": "1900x900", + "sizes": "1901x900", "form_factor": "wide" }, { "src": "/screenshots/wide-2.png", "type": "image/png", - "sizes": "1900x900", + "sizes": "1901x900", "form_factor": "wide" } ], diff --git a/run.sh b/run.sh deleted file mode 100644 index 02634e23..00000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -docker build --tag frontend . -docker run -p 80:80 --detach 'frontend' diff --git a/src/components/AdCard/AdCard.hbs b/src/components/AdCard/AdCard.hbs new file mode 100644 index 00000000..c80a9bff --- /dev/null +++ b/src/components/AdCard/AdCard.hbs @@ -0,0 +1,109 @@ +
+ +
+ Housing card image + Housing card image +
+ + {{#each images}} +
+ {{/each}} + +
+
+ +
+ + + + + + + +
+ + + +
+ +
+ +
+

1-комн. кв. · 43 м · 1/2 этаж

+

{{address}}, {{cityName}}

+ +
+

{{adAuthor.name}}

+
·
+
+ star + {{adAuthor.rating}} +
+
+
+
\ No newline at end of file diff --git a/components/AdCard/AdCard.scss b/src/components/AdCard/AdCard.scss similarity index 56% rename from components/AdCard/AdCard.scss rename to src/components/AdCard/AdCard.scss index 4017b8f1..0937dd7b 100644 --- a/components/AdCard/AdCard.scss +++ b/src/components/AdCard/AdCard.scss @@ -27,16 +27,19 @@ &__main-img-container { position: relative; width: 100%; - height: 290px; + height: 100%; min-height: 0; - max-height: 290px; } &__main-img { + position: absolute; + top: 0; + width: 100%; height: 100%; object-fit: cover; object-position: center; + transition: 0.2s opacity ease-in-out; } &__image-pagination-div { @@ -53,43 +56,18 @@ &__info { background-color: white; - min-height: 40px; - height: 110px; - display: flex; - justify-content: space-between; - padding: 0 13px; - } - - &__like-button { - cursor: pointer; - position: absolute; - top: 5px; - right: 5px; - border-radius: 50%; - background-color: unset; - border: none; - width: 60px; + min-height: 80px; height: 60px; - display: flex; - justify-content: center; - align-items: center; - } - - &__star { - max-width: 16px; - max-height: 16px; - } - - &__location { display: flex; flex-direction: column; - justify-content: center; - gap: 5px; + justify-content: space-between; + padding: 10px 13px; } - &__city { + &__apartment-info { + color: #152242; font-size: 20px; - margin: 0; + font-weight: 600; } &__address { @@ -103,50 +81,134 @@ line-clamp: 2; -webkit-box-orient: vertical; /* Указание направления текста */ overflow: hidden; /* Скрытие лишнего текста */ + + color: #152242; + font-size: 16px; + font-weight: 500; } &__author-info { display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - align-content: center; - text-align: center; + flex-direction: row; + gap: 5px; + color: #152242; + font-size: 15px; } - &__avatar { - width: 50px; - height: 50px; - border-radius: 50%; - object-fit: cover; + &__rating { + font-size: 14px; } - &__href { - color: #808080; - font-size: 14px; + &__kebab { + position: absolute; + top: 10px; + right: 10px; + width: 40px; + height: 40px; + + border-radius: 50%; + background-color: #00000079; + + display: flex; + justify-content: center; + align-items: center; + + &__icon { + position: absolute; + right: 50%; + transform: translateX(50%); + fill: #fff; + } + + &__actions { + display: flex; + overflow: hidden; + flex-direction: row; + justify-content: space-between; + + visibility: hidden; + width: 0; + height: 40px; + border-radius: 20px; + background: #a7a7a7; + position: absolute; + top: 0px; + right: 0px; + transition: all 0.4s; + } + + &:hover { + visibility: none; + + .housing-card__kebab__icon { + visibility: hidden; + } + + .housing-card__kebab__actions { + width: 90px; + visibility: visible; + } + } } - &__view-row { + &__like-button { + cursor: pointer; + border-radius: 50%; + background-color: #00000066; + color: #fff; + border: none; + width: 40px; + height: 40px; display: flex; - flex-direction: row; - justify-content: space-between; + justify-content: center; align-items: center; - position: relative; - bottom: -10px; - width: 170px; + + &__heart { + color: #fff; + transition: color 0.3s ease; + } + + &:hover { + .housing-card__like-button__heart { + color: #e43030; + } + } } - &__view { + &__show-on-map-button { + cursor: pointer; + border-radius: 50%; + background-color: #00000066; + color: #fff; + border: none; + width: 40px; + height: 40px; display: flex; - flex-direction: row; - justify-content: space-between; - width: 30px; + justify-content: center; + align-items: center; + + &__location-icon { + fill: #ffffff; + transition: fill 0.3s ease; + } - &__p { - color: #808080; + &:hover { + .housing-card__show-on-map-button__location-icon { + fill: #ffa552; + } } } + &__star { + max-width: 16px; + max-height: 16px; + } + + &__href { + color: #808080; + font-size: 14px; + } + &__circle { border-radius: 50%; width: 7px; @@ -169,13 +231,6 @@ font-size: 13px; } - &__location { - gap: 0; - text-overflow: ellipsis; - overflow: hidden; - white-space: nowrap; - } - &__href { display: none; } diff --git a/src/components/AdCard/AdCard.ts b/src/components/AdCard/AdCard.ts new file mode 100644 index 00000000..96f9ba0a --- /dev/null +++ b/src/components/AdCard/AdCard.ts @@ -0,0 +1,213 @@ +'use strict'; + +const SCROLL_DELAY = 200; + +import router from '../../modules/Router'; +import { AdvertData } from '../../modules/Types'; +import ReactiveComponent from '../ReactiveComponent/ReactiveComponent'; + +/** Карточка объявления на главной странице */ +export default class AdCard extends ReactiveComponent { + private data; + private plannedImageIndex: number | null; // Пикча, которую анимация хотела показать + private currentImageIndex; + + private oldImage: HTMLImageElement | null; + private newImage: HTMLImageElement | null; + private imgScrollTimeouts: NodeJS.Timeout[]; + private circles!: HTMLCollectionOf; + + /** + * @param data - информация о карточке + * @param parent - родитель, в чьем списке детей будет карточка + */ + constructor(parent: HTMLDivElement, data: AdvertData) { + super({ + parent: parent, + id: '' + data.id, + initialState: {}, + computedValues: { + // currentImagePath: (state) => { + // return data.images[state.toShowIndex as number].path; + // }, + }, + templateData: data, + }); + this.plannedImageIndex = null; + this.currentImageIndex = 0; + this.data = data; + this.oldImage = this.newImage = null; + this.imgScrollTimeouts = []; + } + + addEventListeners() { + this.thisElement.onclick = () => { + router.navigateTo(`/ads/?id=${this.data.id}`); + }; + + ( + this.thisElement.querySelector( + '.js-like-button' + ) as HTMLButtonElement + ).onclick = (e) => this.addToFavorite(e); + + ( + this.thisElement.querySelector( + '.js-show-on-map-button' + ) as HTMLButtonElement + ).onclick = (e) => this.showOnMap(e); + + setTimeout(() => { + this.addImageScrolling(); + }, 0); // setTimeout ensures the code will be called AFTER browser finished rendering innerHTML new content + } + + /** + * @description Функция, которая добавляет возможность скроллинга изображений карточки как в Ozonе + */ + addImageScrolling() { + const imgContainer = this.thisElement.querySelector( + '.js-image-container' + ) as HTMLDivElement; + + const imagesAmount = Math.min(this.data.images.length, 7); // We must only show max amount of 7! + const areaFraction = + imgContainer.getBoundingClientRect().width / imagesAmount; + + this.circles = this.thisElement.getElementsByClassName( + 'housing-card__circle' + ); + + this.oldImage = this.thisElement.querySelector( + '.js-old-img' + ) as HTMLImageElement; + this.newImage = this.thisElement.querySelector( + '.js-new-img' + ) as HTMLImageElement; + + imgContainer.onmousemove = (e) => this.onMouseMove(e, areaFraction); + imgContainer.onmouseleave = () => this.onMouseOut(); + + this.circles[this.currentImageIndex as number].classList.add( + 'housing-card__circle--fill' + ); + } + + /** + * @description Функция, которая показывает нужную фотографию в зависимости от позиции курсора + */ + onMouseMove(e: MouseEvent, areaFraction: number) { + const rect = (e.target as HTMLElement).getBoundingClientRect(); + const x = e.clientX - rect.left; + if (x < 0) return; + + const toShowIndex = Math.floor(x / areaFraction); + + this.showImage(toShowIndex); + } + + /** + * + * @param index индекс кружка, который нужно выделить + */ + private markCircleSelected(index: number) { + [...this.circles].map((x) => + x.classList.remove('housing-card__circle--fill') + ); + + this.circles[index as number].classList.add( + 'housing-card__circle--fill' + ); + } + + /** + * @description Показывает изображение с индексом {toShowIndex} с плавной анимацией затухания. + */ + private showImage(toShowIndex: number) { + // Проверяем что images не null + if (!this.oldImage || !this.newImage) { + throw new Error('oldImage & newImage = nulls!'); + } + + if ( + (!this.imgScrollTimeouts.length && + toShowIndex === this.currentImageIndex) || + (this.imgScrollTimeouts.length !== 0 && + toShowIndex === this.plannedImageIndex) + ) { + return; + } + + this.markCircleSelected(toShowIndex); + + // Animation begin + this.plannedImageIndex = toShowIndex; + + // Новая фотка на задний план, а старая на переднем + this.newImage.style.zIndex = '-1'; + this.oldImage.style.zIndex = '0'; + + // Меняем src у новой фотки + this.newImage.src = this.data.images[toShowIndex].path; + this.newImage.onload = () => { + // Теперь просто меняем непрозрачность у старой, чтобы было видно новую + this.oldImage!.style.opacity = '0'; + }; + + // После завершения анимации СВАПАЕМ местами старую и новую фотку + // и выполняем переключение изображения, если юзер успел в процессе анимации переместить курсор на область фото + // сдругим индексом + const timeout = setTimeout(() => { + if (!this.oldImage || !this.newImage) + throw new Error('oldImage & newImage = nulls!'); + + // И возвращаем newImage к исходному состоянию + this.oldImage.style.zIndex = '-1'; + this.newImage.style.zIndex = '0'; + + this.oldImage.style.opacity = '1'; + + // Просто делаем swap переменных, потому по сути newImage теперь oldImage и vice versa + const tmp = this.oldImage; + this.oldImage = this.newImage; + this.newImage = tmp; + + this.imgScrollTimeouts = []; + this.currentImageIndex = this.plannedImageIndex!; + + // We've finished the animation + this.plannedImageIndex = null; + }, 200); // here should be ANIMATION_TIME defined in CSS + + // Clear all old setTimeouts + this.imgScrollTimeouts.map((timeoutToClear) => + clearTimeout(timeoutToClear) + ); + this.imgScrollTimeouts = [timeout]; + } + + /** + * @description Функция, которая показывает первую фотографию, когда курсор вне карточки + */ + onMouseOut() { + this.showImage(0); + } + + /** + * @description Вызывается при нажатии на кнопку добавить в избранное + */ + addToFavorite(e: Event) { + e.stopPropagation(); + + console.log('fav btn was clicked!'); + } + + /** + * @description + */ + showOnMap(e: Event) { + e.stopPropagation(); + + console.log('show on map!'); + } +} diff --git a/components/AuthPopup/AuthPopup.hbs b/src/components/AuthPopup/AuthPopup.hbs similarity index 100% rename from components/AuthPopup/AuthPopup.hbs rename to src/components/AuthPopup/AuthPopup.hbs diff --git a/components/AuthPopup/AuthPopup.scss b/src/components/AuthPopup/AuthPopup.scss similarity index 84% rename from components/AuthPopup/AuthPopup.scss rename to src/components/AuthPopup/AuthPopup.scss index 692bbbd7..b5d5f272 100644 --- a/components/AuthPopup/AuthPopup.scss +++ b/src/components/AuthPopup/AuthPopup.scss @@ -1,22 +1,22 @@ .auth-modal { position: fixed; - width: 400px; + width: 380px; min-height: 520px; height: fit-content; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); background-color: #ffffff; - border-radius: 10px; + border-radius: 6px; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; - padding: 30px 10px 0; + box-sizing: border-box; + padding: 30px 50px 10px; &__field-container { - width: 80%; - margin: 0 auto; + width: 100%; } &__input { @@ -69,7 +69,6 @@ background-color: #ffa552; color: #ffffff; cursor: pointer; - margin: 0 20% 5%; border: none; border-radius: 10px; height: 40px; @@ -90,21 +89,16 @@ } .auth-message { - padding-top: 5px; - padding-bottom: 5px; font-size: 20px; font-weight: bold; text-align: center; } .have-account { - padding-bottom: 5%; display: flex; flex-direction: row; justify-content: space-between; - width: 55%; - margin-left: 20%; - margin-right: 20%; + width: 100%; } .have-account a { @@ -114,8 +108,8 @@ .close-cross { position: absolute; - top: 5%; - right: 5%; + top: 10px; + right: 10px; cursor: pointer; } diff --git a/components/AuthPopup/AuthPopup.ts b/src/components/AuthPopup/AuthPopup.ts similarity index 99% rename from components/AuthPopup/AuthPopup.ts rename to src/components/AuthPopup/AuthPopup.ts index 9f5c4579..e8537163 100644 --- a/components/AuthPopup/AuthPopup.ts +++ b/src/components/AuthPopup/AuthPopup.ts @@ -213,7 +213,6 @@ class AuthPopup { } #setFailureMessage(message: string): void { - console.log('???'); const failureMessageElem = document.querySelector( '.auth-modal__failure-message' ); diff --git a/components/Filter/Filter.hbs b/src/components/Filter/Filter.hbs similarity index 100% rename from components/Filter/Filter.hbs rename to src/components/Filter/Filter.hbs diff --git a/components/Filter/Filter.scss b/src/components/Filter/Filter.scss similarity index 98% rename from components/Filter/Filter.scss rename to src/components/Filter/Filter.scss index 64d661ad..d1251c5e 100644 --- a/components/Filter/Filter.scss +++ b/src/components/Filter/Filter.scss @@ -1,4 +1,4 @@ -@use '../../mixins'; +@use '../../styles/mixins'; #main-content { width: 93%; diff --git a/components/Filter/Filter.ts b/src/components/Filter/Filter.ts similarity index 100% rename from components/Filter/Filter.ts rename to src/components/Filter/Filter.ts diff --git a/components/Header/Header.scss b/src/components/Header/Header.scss similarity index 93% rename from components/Header/Header.scss rename to src/components/Header/Header.scss index 200d1f6b..94dde71f 100644 --- a/components/Header/Header.scss +++ b/src/components/Header/Header.scss @@ -3,6 +3,7 @@ height: 80px; display: flex; align-items: center; + border-bottom: 1px #e8e9ec solid; } .header__hrefs { diff --git a/components/Header/Header.ts b/src/components/Header/Header.ts similarity index 100% rename from components/Header/Header.ts rename to src/components/Header/Header.ts diff --git a/src/components/HorizontalAdCard/HorizontalAdCard.hbs b/src/components/HorizontalAdCard/HorizontalAdCard.hbs new file mode 100644 index 00000000..436dfecd --- /dev/null +++ b/src/components/HorizontalAdCard/HorizontalAdCard.hbs @@ -0,0 +1,65 @@ +
+ + +
+ {{! + + }} + +

{{cityName}}

+

{{address}}

+
+ + + +
+
+
\ No newline at end of file diff --git a/src/components/HorizontalAdCard/HorizontalAdCard.scss b/src/components/HorizontalAdCard/HorizontalAdCard.scss new file mode 100644 index 00000000..e71ead90 --- /dev/null +++ b/src/components/HorizontalAdCard/HorizontalAdCard.scss @@ -0,0 +1,78 @@ +@use '../../styles/mixins'; + +.horizontal-ad-card { + display: flex; + flex-direction: row; + gap: 40px; + padding: 15px; + transition: 0.3s all; + border: 2px #e4e4e4 solid; + border-bottom: none; + + &:last-child { + border-bottom: 2px #e4e4e4 solid; + } + + &:hover { + background-color: #cecece; + } + &__img { + min-width: 270px; + width: 270px; + height: 150px; + object-fit: cover; + border-radius: 2px; + } + &__info { + display: flex; + width: 100%; + flex-direction: column; + justify-content: space-between; + position: relative; + } + &__notification-bell { + position: absolute; + width: 32px; + top: 0px; + right: 0px; + cursor: pointer; + } + &__city { + font-size: 32px; + } + &__address { + font-size: 20px; + color: #7a7a7a; + } + &__buttons-container { + display: flex; + gap: 30px; + } + &__open-btn { + @include mixins.small-button; + background-color: #e6f0ff; + color: #0661ec; + + &:hover { + background-color: #d9e8ff; + } + } + &__edit-btn { + @include mixins.small-button; + background-color: #e6f0ff; + color: #0661ec; + + &:hover { + background-color: #d9e8ff; + } + } + &__del-btn { + @include mixins.small-button; + background-color: #e6f0ff; + color: #0661ec; + + &:hover { + background-color: #d9e8ff; + } + } +} diff --git a/components/HorizontalAdCard/HorizontalAdCard.ts b/src/components/HorizontalAdCard/HorizontalAdCard.ts similarity index 57% rename from components/HorizontalAdCard/HorizontalAdCard.ts rename to src/components/HorizontalAdCard/HorizontalAdCard.ts index 07265b03..53861693 100644 --- a/components/HorizontalAdCard/HorizontalAdCard.ts +++ b/src/components/HorizontalAdCard/HorizontalAdCard.ts @@ -20,21 +20,23 @@ export default function HorizontalAdCard( pageContainer.innerHTML = template(cardData); - pageContainer - .querySelector('.js-open-btn') - ?.addEventListener('click', () => callbacks.onOpen(cardData.id)); + (pageContainer.querySelector('.js-open-btn') as HTMLButtonElement).onclick = + (e) => { + e.stopPropagation(); + callbacks.onOpen(cardData.id); + }; - pageContainer - .querySelector('.js-edit-btn') - ?.addEventListener('click', () => { + (pageContainer.querySelector('.js-edit-btn') as HTMLButtonElement).onclick = + (pageContainer.firstChild as HTMLElement).onclick = (e) => { + e.stopPropagation(); callbacks.onEdit(cardData.id); - }); + }; - pageContainer - .querySelector('.js-del-btn') - ?.addEventListener('click', () => { + (pageContainer.querySelector('.js-del-btn') as HTMLButtonElement).onclick = + (e) => { + e.stopPropagation(); callbacks.onDel(cardData.id); - }); + }; return pageContainer.firstChild as HTMLDivElement; } diff --git a/components/MainPhoto/MainPhoto.scss b/src/components/MainPhoto/MainPhoto.scss similarity index 100% rename from components/MainPhoto/MainPhoto.scss rename to src/components/MainPhoto/MainPhoto.scss diff --git a/components/MainPhoto/MainPhoto.ts b/src/components/MainPhoto/MainPhoto.ts similarity index 100% rename from components/MainPhoto/MainPhoto.ts rename to src/components/MainPhoto/MainPhoto.ts diff --git a/components/PopupAlert/PopupAlert.hbs b/src/components/PopupAlert/PopupAlert.hbs similarity index 100% rename from components/PopupAlert/PopupAlert.hbs rename to src/components/PopupAlert/PopupAlert.hbs diff --git a/components/PopupAlert/PopupAlert.scss b/src/components/PopupAlert/PopupAlert.scss similarity index 100% rename from components/PopupAlert/PopupAlert.scss rename to src/components/PopupAlert/PopupAlert.scss diff --git a/components/PopupAlert/PopupAlert.ts b/src/components/PopupAlert/PopupAlert.ts similarity index 100% rename from components/PopupAlert/PopupAlert.ts rename to src/components/PopupAlert/PopupAlert.ts diff --git a/components/ProfileData/EditForm.hbs b/src/components/ProfileData/EditForm.hbs similarity index 90% rename from components/ProfileData/EditForm.hbs rename to src/components/ProfileData/EditForm.hbs index 41db8186..f29c305b 100644 --- a/components/ProfileData/EditForm.hbs +++ b/src/components/ProfileData/EditForm.hbs @@ -100,21 +100,6 @@ -
-

Адрес:

- - - ! - -
-
{{!--

Пароль:

diff --git a/components/ProfileData/NoReviews/NoReviews.hbs b/src/components/ProfileData/NoReviews/NoReviews.hbs similarity index 100% rename from components/ProfileData/NoReviews/NoReviews.hbs rename to src/components/ProfileData/NoReviews/NoReviews.hbs diff --git a/components/ProfileData/NoReviews/NoReviews.sass b/src/components/ProfileData/NoReviews/NoReviews.sass similarity index 94% rename from components/ProfileData/NoReviews/NoReviews.sass rename to src/components/ProfileData/NoReviews/NoReviews.sass index febaeb40..10455ed2 100644 --- a/components/ProfileData/NoReviews/NoReviews.sass +++ b/src/components/ProfileData/NoReviews/NoReviews.sass @@ -1,4 +1,4 @@ -@use '../../../mixins' +@use '../../../styles/mixins' .no-reviews width: 100% diff --git a/components/ProfileData/NoReviews/NoReviews.ts b/src/components/ProfileData/NoReviews/NoReviews.ts similarity index 100% rename from components/ProfileData/NoReviews/NoReviews.ts rename to src/components/ProfileData/NoReviews/NoReviews.ts diff --git a/components/ProfileData/ProfileData.sass b/src/components/ProfileData/ProfileData.sass similarity index 100% rename from components/ProfileData/ProfileData.sass rename to src/components/ProfileData/ProfileData.sass diff --git a/components/ProfileData/ProfileData.ts b/src/components/ProfileData/ProfileData.ts similarity index 91% rename from components/ProfileData/ProfileData.ts rename to src/components/ProfileData/ProfileData.ts index ff6e1dd2..dc255f4b 100644 --- a/components/ProfileData/ProfileData.ts +++ b/src/components/ProfileData/ProfileData.ts @@ -46,7 +46,11 @@ class ProfileData { #uploadAvatarImage?: File; #renderProfileInfo; - constructor(renderProfileInfoCallback: () => void, isMyProfile: boolean, otherUserId?: string) { + constructor( + renderProfileInfoCallback: () => void, + isMyProfile: boolean, + otherUserId?: string + ) { this.#isMyProfile = isMyProfile; if (otherUserId) { this.#otherUserId = otherUserId; @@ -122,16 +126,25 @@ class ProfileData { */ #dataToString(data: string): string { const monthNames = [ - 'января', 'февраля', 'марта', 'апреля', - 'мая', 'июня', 'июля', 'августа', - 'сентября', 'октября', 'ноября', 'декабря' + 'января', + 'февраля', + 'марта', + 'апреля', + 'мая', + 'июня', + 'июля', + 'августа', + 'сентября', + 'октября', + 'ноября', + 'декабря', ]; - + const date = new Date(data); const day = date.getDate(); const month = monthNames[date.getMonth()]; const year = date.getFullYear(); - + return `${day} ${month} ${year}г.`; } @@ -150,7 +163,7 @@ class ProfileData { this.#profileData.email = data.email; this.#profileData.isHost = data.isHost; this.#profileData.avatar = data.avatar; - this.#profileData.birthdate = data.birthDate.slice(0, 10); + this.#profileData.birthdate = data.birthdate.slice(0, 10); if (this.#profileData.birthdate != '0001-01-01') this.#showBirthdate = true; this.#profileData.sex = this.#calculateSex(data.sex); @@ -204,11 +217,16 @@ class ProfileData { async #leaveReview(): Promise { const data: ReviewData = { hostId: this.#otherUserId as string, - title: (document.querySelector('#review-title') as HTMLInputElement).value, - text: (document.querySelector('#review-text') as HTMLTextAreaElement).value, - rating: Number((document - .querySelector('input[name="rating"]:checked') as HTMLInputElement)! - .value) + title: (document.querySelector('#review-title') as HTMLInputElement) + .value, + text: ( + document.querySelector('#review-text') as HTMLTextAreaElement + ).value, + rating: Number( + (document.querySelector( + 'input[name="rating"]:checked' + ) as HTMLInputElement)!.value + ), }; const response = await ApiClient.leaveReview(data); @@ -218,9 +236,7 @@ class ProfileData { dataContainer?.appendChild(this.#content); } else { clearPage('profile'); - const errorMessage = PopupAlert( - 'Неверный формат отзыва' - ); + const errorMessage = PopupAlert('Неверный формат отзыва'); document .querySelector('#profile-content') ?.appendChild(errorMessage); @@ -241,9 +257,7 @@ class ProfileData { return data; } else { clearPage('profile'); - const errorMessage = PopupAlert( - 'Ошибка получения отзывов' - ); + const errorMessage = PopupAlert('Ошибка получения отзывов'); document .querySelector('#profile-content') ?.appendChild(errorMessage); @@ -375,12 +389,12 @@ class ProfileData { #addButtonEventListener(): void { const editButton = document.getElementById('edit-button'); if (this.#isMyProfile) { - editButton!.addEventListener('click', (e)=>{ + editButton!.addEventListener('click', (e) => { e.preventDefault(); this.#renderForm(); }); } else { - editButton!.addEventListener('click', (e)=>{ + editButton!.addEventListener('click', (e) => { e.preventDefault(); clearPage('form'); this.#content.replaceChildren(); @@ -496,9 +510,9 @@ class ProfileData { }); } - #submitReviewEventListener(){ + #submitReviewEventListener() { const leaveReviewButton = document.querySelector('.js-leave-review'); - leaveReviewButton!.addEventListener('click', async (e)=>{ + leaveReviewButton!.addEventListener('click', async (e) => { e.preventDefault(); await this.#leaveReview(); await this.#renderProfileInfo(); @@ -511,7 +525,7 @@ class ProfileData { #renderGraphicEventListener(): void { document .querySelector('.js-graphic-href') - ?.addEventListener('click', (e)=>{ + ?.addEventListener('click', (e) => { e.preventDefault(); this.#renderGraphic(); }); @@ -560,7 +574,9 @@ class ProfileData { #renderMap() { this.#content.replaceChildren(); this.#content.classList.remove('y-scroll'); - this.#content.parentElement?.classList.remove('fix-bottom-right-border'); + this.#content.parentElement?.classList.remove( + 'fix-bottom-right-border' + ); const wrapper = document.createElement('div'); wrapper.id = 'wrapper'; wrapper.classList.add('data-container__wrapper'); @@ -578,17 +594,17 @@ class ProfileData { const reviews = await this.#getReviews(); if (reviews.length != 0) { this.#content.classList.add('y-scroll'); - this.#content.parentElement?.classList.add('fix-bottom-right-border'); + this.#content.parentElement?.classList.add( + 'fix-bottom-right-border' + ); reviews.forEach((reviewData) => { - console.log(reviewData); - reviewData.createdAt = this.#dataToString(reviewData.createdAt); + reviewData.createdAt = this.#dataToString(reviewData.createdAt); const review = new ReviewCard(reviewData); review.render(this.#content); }); } else { - const noReviews = new NoReviews(this.#isMyProfile, ()=>{ - console.log('there'); + const noReviews = new NoReviews(this.#isMyProfile, () => { clearPage('form'); this.#content.replaceChildren(); this.#renderReviewForm(); @@ -599,18 +615,20 @@ class ProfileData { #renderAchievments() {} - async #renderGraphic(){ + async #renderGraphic() { this.#content.replaceChildren(); const reviews = await this.#getReviews(); if (reviews.length != 0) { this.#content.classList.remove('y-scroll'); - this.#content.parentElement?.classList.remove('fix-bottom-right-border'); + this.#content.parentElement?.classList.remove( + 'fix-bottom-right-border' + ); const graphicData = new Array(); - for (const {createdAt, rating} of reviews){ + for (const { createdAt, rating } of reviews) { const point: GraphicPoint = { - date: (new Date(createdAt)).toLocaleDateString('ru-RU'), - rating: rating + date: new Date(createdAt).toLocaleDateString('ru-RU'), + rating: rating, }; graphicData.push(point); } @@ -618,8 +636,7 @@ class ProfileData { const reviewsGraphic = new ReviewsGraphic(graphicData); reviewsGraphic.render(this.#content); } else { - const noReviews = new NoReviews(this.#isMyProfile, ()=>{ - console.log('there'); + const noReviews = new NoReviews(this.#isMyProfile, () => { clearPage('form'); this.#content.replaceChildren(); this.#renderReviewForm(); @@ -659,14 +676,11 @@ class ProfileData { * @private * @description Рендер окна оценивния */ - #renderReviewForm(): void{ + #renderReviewForm(): void { this.#content.replaceChildren(); const template = Handlebars.templates['RatingForm.hbs']; - this.#content.insertAdjacentHTML( - 'beforeend', - template({}) - ); - + this.#content.insertAdjacentHTML('beforeend', template({})); + this.#submitReviewEventListener(); } diff --git a/components/ProfileData/RatingForm.hbs b/src/components/ProfileData/RatingForm.hbs similarity index 100% rename from components/ProfileData/RatingForm.hbs rename to src/components/ProfileData/RatingForm.hbs diff --git a/components/ProfileData/RatingForm.sass b/src/components/ProfileData/RatingForm.sass similarity index 99% rename from components/ProfileData/RatingForm.sass rename to src/components/ProfileData/RatingForm.sass index 71d8bc5f..25d50b90 100644 --- a/components/ProfileData/RatingForm.sass +++ b/src/components/ProfileData/RatingForm.sass @@ -1,4 +1,4 @@ -@use '../../mixins' +@use '../../styles/mixins' $unchecked-color: #ffffff // Цвет для невыбранных звезд $checked-color: #FFA552 // Цвет для выбранных звезд diff --git a/components/ProfileInfo/ProfileInfo.hbs b/src/components/ProfileInfo/ProfileInfo.hbs similarity index 100% rename from components/ProfileInfo/ProfileInfo.hbs rename to src/components/ProfileInfo/ProfileInfo.hbs diff --git a/components/ProfileInfo/ProfileInfo.scss b/src/components/ProfileInfo/ProfileInfo.scss similarity index 99% rename from components/ProfileInfo/ProfileInfo.scss rename to src/components/ProfileInfo/ProfileInfo.scss index e9fc341c..21148a52 100644 --- a/components/ProfileInfo/ProfileInfo.scss +++ b/src/components/ProfileInfo/ProfileInfo.scss @@ -1,4 +1,4 @@ -@use '../../mixins'; +@use '../../styles/mixins'; .profile-container { margin: 40px 0px 0px 35%; diff --git a/components/ProfileInfo/ProfileInfo.ts b/src/components/ProfileInfo/ProfileInfo.ts similarity index 100% rename from components/ProfileInfo/ProfileInfo.ts rename to src/components/ProfileInfo/ProfileInfo.ts diff --git a/components/ProfilePopup/ProfilePopup.hbs b/src/components/ProfilePopup/ProfilePopup.hbs similarity index 87% rename from components/ProfilePopup/ProfilePopup.hbs rename to src/components/ProfilePopup/ProfilePopup.hbs index 4a90c79f..82b133dc 100644 --- a/components/ProfilePopup/ProfilePopup.hbs +++ b/src/components/ProfilePopup/ProfilePopup.hbs @@ -10,7 +10,6 @@ {{this.title}}
-
{{/each}} \ No newline at end of file diff --git a/components/ProfilePopup/ProfilePopup.scss b/src/components/ProfilePopup/ProfilePopup.scss similarity index 55% rename from components/ProfilePopup/ProfilePopup.scss rename to src/components/ProfilePopup/ProfilePopup.scss index c5d4ab6a..e2e61efb 100644 --- a/components/ProfilePopup/ProfilePopup.scss +++ b/src/components/ProfilePopup/ProfilePopup.scss @@ -11,30 +11,33 @@ } .profile-list { + display: flex; + flex-direction: column; + gap: 20px; + z-index: 10; position: relative; top: 70px; - left: 88%; - min-width: min-content; - max-width: 120px; - padding: 20px 20px 0px 20px; - border: solid; - border-radius: 10px; - border-width: 2px; - border-color: #635b5b; + left: 100%; + transform: translateX(-140%); + width: 150px; + padding: 18px 16px 20px; + border-radius: 4px; + box-shadow: 0 8px 16px #0006; background-color: #ffffff; margin-right: 10px; } .profile-list__href { - font-size: 20px; - font-weight: 600; + font-size: 15px; + font-weight: 500; text-decoration: none; - color: #635b5b; + color: #152242; cursor: pointer; -} - -.profile-list__underline { margin-bottom: 20px; + + &:hover { + color: #0661ec; + } } @media screen and (max-width: 900px) { diff --git a/components/ProfilePopup/ProfilePopup.ts b/src/components/ProfilePopup/ProfilePopup.ts similarity index 92% rename from components/ProfilePopup/ProfilePopup.ts rename to src/components/ProfilePopup/ProfilePopup.ts index 860c41a0..d6fd0126 100644 --- a/components/ProfilePopup/ProfilePopup.ts +++ b/src/components/ProfilePopup/ProfilePopup.ts @@ -31,10 +31,6 @@ class ProfilePopup { title: 'Профиль', href: '/profile', }, - donate: { - title: 'Донаты', - href: '/donate', - }, myAdvertisements: { title: 'Мои объявления', href: '/ads/?author=me', diff --git a/components/ReactiveComponent/ReactiveComponent.ts b/src/components/ReactiveComponent/ReactiveComponent.ts similarity index 100% rename from components/ReactiveComponent/ReactiveComponent.ts rename to src/components/ReactiveComponent/ReactiveComponent.ts diff --git a/components/ReviewCard/ReviewCard.hbs b/src/components/ReviewCard/ReviewCard.hbs similarity index 100% rename from components/ReviewCard/ReviewCard.hbs rename to src/components/ReviewCard/ReviewCard.hbs diff --git a/components/ReviewCard/ReviewCard.sass b/src/components/ReviewCard/ReviewCard.sass similarity index 100% rename from components/ReviewCard/ReviewCard.sass rename to src/components/ReviewCard/ReviewCard.sass diff --git a/components/ReviewCard/ReviewCard.ts b/src/components/ReviewCard/ReviewCard.ts similarity index 100% rename from components/ReviewCard/ReviewCard.ts rename to src/components/ReviewCard/ReviewCard.ts diff --git a/components/ReviewsGraphic/ReviewsGraphic.hbs b/src/components/ReviewsGraphic/ReviewsGraphic.hbs similarity index 100% rename from components/ReviewsGraphic/ReviewsGraphic.hbs rename to src/components/ReviewsGraphic/ReviewsGraphic.hbs diff --git a/components/ReviewsGraphic/ReviewsGraphic.sass b/src/components/ReviewsGraphic/ReviewsGraphic.sass similarity index 100% rename from components/ReviewsGraphic/ReviewsGraphic.sass rename to src/components/ReviewsGraphic/ReviewsGraphic.sass diff --git a/components/ReviewsGraphic/ReviewsGraphic.ts b/src/components/ReviewsGraphic/ReviewsGraphic.ts similarity index 86% rename from components/ReviewsGraphic/ReviewsGraphic.ts rename to src/components/ReviewsGraphic/ReviewsGraphic.ts index ce2515e1..41934f0b 100644 --- a/components/ReviewsGraphic/ReviewsGraphic.ts +++ b/src/components/ReviewsGraphic/ReviewsGraphic.ts @@ -13,9 +13,8 @@ interface AdditionalInfo { class ReviewsGraphic { #data: Array; - constructor(data: Array){ + constructor(data: Array) { this.#data = data; - console.log(this.#data); this.#registerHelper(); } @@ -32,14 +31,22 @@ class ReviewsGraphic { } #getAdditionalInfo(): AdditionalInfo { - const sortedData = [...this.#data].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()); + const sortedData = [...this.#data].sort( + (a, b) => new Date(a.date).getTime() - new Date(b.date).getTime() + ); const addInfo: AdditionalInfo = { totalRatings: this.#data.length, firstDate: sortedData[0]?.date || 'Нет данных', lastDate: sortedData[sortedData.length - 1]?.date || 'Нет данных', - highestRating: Math.max(...this.#data.map(point => point.rating), 0), - lowestRating: Math.min(...this.#data.map(point => point.rating), 5) + highestRating: Math.max( + ...this.#data.map((point) => point.rating), + 0 + ), + lowestRating: Math.min( + ...this.#data.map((point) => point.rating), + 5 + ), }; return addInfo; @@ -52,28 +59,29 @@ class ReviewsGraphic { console.error('Canvas context not available'); return; } - + // Размеры графика const padding = 50; // Отступы от краёв - const canvasWidth = canvas.width = 700; // Ширина холста - const canvasHeight = canvas.height = 400; // Высота холста - + const canvasWidth = (canvas.width = 700); // Ширина холста + const canvasHeight = (canvas.height = 400); // Высота холста + const graphWidth = canvasWidth - padding * 2; const graphHeight = canvasHeight - padding * 2; - + // Шаг по X зависит от общего количества точек const totalPoints = this.#data.length; const xStep = graphWidth / (totalPoints - 1); - + // Границы по Y const minRating = 1; const maxRating = 5; const yStep = graphHeight / (maxRating - minRating); - + // Функции для преобразования координат const toXCoord = (index: number) => padding + index * xStep; - const toYCoord = (rating: number) => canvasHeight - padding - (rating - minRating) * yStep; - + const toYCoord = (rating: number) => + canvasHeight - padding - (rating - minRating) * yStep; + // Сетка ctx.strokeStyle = '#e0e0e0'; ctx.lineWidth = 1; @@ -84,7 +92,7 @@ class ReviewsGraphic { ctx.lineTo(canvasWidth - padding, y); ctx.stroke(); } - + for (let i = 0; i < totalPoints; i++) { const x = toXCoord(i); ctx.beginPath(); @@ -92,7 +100,7 @@ class ReviewsGraphic { ctx.lineTo(x, canvasHeight - padding); ctx.stroke(); } - + // Оси ctx.strokeStyle = '#000'; ctx.lineWidth = 2; @@ -101,7 +109,7 @@ class ReviewsGraphic { ctx.lineTo(padding, canvasHeight - padding); // Ось Y ctx.lineTo(canvasWidth - padding, canvasHeight - padding); // Ось X ctx.stroke(); - + // Метки по оси Y ctx.fillStyle = '#000'; ctx.font = '12px Arial'; @@ -109,14 +117,18 @@ class ReviewsGraphic { const y = toYCoord(i + minRating); ctx.fillText((i + minRating).toString(), padding - 30, y + 5); } - + // Метки по оси X ctx.font = '10px Arial'; for (let i = 0; i < totalPoints; i++) { const x = toXCoord(i); - ctx.fillText(this.#data[i].date, x - 20, canvasHeight - padding + 20); + ctx.fillText( + this.#data[i].date, + x - 20, + canvasHeight - padding + 20 + ); } - + // Рисуем линии, соединяющие точки ctx.strokeStyle = '#ffa552'; ctx.lineWidth = 2; @@ -165,7 +177,6 @@ class ReviewsGraphic { } ctx.stroke(); // Рисуем соединяющую линию среднего значения } - async render(parent: HTMLDivElement) { const addInfo = this.#getAdditionalInfo(); @@ -175,4 +186,4 @@ class ReviewsGraphic { } } -export default ReviewsGraphic; \ No newline at end of file +export default ReviewsGraphic; diff --git a/components/SearchPopup/SearchPopup.hbs b/src/components/SearchPopup/SearchPopup.hbs similarity index 100% rename from components/SearchPopup/SearchPopup.hbs rename to src/components/SearchPopup/SearchPopup.hbs diff --git a/components/SearchPopup/SearchPopup.sass b/src/components/SearchPopup/SearchPopup.sass similarity index 100% rename from components/SearchPopup/SearchPopup.sass rename to src/components/SearchPopup/SearchPopup.sass diff --git a/components/SearchPopup/SearchPopup.ts b/src/components/SearchPopup/SearchPopup.ts similarity index 100% rename from components/SearchPopup/SearchPopup.ts rename to src/components/SearchPopup/SearchPopup.ts diff --git a/components/ShortAdCard/ShortAdCard.hbs b/src/components/ShortAdCard/ShortAdCard.hbs similarity index 100% rename from components/ShortAdCard/ShortAdCard.hbs rename to src/components/ShortAdCard/ShortAdCard.hbs diff --git a/components/ShortAdCard/ShortAdCard.sass b/src/components/ShortAdCard/ShortAdCard.sass similarity index 98% rename from components/ShortAdCard/ShortAdCard.sass rename to src/components/ShortAdCard/ShortAdCard.sass index f1ee1824..8b9e698d 100644 --- a/components/ShortAdCard/ShortAdCard.sass +++ b/src/components/ShortAdCard/ShortAdCard.sass @@ -1,4 +1,4 @@ -@use '../../mixins' as mixins +@use '../../styles/mixins' as mixins .short-card border: solid diff --git a/components/ShortAdCard/ShortAdCard.ts b/src/components/ShortAdCard/ShortAdCard.ts similarity index 75% rename from components/ShortAdCard/ShortAdCard.ts rename to src/components/ShortAdCard/ShortAdCard.ts index 2b2c0192..dff7c47e 100644 --- a/components/ShortAdCard/ShortAdCard.ts +++ b/src/components/ShortAdCard/ShortAdCard.ts @@ -4,12 +4,12 @@ import { AdvertData } from '../../modules/Types'; import { calculateAge } from '../../modules/Utils'; import router from '../../modules/Router'; -class ShortHousing{ +class ShortHousing { #data: AdvertData; #index: number; #age: number; #sex: string; - #clickCallback: (arg0: string, arg1: string)=> void; + #clickCallback: (arg0: string, arg1: string) => void; constructor( data: AdvertData, @@ -18,7 +18,7 @@ class ShortHousing{ ) { this.#data = data; this.#index = index; - this.#age = calculateAge(this.#data.adAuthor.birthDate); + this.#age = calculateAge(this.#data.adAuthor.birthdate); this.#sex = this.#calculateSex(this.#data.adAuthor.sex); this.#clickCallback = callback; } @@ -36,20 +36,21 @@ class ShortHousing{ async #addEventListeners(wrapper: HTMLDivElement): Promise { //При клике на карточку меняется центр карты на это объявление - wrapper.addEventListener('click', ()=>{ + wrapper.addEventListener('click', () => { this.#clickCallback(this.#data.cityName, this.#data.address); }); //При клике на кнопку "Подробнее" переход на страницу объявления - document - .querySelector('.js-more-ads[data-index="'+ this.#index +'"]')!.onclick = ()=>{ - router.navigateTo(`/ads/?id=${this.#data.id}`); - }; + document.querySelector( + '.js-more-ads[data-index="' + this.#index + '"]' + )!.onclick = () => { + router.navigateTo(`/ads/?id=${this.#data.id}`); + }; //При клике на кнопку "Напиши мне" БУДЕТ переход на страницу чата document - .querySelector('.js-new-chat[data-index="'+ this.#index +'"]') - ?.addEventListener('click', ()=>{ + .querySelector('.js-new-chat[data-index="' + this.#index + '"]') + ?.addEventListener('click', () => { console.log(this.#index); }); } @@ -59,13 +60,13 @@ class ShortHousing{ const shortCardWrapper = document.createElement('div'); shortCardWrapper.innerHTML = template({ data: this.#data, - sex: this.#sex, + sex: this.#sex, age: this.#age, - index: this.#index + index: this.#index, }); parent.appendChild(shortCardWrapper); await this.#addEventListeners(shortCardWrapper); } } -export default ShortHousing; \ No newline at end of file +export default ShortHousing; diff --git a/components/Spinner/Spinner.scss b/src/components/Spinner/Spinner.scss similarity index 100% rename from components/Spinner/Spinner.scss rename to src/components/Spinner/Spinner.scss diff --git a/components/Spinner/Spinner.ts b/src/components/Spinner/Spinner.ts similarity index 100% rename from components/Spinner/Spinner.ts rename to src/components/Spinner/Spinner.ts diff --git a/include/handlebars.runtime.js b/src/include/handlebars.runtime.js similarity index 57% rename from include/handlebars.runtime.js rename to src/include/handlebars.runtime.js index 662b5793..3b74b5f7 100644 --- a/include/handlebars.runtime.js +++ b/src/include/handlebars.runtime.js @@ -25,98 +25,98 @@ THE SOFTWARE. */ (function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["Handlebars"] = factory(); - else - root["Handlebars"] = factory(); + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports['Handlebars'] = factory(); + else + root['Handlebars'] = factory(); })(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; + return /******/ (function(modules) { // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; -/******/ // The require function -/******/ function __webpack_require__(moduleId) { + /******/ // The require function + /******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; + /******/ // Check if module is in cache + /******/ if(installedModules[moduleId]) + /******/ return installedModules[moduleId].exports; -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; + /******/ // Create a new module (and put it into the cache) + /******/ var module = installedModules[moduleId] = { + /******/ exports: {}, + /******/ id: moduleId, + /******/ loaded: false + /******/ }; -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + /******/ // Execute the module function + /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ // Flag the module as loaded -/******/ module.loaded = true; + /******/ // Flag the module as loaded + /******/ module.loaded = true; -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; + /******/ // expose the modules object (__webpack_modules__) + /******/ __webpack_require__.m = modules; -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; + /******/ // expose the module cache + /******/ __webpack_require__.c = installedModules; -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; + /******/ // __webpack_public_path__ + /******/ __webpack_require__.p = ''; -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { + /******/ // Load entry module and return exports + /******/ return __webpack_require__(0); + /******/ }) + /************************************************************************/ + /******/ ([ + /* 0 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireWildcard = __webpack_require__(1)['default']; + var _interopRequireWildcard = __webpack_require__(1)['default']; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; + exports.__esModule = true; - var _handlebarsBase = __webpack_require__(3); + var _handlebarsBase = __webpack_require__(3); - var base = _interopRequireWildcard(_handlebarsBase); + var base = _interopRequireWildcard(_handlebarsBase); - // Each of these augment the Handlebars object. No need to setup here. - // (This is done to easily share code between commonjs and browse envs) + // Each of these augment the Handlebars object. No need to setup here. + // (This is done to easily share code between commonjs and browse envs) - var _handlebarsSafeString = __webpack_require__(76); + var _handlebarsSafeString = __webpack_require__(76); - var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); + var _handlebarsSafeString2 = _interopRequireDefault(_handlebarsSafeString); - var _handlebarsException = __webpack_require__(5); + var _handlebarsException = __webpack_require__(5); - var _handlebarsException2 = _interopRequireDefault(_handlebarsException); + var _handlebarsException2 = _interopRequireDefault(_handlebarsException); - var _handlebarsUtils = __webpack_require__(4); + var _handlebarsUtils = __webpack_require__(4); - var Utils = _interopRequireWildcard(_handlebarsUtils); + var Utils = _interopRequireWildcard(_handlebarsUtils); - var _handlebarsRuntime = __webpack_require__(77); + var _handlebarsRuntime = __webpack_require__(77); - var runtime = _interopRequireWildcard(_handlebarsRuntime); + var runtime = _interopRequireWildcard(_handlebarsRuntime); - var _handlebarsNoConflict = __webpack_require__(82); + var _handlebarsNoConflict = __webpack_require__(82); - var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); + var _handlebarsNoConflict2 = _interopRequireDefault(_handlebarsNoConflict); - // For compatibility and usage outside of module systems, make the Handlebars object a namespace - function create() { + // For compatibility and usage outside of module systems, make the Handlebars object a namespace + function create() { var hb = new base.HandlebarsEnvironment(); Utils.extend(hb, base); @@ -131,25 +131,25 @@ return /******/ (function(modules) { // webpackBootstrap }; return hb; - } + } - var inst = create(); - inst.create = create; + var inst = create(); + inst.create = create; - _handlebarsNoConflict2['default'](inst); + _handlebarsNoConflict2['default'](inst); - inst['default'] = inst; + inst['default'] = inst; - exports['default'] = inst; - module.exports = exports['default']; + exports['default'] = inst; + module.exports = exports['default']; -/***/ }), -/* 1 */ -/***/ (function(module, exports) { + /***/ }), + /* 1 */ + /***/ (function(module, exports) { - "use strict"; + 'use strict'; - exports["default"] = function (obj) { + exports['default'] = function (obj) { if (obj && obj.__esModule) { return obj; } else { @@ -161,62 +161,62 @@ return /******/ (function(modules) { // webpackBootstrap } } - newObj["default"] = obj; + newObj['default'] = obj; return newObj; } - }; + }; - exports.__esModule = true; + exports.__esModule = true; -/***/ }), -/* 2 */ -/***/ (function(module, exports) { + /***/ }), + /* 2 */ + /***/ (function(module, exports) { - "use strict"; + 'use strict'; - exports["default"] = function (obj) { + exports['default'] = function (obj) { return obj && obj.__esModule ? obj : { - "default": obj + 'default': obj }; - }; + }; - exports.__esModule = true; + exports.__esModule = true; -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 3 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; - exports.HandlebarsEnvironment = HandlebarsEnvironment; + exports.__esModule = true; + exports.HandlebarsEnvironment = HandlebarsEnvironment; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - var _exception = __webpack_require__(5); + var _exception = __webpack_require__(5); - var _exception2 = _interopRequireDefault(_exception); + var _exception2 = _interopRequireDefault(_exception); - var _helpers = __webpack_require__(9); + var _helpers = __webpack_require__(9); - var _decorators = __webpack_require__(69); + var _decorators = __webpack_require__(69); - var _logger = __webpack_require__(71); + var _logger = __webpack_require__(71); - var _logger2 = _interopRequireDefault(_logger); + var _logger2 = _interopRequireDefault(_logger); - var _internalProtoAccess = __webpack_require__(72); + var _internalProtoAccess = __webpack_require__(72); - var VERSION = '4.7.8'; - exports.VERSION = VERSION; - var COMPILER_REVISION = 8; - exports.COMPILER_REVISION = COMPILER_REVISION; - var LAST_COMPATIBLE_COMPILER_REVISION = 7; + var VERSION = '4.7.8'; + exports.VERSION = VERSION; + var COMPILER_REVISION = 8; + exports.COMPILER_REVISION = COMPILER_REVISION; + var LAST_COMPATIBLE_COMPILER_REVISION = 7; - exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; - var REVISION_CHANGES = { + exports.LAST_COMPATIBLE_COMPILER_REVISION = LAST_COMPATIBLE_COMPILER_REVISION; + var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', 3: '== 1.0.0-rc.4', @@ -225,21 +225,21 @@ return /******/ (function(modules) { // webpackBootstrap 6: '>= 2.0.0-beta.1', 7: '>= 4.0.0 <4.3.0', 8: '>= 4.3.0' - }; + }; - exports.REVISION_CHANGES = REVISION_CHANGES; - var objectType = '[object Object]'; + exports.REVISION_CHANGES = REVISION_CHANGES; + var objectType = '[object Object]'; - function HandlebarsEnvironment(helpers, partials, decorators) { + function HandlebarsEnvironment(helpers, partials, decorators) { this.helpers = helpers || {}; this.partials = partials || {}; this.decorators = decorators || {}; _helpers.registerDefaultHelpers(this); _decorators.registerDefaultDecorators(this); - } + } - HandlebarsEnvironment.prototype = { + HandlebarsEnvironment.prototype = { constructor: HandlebarsEnvironment, logger: _logger2['default'], @@ -293,46 +293,46 @@ return /******/ (function(modules) { // webpackBootstrap resetLoggedPropertyAccesses: function resetLoggedPropertyAccesses() { _internalProtoAccess.resetLoggedProperties(); } - }; + }; - var log = _logger2['default'].log; + var log = _logger2['default'].log; - exports.log = log; - exports.createFrame = _utils.createFrame; - exports.logger = _logger2['default']; + exports.log = log; + exports.createFrame = _utils.createFrame; + exports.logger = _logger2['default']; -/***/ }), -/* 4 */ -/***/ (function(module, exports) { + /***/ }), + /* 4 */ + /***/ (function(module, exports) { - 'use strict'; + 'use strict'; - exports.__esModule = true; - exports.extend = extend; - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.createFrame = createFrame; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { + exports.__esModule = true; + exports.extend = extend; + exports.indexOf = indexOf; + exports.escapeExpression = escapeExpression; + exports.isEmpty = isEmpty; + exports.createFrame = createFrame; + exports.blockParams = blockParams; + exports.appendContextPath = appendContextPath; + var escape = { '&': '&', '<': '<', '>': '>', '"': '"', - "'": ''', + '\'': ''', '`': '`', '=': '=' - }; + }; - var badChars = /[&<>"'`=]/g, + var badChars = /[&<>"'`=]/g, possible = /[&<>"'`=]/; - function escapeChar(chr) { + function escapeChar(chr) { return escape[chr]; - } + } - function extend(obj /* , ...source */) { + function extend(obj /* , ...source */) { for (var i = 1; i < arguments.length; i++) { for (var key in arguments[i]) { if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { @@ -342,46 +342,46 @@ return /******/ (function(modules) { // webpackBootstrap } return obj; - } + } - var toString = Object.prototype.toString; + var toString = Object.prototype.toString; - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /* eslint-disable func-style */ - var isFunction = function isFunction(value) { + exports.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + + var isFunction = function isFunction(value) { return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { + }; + // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ + if (isFunction(/x/)) { exports.isFunction = isFunction = function (value) { return typeof value === 'function' && toString.call(value) === '[object Function]'; }; - } - exports.isFunction = isFunction; + } + exports.isFunction = isFunction; - /* eslint-enable func-style */ + - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { + /* istanbul ignore next */ + var isArray = Array.isArray || function (value) { return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - }; + }; - exports.isArray = isArray; - // Older IE versions do not directly support indexOf so we must implement our own, sadly. + exports.isArray = isArray; + // Older IE versions do not directly support indexOf so we must implement our own, sadly. - function indexOf(array, value) { + function indexOf(array, value) { for (var i = 0, len = array.length; i < len; i++) { if (array[i] === value) { return i; } } return -1; - } + } - function escapeExpression(string) { + function escapeExpression(string) { if (typeof string !== 'string') { // don't escape SafeStrings, since they're already safe if (string && string.toHTML) { @@ -402,9 +402,9 @@ return /******/ (function(modules) { // webpackBootstrap return string; } return string.replace(badChars, escapeChar); - } + } - function isEmpty(value) { + function isEmpty(value) { if (!value && value !== 0) { return true; } else if (isArray(value) && value.length === 0) { @@ -412,35 +412,35 @@ return /******/ (function(modules) { // webpackBootstrap } else { return false; } - } + } - function createFrame(object) { + function createFrame(object) { var frame = extend({}, object); frame._parent = object; return frame; - } + } - function blockParams(params, ids) { + function blockParams(params, ids) { params.path = ids; return params; - } + } - function appendContextPath(contextPath, id) { + function appendContextPath(contextPath, id) { return (contextPath ? contextPath + '.' : '') + id; - } + } -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 5 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _Object$defineProperty = __webpack_require__(6)['default']; + var _Object$defineProperty = __webpack_require__(6)['default']; - exports.__esModule = true; - var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; + exports.__esModule = true; + var errorProps = ['description', 'fileName', 'lineNumber', 'endLineNumber', 'message', 'name', 'number', 'stack']; - function Exception(message, node) { + function Exception(message, node) { var loc = node && node.loc, line = undefined, endLineNumber = undefined, @@ -492,34 +492,34 @@ return /******/ (function(modules) { // webpackBootstrap } catch (nop) { /* Ignore if the browser is very particular */ } - } + } - Exception.prototype = new Error(); + Exception.prototype = new Error(); - exports['default'] = Exception; - module.exports = exports['default']; + exports['default'] = Exception; + module.exports = exports['default']; -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 6 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(7), __esModule: true }; + module.exports = { 'default': __webpack_require__(7), __esModule: true }; -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 7 */ + /***/ (function(module, exports, __webpack_require__) { - var $ = __webpack_require__(8); - module.exports = function defineProperty(it, key, desc){ + var $ = __webpack_require__(8); + module.exports = function defineProperty(it, key, desc){ return $.setDesc(it, key, desc); - }; + }; -/***/ }), -/* 8 */ -/***/ (function(module, exports) { + /***/ }), + /* 8 */ + /***/ (function(module, exports) { - var $Object = Object; - module.exports = { + var $Object = Object; + module.exports = { create: $Object.create, getProto: $Object.getPrototypeOf, isEnum: {}.propertyIsEnumerable, @@ -530,49 +530,49 @@ return /******/ (function(modules) { // webpackBootstrap getNames: $Object.getOwnPropertyNames, getSymbols: $Object.getOwnPropertySymbols, each: [].forEach - }; + }; -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 9 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; - exports.registerDefaultHelpers = registerDefaultHelpers; - exports.moveHelperToHooks = moveHelperToHooks; + exports.__esModule = true; + exports.registerDefaultHelpers = registerDefaultHelpers; + exports.moveHelperToHooks = moveHelperToHooks; - var _helpersBlockHelperMissing = __webpack_require__(10); + var _helpersBlockHelperMissing = __webpack_require__(10); - var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); + var _helpersBlockHelperMissing2 = _interopRequireDefault(_helpersBlockHelperMissing); - var _helpersEach = __webpack_require__(11); + var _helpersEach = __webpack_require__(11); - var _helpersEach2 = _interopRequireDefault(_helpersEach); + var _helpersEach2 = _interopRequireDefault(_helpersEach); - var _helpersHelperMissing = __webpack_require__(64); + var _helpersHelperMissing = __webpack_require__(64); - var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); + var _helpersHelperMissing2 = _interopRequireDefault(_helpersHelperMissing); - var _helpersIf = __webpack_require__(65); + var _helpersIf = __webpack_require__(65); - var _helpersIf2 = _interopRequireDefault(_helpersIf); + var _helpersIf2 = _interopRequireDefault(_helpersIf); - var _helpersLog = __webpack_require__(66); + var _helpersLog = __webpack_require__(66); - var _helpersLog2 = _interopRequireDefault(_helpersLog); + var _helpersLog2 = _interopRequireDefault(_helpersLog); - var _helpersLookup = __webpack_require__(67); + var _helpersLookup = __webpack_require__(67); - var _helpersLookup2 = _interopRequireDefault(_helpersLookup); + var _helpersLookup2 = _interopRequireDefault(_helpersLookup); - var _helpersWith = __webpack_require__(68); + var _helpersWith = __webpack_require__(68); - var _helpersWith2 = _interopRequireDefault(_helpersWith); + var _helpersWith2 = _interopRequireDefault(_helpersWith); - function registerDefaultHelpers(instance) { + function registerDefaultHelpers(instance) { _helpersBlockHelperMissing2['default'](instance); _helpersEach2['default'](instance); _helpersHelperMissing2['default'](instance); @@ -580,28 +580,28 @@ return /******/ (function(modules) { // webpackBootstrap _helpersLog2['default'](instance); _helpersLookup2['default'](instance); _helpersWith2['default'](instance); - } + } - function moveHelperToHooks(instance, helperName, keepHelper) { + function moveHelperToHooks(instance, helperName, keepHelper) { if (instance.helpers[helperName]) { instance.hooks[helperName] = instance.helpers[helperName]; if (!keepHelper) { delete instance.helpers[helperName]; } } - } + } -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 10 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - exports.__esModule = true; + exports.__esModule = true; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('blockHelperMissing', function (context, options) { var inverse = options.inverse, fn = options.fn; @@ -630,35 +630,35 @@ return /******/ (function(modules) { // webpackBootstrap return fn(context, options); } }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 11 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _Symbol = __webpack_require__(12)['default']; + var _Symbol = __webpack_require__(12)['default']; - var _Symbol$iterator = __webpack_require__(42)['default']; + var _Symbol$iterator = __webpack_require__(42)['default']; - var _getIterator = __webpack_require__(54)['default']; + var _getIterator = __webpack_require__(54)['default']; - var _Object$keys = __webpack_require__(59)['default']; + var _Object$keys = __webpack_require__(59)['default']; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; + exports.__esModule = true; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - var _exception = __webpack_require__(5); + var _exception = __webpack_require__(5); - var _exception2 = _interopRequireDefault(_exception); + var _exception2 = _interopRequireDefault(_exception); - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('each', function (context, options) { if (!options) { throw new _exception2['default']('Must pass iterator to #each'); @@ -745,31 +745,31 @@ return /******/ (function(modules) { // webpackBootstrap return ret; }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 12 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(13), __esModule: true }; + module.exports = { 'default': __webpack_require__(13), __esModule: true }; -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 13 */ + /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(14); - __webpack_require__(41); - module.exports = __webpack_require__(20).Symbol; + __webpack_require__(14); + __webpack_require__(41); + module.exports = __webpack_require__(20).Symbol; -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 14 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - // ECMAScript 6 symbols shim - var $ = __webpack_require__(8) + 'use strict'; + // ECMAScript 6 symbols shim + var $ = __webpack_require__(8) , global = __webpack_require__(15) , has = __webpack_require__(16) , DESCRIPTORS = __webpack_require__(17) @@ -802,19 +802,19 @@ return /******/ (function(modules) { // webpackBootstrap , useNative = typeof $Symbol == 'function' , ObjectProto = Object.prototype; - // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 - var setSymbolDesc = DESCRIPTORS && $fails(function(){ + // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 + var setSymbolDesc = DESCRIPTORS && $fails(function(){ return _create(setDesc({}, 'a', { get: function(){ return setDesc(this, 'a', {value: 7}).a; } })).a != 7; - }) ? function(it, key, D){ + }) ? function(it, key, D){ var protoDesc = getDesc(ObjectProto, key); if(protoDesc)delete ObjectProto[key]; setDesc(it, key, D); if(protoDesc && it !== ObjectProto)setDesc(ObjectProto, key, protoDesc); - } : setDesc; + } : setDesc; - var wrap = function(tag){ + var wrap = function(tag){ var sym = AllSymbols[tag] = _create($Symbol.prototype); sym._k = tag; DESCRIPTORS && setter && setSymbolDesc(ObjectProto, tag, { @@ -825,13 +825,13 @@ return /******/ (function(modules) { // webpackBootstrap } }); return sym; - }; + }; - var isSymbol = function(it){ + var isSymbol = function(it){ return typeof it == 'symbol'; - }; + }; - var $defineProperty = function defineProperty(it, key, D){ + var $defineProperty = function defineProperty(it, key, D){ if(D && has(AllSymbols, key)){ if(!D.enumerable){ if(!has(it, HIDDEN))setDesc(it, HIDDEN, createDesc(1, {})); @@ -841,8 +841,8 @@ return /******/ (function(modules) { // webpackBootstrap D = _create(D, {enumerable: createDesc(0, false)}); } return setSymbolDesc(it, key, D); } return setDesc(it, key, D); - }; - var $defineProperties = function defineProperties(it, P){ + }; + var $defineProperties = function defineProperties(it, P){ anObject(it); var keys = enumKeys(P = toIObject(P)) , i = 0 @@ -850,37 +850,37 @@ return /******/ (function(modules) { // webpackBootstrap , key; while(l > i)$defineProperty(it, key = keys[i++], P[key]); return it; - }; - var $create = function create(it, P){ + }; + var $create = function create(it, P){ return P === undefined ? _create(it) : $defineProperties(_create(it), P); - }; - var $propertyIsEnumerable = function propertyIsEnumerable(key){ + }; + var $propertyIsEnumerable = function propertyIsEnumerable(key){ var E = isEnum.call(this, key); return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; - }; - var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ + }; + var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ var D = getDesc(it = toIObject(it), key); if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; return D; - }; - var $getOwnPropertyNames = function getOwnPropertyNames(it){ + }; + var $getOwnPropertyNames = function getOwnPropertyNames(it){ var names = getNames(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i)if(!has(AllSymbols, key = names[i++]) && key != HIDDEN)result.push(key); return result; - }; - var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ + }; + var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ var names = getNames(toIObject(it)) , result = [] , i = 0 , key; while(names.length > i)if(has(AllSymbols, key = names[i++]))result.push(AllSymbols[key]); return result; - }; - var $stringify = function stringify(it){ + }; + var $stringify = function stringify(it){ if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined var args = [it] , i = 1 @@ -895,17 +895,17 @@ return /******/ (function(modules) { // webpackBootstrap }; args[1] = replacer; return _stringify.apply($JSON, args); - }; - var buggyJSON = $fails(function(){ + }; + var buggyJSON = $fails(function(){ var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null // V8 throws on boxed symbols return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; - }); + }); - // 19.4.1.1 Symbol([description]) - if(!useNative){ + // 19.4.1.1 Symbol([description]) + if(!useNative){ $Symbol = function Symbol(){ if(isSymbol(this))throw TypeError('Symbol is not a constructor'); return wrap(uid(arguments.length > 0 ? arguments[0] : undefined)); @@ -929,9 +929,9 @@ return /******/ (function(modules) { // webpackBootstrap if(DESCRIPTORS && !__webpack_require__(40)){ redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } - } + } - var symbolStatics = { + var symbolStatics = { // 19.4.2.1 Symbol.for(key) 'for': function(key){ return has(SymbolRegistry, key += '') @@ -944,33 +944,33 @@ return /******/ (function(modules) { // webpackBootstrap }, useSetter: function(){ setter = true; }, useSimple: function(){ setter = false; } - }; - // 19.4.2.2 Symbol.hasInstance - // 19.4.2.3 Symbol.isConcatSpreadable - // 19.4.2.4 Symbol.iterator - // 19.4.2.6 Symbol.match - // 19.4.2.8 Symbol.replace - // 19.4.2.9 Symbol.search - // 19.4.2.10 Symbol.species - // 19.4.2.11 Symbol.split - // 19.4.2.12 Symbol.toPrimitive - // 19.4.2.13 Symbol.toStringTag - // 19.4.2.14 Symbol.unscopables - $.each.call(( + }; + // 19.4.2.2 Symbol.hasInstance + // 19.4.2.3 Symbol.isConcatSpreadable + // 19.4.2.4 Symbol.iterator + // 19.4.2.6 Symbol.match + // 19.4.2.8 Symbol.replace + // 19.4.2.9 Symbol.search + // 19.4.2.10 Symbol.species + // 19.4.2.11 Symbol.split + // 19.4.2.12 Symbol.toPrimitive + // 19.4.2.13 Symbol.toStringTag + // 19.4.2.14 Symbol.unscopables + $.each.call(( 'hasInstance,isConcatSpreadable,iterator,match,replace,search,' + 'species,split,toPrimitive,toStringTag,unscopables' - ).split(','), function(it){ + ).split(','), function(it){ var sym = wks(it); symbolStatics[it] = useNative ? sym : wrap(sym); - }); + }); - setter = true; + setter = true; - $export($export.G + $export.W, {Symbol: $Symbol}); + $export($export.G + $export.W, {Symbol: $Symbol}); - $export($export.S, 'Symbol', symbolStatics); + $export($export.S, 'Symbol', symbolStatics); - $export($export.S + $export.F * !useNative, 'Object', { + $export($export.S + $export.F * !useNative, 'Object', { // 19.1.2.2 Object.create(O [, Properties]) create: $create, // 19.1.2.4 Object.defineProperty(O, P, Attributes) @@ -983,67 +983,67 @@ return /******/ (function(modules) { // webpackBootstrap getOwnPropertyNames: $getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: $getOwnPropertySymbols - }); + }); - // 24.3.2 JSON.stringify(value [, replacer [, space]]) - $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify}); + // 24.3.2 JSON.stringify(value [, replacer [, space]]) + $JSON && $export($export.S + $export.F * (!useNative || buggyJSON), 'JSON', {stringify: $stringify}); - // 19.4.3.5 Symbol.prototype[@@toStringTag] - setToStringTag($Symbol, 'Symbol'); - // 20.2.1.9 Math[@@toStringTag] - setToStringTag(Math, 'Math', true); - // 24.3.3 JSON[@@toStringTag] - setToStringTag(global.JSON, 'JSON', true); + // 19.4.3.5 Symbol.prototype[@@toStringTag] + setToStringTag($Symbol, 'Symbol'); + // 20.2.1.9 Math[@@toStringTag] + setToStringTag(Math, 'Math', true); + // 24.3.3 JSON[@@toStringTag] + setToStringTag(global.JSON, 'JSON', true); -/***/ }), -/* 15 */ -/***/ (function(module, exports) { + /***/ }), + /* 15 */ + /***/ (function(module, exports) { - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math + // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 + var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); - if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef -/***/ }), -/* 16 */ -/***/ (function(module, exports) { + /***/ }), + /* 16 */ + /***/ (function(module, exports) { - var hasOwnProperty = {}.hasOwnProperty; - module.exports = function(it, key){ + var hasOwnProperty = {}.hasOwnProperty; + module.exports = function(it, key){ return hasOwnProperty.call(it, key); - }; + }; -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 17 */ + /***/ (function(module, exports, __webpack_require__) { - // Thank's IE8 for his funny defineProperty - module.exports = !__webpack_require__(18)(function(){ + // Thank's IE8 for his funny defineProperty + module.exports = !__webpack_require__(18)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; - }); + }); -/***/ }), -/* 18 */ -/***/ (function(module, exports) { + /***/ }), + /* 18 */ + /***/ (function(module, exports) { - module.exports = function(exec){ + module.exports = function(exec){ try { return !!exec(); } catch(e){ return true; } - }; + }; -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 19 */ + /***/ (function(module, exports, __webpack_require__) { - var global = __webpack_require__(15) + var global = __webpack_require__(15) , core = __webpack_require__(20) , ctx = __webpack_require__(21) , PROTOTYPE = 'prototype'; - var $export = function(type, name, source){ + var $export = function(type, name, source){ var IS_FORCED = type & $export.F , IS_GLOBAL = type & $export.G , IS_STATIC = type & $export.S @@ -1075,30 +1075,30 @@ return /******/ (function(modules) { // webpackBootstrap })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; if(IS_PROTO)(exports[PROTOTYPE] || (exports[PROTOTYPE] = {}))[key] = out; } - }; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - module.exports = $export; - -/***/ }), -/* 20 */ -/***/ (function(module, exports) { - - var core = module.exports = {version: '1.2.6'}; - if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - - // optional / simple context binding - var aFunction = __webpack_require__(22); - module.exports = function(fn, that, length){ + }; + // type bitmap + $export.F = 1; // forced + $export.G = 2; // global + $export.S = 4; // static + $export.P = 8; // proto + $export.B = 16; // bind + $export.W = 32; // wrap + module.exports = $export; + + /***/ }), + /* 20 */ + /***/ (function(module, exports) { + + var core = module.exports = {version: '1.2.6'}; + if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef + + /***/ }), + /* 21 */ + /***/ (function(module, exports, __webpack_require__) { + + // optional / simple context binding + var aFunction = __webpack_require__(22); + module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; switch(length){ @@ -1115,182 +1115,182 @@ return /******/ (function(modules) { // webpackBootstrap return function(/* ...args */){ return fn.apply(that, arguments); }; - }; + }; -/***/ }), -/* 22 */ -/***/ (function(module, exports) { + /***/ }), + /* 22 */ + /***/ (function(module, exports) { - module.exports = function(it){ + module.exports = function(it){ if(typeof it != 'function')throw TypeError(it + ' is not a function!'); return it; - }; + }; -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 23 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(24); + module.exports = __webpack_require__(24); -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 24 */ + /***/ (function(module, exports, __webpack_require__) { - var $ = __webpack_require__(8) + var $ = __webpack_require__(8) , createDesc = __webpack_require__(25); - module.exports = __webpack_require__(17) ? function(object, key, value){ + module.exports = __webpack_require__(17) ? function(object, key, value){ return $.setDesc(object, key, createDesc(1, value)); - } : function(object, key, value){ + } : function(object, key, value){ object[key] = value; return object; - }; + }; -/***/ }), -/* 25 */ -/***/ (function(module, exports) { + /***/ }), + /* 25 */ + /***/ (function(module, exports) { - module.exports = function(bitmap, value){ + module.exports = function(bitmap, value){ return { enumerable : !(bitmap & 1), configurable: !(bitmap & 2), writable : !(bitmap & 4), value : value }; - }; + }; -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 26 */ + /***/ (function(module, exports, __webpack_require__) { - var global = __webpack_require__(15) + var global = __webpack_require__(15) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); - module.exports = function(key){ + module.exports = function(key){ return store[key] || (store[key] = {}); - }; + }; -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 27 */ + /***/ (function(module, exports, __webpack_require__) { - var def = __webpack_require__(8).setDesc + var def = __webpack_require__(8).setDesc , has = __webpack_require__(16) , TAG = __webpack_require__(28)('toStringTag'); - module.exports = function(it, tag, stat){ + module.exports = function(it, tag, stat){ if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); - }; + }; -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 28 */ + /***/ (function(module, exports, __webpack_require__) { - var store = __webpack_require__(26)('wks') + var store = __webpack_require__(26)('wks') , uid = __webpack_require__(29) , Symbol = __webpack_require__(15).Symbol; - module.exports = function(name){ + module.exports = function(name){ return store[name] || (store[name] = Symbol && Symbol[name] || (Symbol || uid)('Symbol.' + name)); - }; + }; -/***/ }), -/* 29 */ -/***/ (function(module, exports) { + /***/ }), + /* 29 */ + /***/ (function(module, exports) { - var id = 0 + var id = 0 , px = Math.random(); - module.exports = function(key){ + module.exports = function(key){ return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); - }; + }; -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 30 */ + /***/ (function(module, exports, __webpack_require__) { - var $ = __webpack_require__(8) + var $ = __webpack_require__(8) , toIObject = __webpack_require__(31); - module.exports = function(object, el){ + module.exports = function(object, el){ var O = toIObject(object) , keys = $.getKeys(O) , length = keys.length , index = 0 , key; while(length > index)if(O[key = keys[index++]] === el)return key; - }; + }; -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 31 */ + /***/ (function(module, exports, __webpack_require__) { - // to indexed object, toObject with fallback for non-array-like ES3 strings - var IObject = __webpack_require__(32) + // to indexed object, toObject with fallback for non-array-like ES3 strings + var IObject = __webpack_require__(32) , defined = __webpack_require__(34); - module.exports = function(it){ + module.exports = function(it){ return IObject(defined(it)); - }; + }; -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 32 */ + /***/ (function(module, exports, __webpack_require__) { - // fallback for non-array-like ES3 and non-enumerable old V8 strings - var cof = __webpack_require__(33); - module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ + // fallback for non-array-like ES3 and non-enumerable old V8 strings + var cof = __webpack_require__(33); + module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); - }; + }; -/***/ }), -/* 33 */ -/***/ (function(module, exports) { + /***/ }), + /* 33 */ + /***/ (function(module, exports) { - var toString = {}.toString; + var toString = {}.toString; - module.exports = function(it){ + module.exports = function(it){ return toString.call(it).slice(8, -1); - }; + }; -/***/ }), -/* 34 */ -/***/ (function(module, exports) { + /***/ }), + /* 34 */ + /***/ (function(module, exports) { - // 7.2.1 RequireObjectCoercible(argument) - module.exports = function(it){ - if(it == undefined)throw TypeError("Can't call method on " + it); + // 7.2.1 RequireObjectCoercible(argument) + module.exports = function(it){ + if(it == undefined)throw TypeError('Can\'t call method on ' + it); return it; - }; + }; -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 35 */ + /***/ (function(module, exports, __webpack_require__) { - // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window - var toIObject = __webpack_require__(31) + // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + var toIObject = __webpack_require__(31) , getNames = __webpack_require__(8).getNames , toString = {}.toString; - var windowNames = typeof window == 'object' && Object.getOwnPropertyNames + var windowNames = typeof window == 'object' && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; - var getWindowNames = function(it){ + var getWindowNames = function(it){ try { return getNames(it); } catch(e){ return windowNames.slice(); } - }; + }; - module.exports.get = function getOwnPropertyNames(it){ + module.exports.get = function getOwnPropertyNames(it){ if(windowNames && toString.call(it) == '[object Window]')return getWindowNames(it); return getNames(toIObject(it)); - }; + }; -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 36 */ + /***/ (function(module, exports, __webpack_require__) { - // all enumerable object keys, includes symbols - var $ = __webpack_require__(8); - module.exports = function(it){ + // all enumerable object keys, includes symbols + var $ = __webpack_require__(8); + module.exports = function(it){ var keys = $.getKeys(it) , getSymbols = $.getSymbols; if(getSymbols){ @@ -1301,75 +1301,75 @@ return /******/ (function(modules) { // webpackBootstrap while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))keys.push(key); } return keys; - }; + }; -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 37 */ + /***/ (function(module, exports, __webpack_require__) { - // 7.2.2 IsArray(argument) - var cof = __webpack_require__(33); - module.exports = Array.isArray || function(arg){ + // 7.2.2 IsArray(argument) + var cof = __webpack_require__(33); + module.exports = Array.isArray || function(arg){ return cof(arg) == 'Array'; - }; + }; -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 38 */ + /***/ (function(module, exports, __webpack_require__) { - var isObject = __webpack_require__(39); - module.exports = function(it){ + var isObject = __webpack_require__(39); + module.exports = function(it){ if(!isObject(it))throw TypeError(it + ' is not an object!'); return it; - }; + }; -/***/ }), -/* 39 */ -/***/ (function(module, exports) { + /***/ }), + /* 39 */ + /***/ (function(module, exports) { - module.exports = function(it){ + module.exports = function(it){ return typeof it === 'object' ? it !== null : typeof it === 'function'; - }; + }; -/***/ }), -/* 40 */ -/***/ (function(module, exports) { + /***/ }), + /* 40 */ + /***/ (function(module, exports) { - module.exports = true; + module.exports = true; -/***/ }), -/* 41 */ -/***/ (function(module, exports) { + /***/ }), + /* 41 */ + /***/ (function(module, exports) { -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 42 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(43), __esModule: true }; + module.exports = { 'default': __webpack_require__(43), __esModule: true }; -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 43 */ + /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(44); - __webpack_require__(50); - module.exports = __webpack_require__(28)('iterator'); + __webpack_require__(44); + __webpack_require__(50); + module.exports = __webpack_require__(28)('iterator'); -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 44 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - var $at = __webpack_require__(45)(true); + 'use strict'; + var $at = __webpack_require__(45)(true); - // 21.1.3.27 String.prototype[@@iterator]() - __webpack_require__(47)(String, 'String', function(iterated){ + // 21.1.3.27 String.prototype[@@iterator]() + __webpack_require__(47)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index - // 21.1.5.2.1 %StringIteratorPrototype%.next() - }, function(){ + // 21.1.5.2.1 %StringIteratorPrototype%.next() + }, function(){ var O = this._t , index = this._i , point; @@ -1377,17 +1377,17 @@ return /******/ (function(modules) { // webpackBootstrap point = $at(O, index); this._i += point.length; return {value: point, done: false}; - }); + }); -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 45 */ + /***/ (function(module, exports, __webpack_require__) { - var toInteger = __webpack_require__(46) + var toInteger = __webpack_require__(46) , defined = __webpack_require__(34); - // true -> String#at - // false -> String#codePointAt - module.exports = function(TO_STRING){ + // true -> String#at + // false -> String#codePointAt + module.exports = function(TO_STRING){ return function(that, pos){ var s = String(defined(that)) , i = toInteger(pos) @@ -1399,25 +1399,25 @@ return /******/ (function(modules) { // webpackBootstrap ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; - }; + }; -/***/ }), -/* 46 */ -/***/ (function(module, exports) { + /***/ }), + /* 46 */ + /***/ (function(module, exports) { - // 7.1.4 ToInteger - var ceil = Math.ceil + // 7.1.4 ToInteger + var ceil = Math.ceil , floor = Math.floor; - module.exports = function(it){ + module.exports = function(it){ return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); - }; + }; -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 47 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - var LIBRARY = __webpack_require__(40) + 'use strict'; + var LIBRARY = __webpack_require__(40) , $export = __webpack_require__(19) , redefine = __webpack_require__(23) , hide = __webpack_require__(24) @@ -1432,9 +1432,9 @@ return /******/ (function(modules) { // webpackBootstrap , KEYS = 'keys' , VALUES = 'values'; - var returnThis = function(){ return this; }; + var returnThis = function(){ return this; }; - module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ + module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ $iterCreate(Constructor, NAME, next); var getMethod = function(kind){ if(!BUGGY && kind in proto)return proto[kind]; @@ -1481,60 +1481,60 @@ return /******/ (function(modules) { // webpackBootstrap } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; - }; + }; -/***/ }), -/* 48 */ -/***/ (function(module, exports) { + /***/ }), + /* 48 */ + /***/ (function(module, exports) { - module.exports = {}; + module.exports = {}; -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 49 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - var $ = __webpack_require__(8) + 'use strict'; + var $ = __webpack_require__(8) , descriptor = __webpack_require__(25) , setToStringTag = __webpack_require__(27) , IteratorPrototype = {}; - // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() - __webpack_require__(24)(IteratorPrototype, __webpack_require__(28)('iterator'), function(){ return this; }); + // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + __webpack_require__(24)(IteratorPrototype, __webpack_require__(28)('iterator'), function(){ return this; }); - module.exports = function(Constructor, NAME, next){ + module.exports = function(Constructor, NAME, next){ Constructor.prototype = $.create(IteratorPrototype, {next: descriptor(1, next)}); setToStringTag(Constructor, NAME + ' Iterator'); - }; + }; -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 50 */ + /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(51); - var Iterators = __webpack_require__(48); - Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; + __webpack_require__(51); + var Iterators = __webpack_require__(48); + Iterators.NodeList = Iterators.HTMLCollection = Iterators.Array; -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 51 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; - var addToUnscopables = __webpack_require__(52) + 'use strict'; + var addToUnscopables = __webpack_require__(52) , step = __webpack_require__(53) , Iterators = __webpack_require__(48) , toIObject = __webpack_require__(31); - // 22.1.3.4 Array.prototype.entries() - // 22.1.3.13 Array.prototype.keys() - // 22.1.3.29 Array.prototype.values() - // 22.1.3.30 Array.prototype[@@iterator]() - module.exports = __webpack_require__(47)(Array, 'Array', function(iterated, kind){ + // 22.1.3.4 Array.prototype.entries() + // 22.1.3.13 Array.prototype.keys() + // 22.1.3.29 Array.prototype.values() + // 22.1.3.30 Array.prototype[@@iterator]() + module.exports = __webpack_require__(47)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind - // 22.1.5.2.1 %ArrayIteratorPrototype%.next() - }, function(){ + // 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, function(){ var O = this._t , kind = this._k , index = this._i++; @@ -1545,79 +1545,79 @@ return /******/ (function(modules) { // webpackBootstrap if(kind == 'keys' )return step(0, index); if(kind == 'values')return step(0, O[index]); return step(0, [index, O[index]]); - }, 'values'); + }, 'values'); - // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) - Iterators.Arguments = Iterators.Array; + // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + Iterators.Arguments = Iterators.Array; - addToUnscopables('keys'); - addToUnscopables('values'); - addToUnscopables('entries'); + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); -/***/ }), -/* 52 */ -/***/ (function(module, exports) { + /***/ }), + /* 52 */ + /***/ (function(module, exports) { - module.exports = function(){ /* empty */ }; + module.exports = function(){ /* empty */ }; -/***/ }), -/* 53 */ -/***/ (function(module, exports) { + /***/ }), + /* 53 */ + /***/ (function(module, exports) { - module.exports = function(done, value){ + module.exports = function(done, value){ return {value: value, done: !!done}; - }; + }; -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 54 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(55), __esModule: true }; + module.exports = { 'default': __webpack_require__(55), __esModule: true }; -/***/ }), -/* 55 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 55 */ + /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(50); - __webpack_require__(44); - module.exports = __webpack_require__(56); + __webpack_require__(50); + __webpack_require__(44); + module.exports = __webpack_require__(56); -/***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 56 */ + /***/ (function(module, exports, __webpack_require__) { - var anObject = __webpack_require__(38) + var anObject = __webpack_require__(38) , get = __webpack_require__(57); - module.exports = __webpack_require__(20).getIterator = function(it){ + module.exports = __webpack_require__(20).getIterator = function(it){ var iterFn = get(it); if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); return anObject(iterFn.call(it)); - }; + }; -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 57 */ + /***/ (function(module, exports, __webpack_require__) { - var classof = __webpack_require__(58) + var classof = __webpack_require__(58) , ITERATOR = __webpack_require__(28)('iterator') , Iterators = __webpack_require__(48); - module.exports = __webpack_require__(20).getIteratorMethod = function(it){ + module.exports = __webpack_require__(20).getIteratorMethod = function(it){ if(it != undefined)return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; - }; + }; -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 58 */ + /***/ (function(module, exports, __webpack_require__) { - // getting tag from 19.1.3.6 Object.prototype.toString() - var cof = __webpack_require__(33) + // getting tag from 19.1.3.6 Object.prototype.toString() + var cof = __webpack_require__(33) , TAG = __webpack_require__(28)('toStringTag') // ES3 wrong here , ARG = cof(function(){ return arguments; }()) == 'Arguments'; - module.exports = function(it){ + module.exports = function(it){ var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case @@ -1626,74 +1626,74 @@ return /******/ (function(modules) { // webpackBootstrap : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; - }; + }; -/***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 59 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(60), __esModule: true }; + module.exports = { 'default': __webpack_require__(60), __esModule: true }; -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 60 */ + /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(61); - module.exports = __webpack_require__(20).Object.keys; + __webpack_require__(61); + module.exports = __webpack_require__(20).Object.keys; -/***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 61 */ + /***/ (function(module, exports, __webpack_require__) { - // 19.1.2.14 Object.keys(O) - var toObject = __webpack_require__(62); + // 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(62); - __webpack_require__(63)('keys', function($keys){ + __webpack_require__(63)('keys', function($keys){ return function keys(it){ return $keys(toObject(it)); }; - }); + }); -/***/ }), -/* 62 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 62 */ + /***/ (function(module, exports, __webpack_require__) { - // 7.1.13 ToObject(argument) - var defined = __webpack_require__(34); - module.exports = function(it){ + // 7.1.13 ToObject(argument) + var defined = __webpack_require__(34); + module.exports = function(it){ return Object(defined(it)); - }; + }; -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 63 */ + /***/ (function(module, exports, __webpack_require__) { - // most Object methods by ES6 should accept primitives - var $export = __webpack_require__(19) + // most Object methods by ES6 should accept primitives + var $export = __webpack_require__(19) , core = __webpack_require__(20) , fails = __webpack_require__(18); - module.exports = function(KEY, exec){ + module.exports = function(KEY, exec){ var fn = (core.Object || {})[KEY] || Object[KEY] , exp = {}; exp[KEY] = exec(fn); $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); - }; + }; -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 64 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; + exports.__esModule = true; - var _exception = __webpack_require__(5); + var _exception = __webpack_require__(5); - var _exception2 = _interopRequireDefault(_exception); + var _exception2 = _interopRequireDefault(_exception); - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('helperMissing', function () /* [args, ]options */{ if (arguments.length === 1) { // A missing field in a {{foo}} construct. @@ -1703,27 +1703,27 @@ return /******/ (function(modules) { // webpackBootstrap throw new _exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); } }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 65 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; + exports.__esModule = true; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - var _exception = __webpack_require__(5); + var _exception = __webpack_require__(5); - var _exception2 = _interopRequireDefault(_exception); + var _exception2 = _interopRequireDefault(_exception); - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('if', function (conditional, options) { if (arguments.length != 2) { throw new _exception2['default']('#if requires exactly one argument'); @@ -1752,19 +1752,19 @@ return /******/ (function(modules) { // webpackBootstrap hash: options.hash }); }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 66 */ -/***/ (function(module, exports) { + /***/ }), + /* 66 */ + /***/ (function(module, exports) { - 'use strict'; + 'use strict'; - exports.__esModule = true; + exports.__esModule = true; - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('log', function () /* message, options */{ var args = [undefined], options = arguments[arguments.length - 1]; @@ -1782,19 +1782,19 @@ return /******/ (function(modules) { // webpackBootstrap instance.log.apply(instance, args); }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 67 */ -/***/ (function(module, exports) { + /***/ }), + /* 67 */ + /***/ (function(module, exports) { - 'use strict'; + 'use strict'; - exports.__esModule = true; + exports.__esModule = true; - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('lookup', function (obj, field, options) { if (!obj) { // Note for 5.0: Change to "obj == null" in 5.0 @@ -1802,27 +1802,27 @@ return /******/ (function(modules) { // webpackBootstrap } return options.lookupProperty(obj, field); }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 68 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; + exports.__esModule = true; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - var _exception = __webpack_require__(5); + var _exception = __webpack_require__(5); - var _exception2 = _interopRequireDefault(_exception); + var _exception2 = _interopRequireDefault(_exception); - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerHelper('with', function (context, options) { if (arguments.length != 2) { throw new _exception2['default']('#with requires exactly one argument'); @@ -1848,40 +1848,40 @@ return /******/ (function(modules) { // webpackBootstrap return options.inverse(this); } }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 69 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; - exports.registerDefaultDecorators = registerDefaultDecorators; + exports.__esModule = true; + exports.registerDefaultDecorators = registerDefaultDecorators; - var _decoratorsInline = __webpack_require__(70); + var _decoratorsInline = __webpack_require__(70); - var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); + var _decoratorsInline2 = _interopRequireDefault(_decoratorsInline); - function registerDefaultDecorators(instance) { + function registerDefaultDecorators(instance) { _decoratorsInline2['default'](instance); - } + } -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 70 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - exports.__esModule = true; + exports.__esModule = true; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - exports['default'] = function (instance) { + exports['default'] = function (instance) { instance.registerDecorator('inline', function (fn, props, container, options) { var ret = fn; if (!props.partials) { @@ -1900,21 +1900,21 @@ return /******/ (function(modules) { // webpackBootstrap return ret; }); - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 71 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - exports.__esModule = true; + exports.__esModule = true; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - var logger = { + var logger = { methodMap: ['debug', 'info', 'warn', 'error'], level: 'info', @@ -1938,7 +1938,7 @@ return /******/ (function(modules) { // webpackBootstrap if (typeof console !== 'undefined' && logger.lookupLevel(logger.level) <= level) { var method = logger.methodMap[level]; - // eslint-disable-next-line no-console + if (!console[method]) { method = 'log'; } @@ -1947,40 +1947,40 @@ return /******/ (function(modules) { // webpackBootstrap message[_key - 1] = arguments[_key]; } - console[method].apply(console, message); // eslint-disable-line no-console + console[method].apply(console, message); } } - }; + }; - exports['default'] = logger; - module.exports = exports['default']; + exports['default'] = logger; + module.exports = exports['default']; -/***/ }), -/* 72 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 72 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _Object$create = __webpack_require__(73)['default']; + var _Object$create = __webpack_require__(73)['default']; - var _Object$keys = __webpack_require__(59)['default']; + var _Object$keys = __webpack_require__(59)['default']; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; - exports.createProtoAccessControl = createProtoAccessControl; - exports.resultIsAllowed = resultIsAllowed; - exports.resetLoggedProperties = resetLoggedProperties; + exports.__esModule = true; + exports.createProtoAccessControl = createProtoAccessControl; + exports.resultIsAllowed = resultIsAllowed; + exports.resetLoggedProperties = resetLoggedProperties; - var _createNewLookupObject = __webpack_require__(75); + var _createNewLookupObject = __webpack_require__(75); - var _logger = __webpack_require__(71); + var _logger = __webpack_require__(71); - var _logger2 = _interopRequireDefault(_logger); + var _logger2 = _interopRequireDefault(_logger); - var loggedProperties = _Object$create(null); + var loggedProperties = _Object$create(null); - function createProtoAccessControl(runtimeOptions) { + function createProtoAccessControl(runtimeOptions) { var defaultMethodWhiteList = _Object$create(null); defaultMethodWhiteList['constructor'] = false; defaultMethodWhiteList['__defineGetter__'] = false; @@ -1988,7 +1988,7 @@ return /******/ (function(modules) { // webpackBootstrap defaultMethodWhiteList['__lookupGetter__'] = false; var defaultPropertyWhiteList = _Object$create(null); - // eslint-disable-next-line no-proto + defaultPropertyWhiteList['__proto__'] = false; return { @@ -2001,17 +2001,17 @@ return /******/ (function(modules) { // webpackBootstrap defaultValue: runtimeOptions.allowProtoMethodsByDefault } }; - } + } - function resultIsAllowed(result, protoAccessControl, propertyName) { + function resultIsAllowed(result, protoAccessControl, propertyName) { if (typeof result === 'function') { return checkWhiteList(protoAccessControl.methods, propertyName); } else { return checkWhiteList(protoAccessControl.properties, propertyName); } - } + } - function checkWhiteList(protoAccessControlForType, propertyName) { + function checkWhiteList(protoAccessControlForType, propertyName) { if (protoAccessControlForType.whitelist[propertyName] !== undefined) { return protoAccessControlForType.whitelist[propertyName] === true; } @@ -2020,122 +2020,122 @@ return /******/ (function(modules) { // webpackBootstrap } logUnexpecedPropertyAccessOnce(propertyName); return false; - } + } - function logUnexpecedPropertyAccessOnce(propertyName) { + function logUnexpecedPropertyAccessOnce(propertyName) { if (loggedProperties[propertyName] !== true) { loggedProperties[propertyName] = true; _logger2['default'].log('error', 'Handlebars: Access has been denied to resolve the property "' + propertyName + '" because it is not an "own property" of its parent.\n' + 'You can add a runtime option to disable the check or this warning:\n' + 'See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'); } - } + } - function resetLoggedProperties() { + function resetLoggedProperties() { _Object$keys(loggedProperties).forEach(function (propertyName) { delete loggedProperties[propertyName]; }); - } + } -/***/ }), -/* 73 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 73 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(74), __esModule: true }; + module.exports = { 'default': __webpack_require__(74), __esModule: true }; -/***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 74 */ + /***/ (function(module, exports, __webpack_require__) { - var $ = __webpack_require__(8); - module.exports = function create(P, D){ + var $ = __webpack_require__(8); + module.exports = function create(P, D){ return $.create(P, D); - }; + }; -/***/ }), -/* 75 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 75 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _Object$create = __webpack_require__(73)['default']; + var _Object$create = __webpack_require__(73)['default']; - exports.__esModule = true; - exports.createNewLookupObject = createNewLookupObject; + exports.__esModule = true; + exports.createNewLookupObject = createNewLookupObject; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - /** + /** * Create a new object with "null"-prototype to avoid truthy results on prototype properties. * The resulting object can be used with "object[property]" to check if a property exists * @param {...object} sources a varargs parameter of source objects that will be merged * @returns {object} */ - function createNewLookupObject() { + function createNewLookupObject() { for (var _len = arguments.length, sources = Array(_len), _key = 0; _key < _len; _key++) { sources[_key] = arguments[_key]; } return _utils.extend.apply(undefined, [_Object$create(null)].concat(sources)); - } + } -/***/ }), -/* 76 */ -/***/ (function(module, exports) { + /***/ }), + /* 76 */ + /***/ (function(module, exports) { - // Build out our basic SafeString type - 'use strict'; + // Build out our basic SafeString type + 'use strict'; - exports.__esModule = true; - function SafeString(string) { + exports.__esModule = true; + function SafeString(string) { this.string = string; - } + } - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { + SafeString.prototype.toString = SafeString.prototype.toHTML = function () { return '' + this.string; - }; + }; - exports['default'] = SafeString; - module.exports = exports['default']; + exports['default'] = SafeString; + module.exports = exports['default']; -/***/ }), -/* 77 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 77 */ + /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + 'use strict'; - var _Object$seal = __webpack_require__(78)['default']; + var _Object$seal = __webpack_require__(78)['default']; - var _Object$keys = __webpack_require__(59)['default']; + var _Object$keys = __webpack_require__(59)['default']; - var _interopRequireWildcard = __webpack_require__(1)['default']; + var _interopRequireWildcard = __webpack_require__(1)['default']; - var _interopRequireDefault = __webpack_require__(2)['default']; + var _interopRequireDefault = __webpack_require__(2)['default']; - exports.__esModule = true; - exports.checkRevision = checkRevision; - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; + exports.__esModule = true; + exports.checkRevision = checkRevision; + exports.template = template; + exports.wrapProgram = wrapProgram; + exports.resolvePartial = resolvePartial; + exports.invokePartial = invokePartial; + exports.noop = noop; - var _utils = __webpack_require__(4); + var _utils = __webpack_require__(4); - var Utils = _interopRequireWildcard(_utils); + var Utils = _interopRequireWildcard(_utils); - var _exception = __webpack_require__(5); + var _exception = __webpack_require__(5); - var _exception2 = _interopRequireDefault(_exception); + var _exception2 = _interopRequireDefault(_exception); - var _base = __webpack_require__(3); + var _base = __webpack_require__(3); - var _helpers = __webpack_require__(9); + var _helpers = __webpack_require__(9); - var _internalWrapHelper = __webpack_require__(81); + var _internalWrapHelper = __webpack_require__(81); - var _internalProtoAccess = __webpack_require__(72); + var _internalProtoAccess = __webpack_require__(72); - function checkRevision(compilerInfo) { + function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = _base.COMPILER_REVISION; @@ -2151,9 +2151,9 @@ return /******/ (function(modules) { // webpackBootstrap // Use the embedded version info since the runtime doesn't know about this revision yet throw new _exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); } - } + } - function template(templateSpec, env) { + function template(templateSpec, env) { /* istanbul ignore next */ if (!env) { throw new _exception2['default']('No environment passed to template'); @@ -2358,9 +2358,9 @@ return /******/ (function(modules) { // webpackBootstrap return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); }; return ret; - } + } - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { + function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { function prog(context) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; @@ -2378,13 +2378,13 @@ return /******/ (function(modules) { // webpackBootstrap prog.depth = depths ? depths.length : 0; prog.blockParams = declaredBlockParams || 0; return prog; - } + } - /** + /** * This is currently part of the official API, therefore implementation details should not be changed. */ - function resolvePartial(partial, context, options) { + function resolvePartial(partial, context, options) { if (!partial) { if (options.name === '@partial-block') { partial = options.data['partial-block']; @@ -2397,9 +2397,9 @@ return /******/ (function(modules) { // webpackBootstrap partial = options.partials[partial]; } return partial; - } + } - function invokePartial(partial, context, options) { + function invokePartial(partial, context, options) { // Use the current closure context to save the partial-block if this partial var currentPartialBlock = options.data && options.data['partial-block']; options.partial = true; @@ -2437,79 +2437,79 @@ return /******/ (function(modules) { // webpackBootstrap } else if (partial instanceof Function) { return partial(context, options); } - } + } - function noop() { + function noop() { return ''; - } + } - function initData(context, data) { + function initData(context, data) { if (!data || !('root' in data)) { data = data ? _base.createFrame(data) : {}; data.root = context; } return data; - } + } - function executeDecorators(fn, prog, container, depths, data, blockParams) { + function executeDecorators(fn, prog, container, depths, data, blockParams) { if (fn.decorator) { var props = {}; prog = fn.decorator(prog, props, container, depths && depths[0], data, blockParams, depths); Utils.extend(prog, props); } return prog; - } + } - function wrapHelpersToPassLookupProperty(mergedHelpers, container) { + function wrapHelpersToPassLookupProperty(mergedHelpers, container) { _Object$keys(mergedHelpers).forEach(function (helperName) { var helper = mergedHelpers[helperName]; mergedHelpers[helperName] = passLookupPropertyOption(helper, container); }); - } + } - function passLookupPropertyOption(helper, container) { + function passLookupPropertyOption(helper, container) { var lookupProperty = container.lookupProperty; return _internalWrapHelper.wrapHelper(helper, function (options) { return Utils.extend({ lookupProperty: lookupProperty }, options); }); - } + } -/***/ }), -/* 78 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 78 */ + /***/ (function(module, exports, __webpack_require__) { - module.exports = { "default": __webpack_require__(79), __esModule: true }; + module.exports = { 'default': __webpack_require__(79), __esModule: true }; -/***/ }), -/* 79 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 79 */ + /***/ (function(module, exports, __webpack_require__) { - __webpack_require__(80); - module.exports = __webpack_require__(20).Object.seal; + __webpack_require__(80); + module.exports = __webpack_require__(20).Object.seal; -/***/ }), -/* 80 */ -/***/ (function(module, exports, __webpack_require__) { + /***/ }), + /* 80 */ + /***/ (function(module, exports, __webpack_require__) { - // 19.1.2.17 Object.seal(O) - var isObject = __webpack_require__(39); + // 19.1.2.17 Object.seal(O) + var isObject = __webpack_require__(39); - __webpack_require__(63)('seal', function($seal){ + __webpack_require__(63)('seal', function($seal){ return function seal(it){ return $seal && isObject(it) ? $seal(it) : it; }; - }); + }); -/***/ }), -/* 81 */ -/***/ (function(module, exports) { + /***/ }), + /* 81 */ + /***/ (function(module, exports) { - 'use strict'; + 'use strict'; - exports.__esModule = true; - exports.wrapHelper = wrapHelper; + exports.__esModule = true; + exports.wrapHelper = wrapHelper; - function wrapHelper(helper, transformOptionsFn) { + function wrapHelper(helper, transformOptionsFn) { if (typeof helper !== 'function') { // This should not happen, but apparently it does in https://github.com/wycats/handlebars.js/issues/1639 // We try to make the wrapper least-invasive by not wrapping it, if the helper is not a function. @@ -2521,18 +2521,18 @@ return /******/ (function(modules) { // webpackBootstrap return helper.apply(this, arguments); }; return wrapper; - } + } -/***/ }), -/* 82 */ -/***/ (function(module, exports) { + /***/ }), + /* 82 */ + /***/ (function(module, exports) { - /* global globalThis */ - 'use strict'; + /* global globalThis */ + 'use strict'; - exports.__esModule = true; + exports.__esModule = true; - exports['default'] = function (Handlebars) { + exports['default'] = function (Handlebars) { /* istanbul ignore next */ // https://mathiasbynens.be/notes/globalthis (function () { @@ -2553,11 +2553,11 @@ return /******/ (function(modules) { // webpackBootstrap } return Handlebars; }; - }; + }; - module.exports = exports['default']; + module.exports = exports['default']; -/***/ }) -/******/ ]) + /***/ }) + /******/ ]); }); ; \ No newline at end of file diff --git a/index.ts b/src/index.ts similarity index 80% rename from index.ts rename to src/index.ts index 9963eeea..9bd5c2ce 100644 --- a/index.ts +++ b/src/index.ts @@ -4,19 +4,19 @@ import Header from './components/Header/Header'; import AuthPopup from './components/AuthPopup/AuthPopup'; import ProfilePopup from './components/ProfilePopup/ProfilePopup'; -import MainPage from './components/MainPage/MainPage'; -import ProfilePage from './components/ProfilePage/ProfilePage'; -import CityPage from './components/CityPage/CityPage'; -import MapPage from './components/MapPage/MapPage'; +import MainPage from './pages/MainPage/MainPage'; +import ProfilePage from './pages/ProfilePage/ProfilePage'; +import CityPage from './pages/CityPage/CityPage'; +import MapPage from './pages/MapPage/MapPage'; import { clearPage } from './modules/Clear'; -import './components/precompiled-templates'; +import '../precompiled-templates.js'; import APIService from './modules/ApiClient'; -import AdPage from './components/AdPage/AdPage'; +import AdPage from './pages/AdPage/AdPage'; import ApiClient from './modules/ApiClient'; -import EditAdvertPage from './components/EditAdvertPage/EditAdvertPage'; -import AdListPage from './components/AdListPage/AdListPage'; +import EditAdvertPage from './pages/EditAdvertPage/EditAdvertPage'; +import AdListPage from './pages/AdListPage/AdListPage'; const root = document.getElementById('root')!; const pageContainer = document.createElement('div'); @@ -24,6 +24,7 @@ const pageContainer = document.createElement('div'); import router from './modules/Router'; import { HorizontalAdCardData } from './components/HorizontalAdCard/HorizontalAdCard'; import { getCookie } from './modules/Utils'; +import globalStore from './modules/GlobalStore'; const renderMainPage = async () => { const data = await ApiClient.getAds(); @@ -45,7 +46,7 @@ const renderFavoritesPage = () => {}; const renderNotificationsPage = () => {}; const renderAdvertPage = async (id: string) => { - const info = (await ApiClient.getAd(id))['place']; + const info = await ApiClient.getAd(id); const authorInfo = await ApiClient.getUser(info.authorUUID); const page = new AdPage(pageContainer, info, authorInfo); @@ -53,7 +54,7 @@ const renderAdvertPage = async (id: string) => { }; const renderEditAdvertPage = async (uuid: string) => { - const info = (await ApiClient.getAd(uuid))['place']; + const info = await ApiClient.getAd(uuid); const page = new EditAdvertPage('edit', info); pageContainer.appendChild(page.getElement()); @@ -80,7 +81,7 @@ const renderProfilePage = async () => { await profilePage.render(pageContainer); }; -const renderAdListPage = async () => { +const renderAdListPage = async (action: 'edit' | undefined, adId: string) => { const sessionData = await APIService.getSessionData(); const userId = sessionData['id']; const isHost = (await ApiClient.getUser(userId))['isHost']; @@ -109,6 +110,12 @@ const renderAdListPage = async () => { } const page = AdListPage(horizontalAdCardData, isHost); pageContainer.appendChild(page); + + if (action === 'edit') { + requestAnimationFrame(() => { + document.getElementById(`housing-card-${adId}`)?.click(); + }); + } }; /** Объект с коллбеками для header`а */ @@ -132,6 +139,9 @@ const renderHeader = async () => { if (getCookie('session_id')) { try { sessionData = await APIService.getSessionData(); + + globalStore.auth.isAuthorized = true; + globalStore.auth.userId = sessionData.id; } catch { // } @@ -160,7 +170,8 @@ router.addRoute('/ads/', async (params: URLSearchParams) => { const author = params.get('author'); if (author === 'me') { - await renderAdListPage(); + const action = params.get('action'); + await renderAdListPage(action, adId); } else if (!action && adId) { await renderAdvertPage(adId); } else if (action === 'edit' && adId) { diff --git a/modules/Ajax.ts b/src/modules/Ajax.ts similarity index 100% rename from modules/Ajax.ts rename to src/modules/Ajax.ts diff --git a/modules/ApiClient.ts b/src/modules/ApiClient.ts similarity index 90% rename from modules/ApiClient.ts rename to src/modules/ApiClient.ts index 3f35937a..1d3b8f0d 100644 --- a/modules/ApiClient.ts +++ b/src/modules/ApiClient.ts @@ -1,7 +1,13 @@ 'use strict'; import Ajax from './Ajax'; -import { RegisterParams, AdsFilters, LoginParams, EditParams, ReviewData } from './Types'; +import { + RegisterParams, + AdsFilters, + LoginParams, + EditParams, + ReviewData, +} from './Types'; interface Limit { limit: number; @@ -16,7 +22,7 @@ class APIClient { * @public * @description Получает список объявлений */ - async getAds(filters?: AdsFilters, limit?:Limit) { + async getAds(filters?: AdsFilters, limit?: Limit) { try { let url = '/housing?'; @@ -66,7 +72,7 @@ class APIClient { async getAd(uuid: string) { const response = await Ajax.get(this.BASE_URL + `/housing/${uuid}`); const adInfo = await response.json(); - return adInfo; + return adInfo['place']; } async deleteAd(uuid: string) { @@ -188,7 +194,7 @@ class APIClient { name: name, email: email, sex: sex, - birthDate: birthdate, + birthdate: birthdate, isHost: isHost, }; @@ -200,16 +206,16 @@ class APIClient { return Ajax.put({ url, body: formData }); } - async leaveReview({hostId, title, text, rating}: ReviewData) { + async leaveReview({ hostId, title, text, rating }: ReviewData) { const url = this.BASE_URL + '/reviews'; const body = { hostId: hostId, title: title, text: text, - rating: rating + rating: rating, }; - return Ajax.post({url, body}); + return Ajax.post({ url, body }); } async getReviewsByUser(uuid: string) { diff --git a/modules/Clear.ts b/src/modules/Clear.ts similarity index 100% rename from modules/Clear.ts rename to src/modules/Clear.ts diff --git a/src/modules/GlobalStore.ts b/src/modules/GlobalStore.ts new file mode 100644 index 00000000..97d1e193 --- /dev/null +++ b/src/modules/GlobalStore.ts @@ -0,0 +1,8 @@ +const globalStore = { + auth: { + isAuthorized: false as boolean, + userId: null as string | null, + }, +}; + +export default globalStore; diff --git a/modules/Router.ts b/src/modules/Router.ts similarity index 100% rename from modules/Router.ts rename to src/modules/Router.ts diff --git a/modules/Types.ts b/src/modules/Types.ts similarity index 92% rename from modules/Types.ts rename to src/modules/Types.ts index 70ba8cad..35d155e3 100644 --- a/modules/Types.ts +++ b/src/modules/Types.ts @@ -25,7 +25,7 @@ export interface AdvertData { id: number; path: string; }[]; - city: string; + cityName: string; address: string; description: string; publicationDate: string; @@ -54,7 +54,7 @@ export interface City { export interface ProfileInfo { avatar: string; - birthDate: string; + birthdate: string; email: string; guestCount: number; id: string; diff --git a/modules/Utils.ts b/src/modules/Utils.ts similarity index 100% rename from modules/Utils.ts rename to src/modules/Utils.ts diff --git a/src/pages/AdListPage/AdListPage.hbs b/src/pages/AdListPage/AdListPage.hbs new file mode 100644 index 00000000..06fe7c8c --- /dev/null +++ b/src/pages/AdListPage/AdListPage.hbs @@ -0,0 +1,39 @@ +
+ {{#if isHost}} + +
+
+
+

Список объявлений

+ +
+
+ {{#if empty}} +

Здесь пока + пусто... 🕳️

+ {{/if}} +
+
+ +
+ +
+

Подсказка

+

Кликните по объявлению, + чтобы отредактировать его.

+

Чтобы добавить новое + объявление, нажмите на кнопку "Добавить объявление".

+
+
+
+ + {{else}} + +

🚫Вы не являетесь хостом, + поэтому не можете создавать объявления.

+

Если вы хотите стать хостом, + пожалуйста, измените свой статус в настройках

+ + {{/if}} +
\ No newline at end of file diff --git a/src/pages/AdListPage/AdListPage.scss b/src/pages/AdListPage/AdListPage.scss new file mode 100644 index 00000000..c370aa19 --- /dev/null +++ b/src/pages/AdListPage/AdListPage.scss @@ -0,0 +1,117 @@ +@use '../../styles/mixins'; + +.ad-list-page { + margin-top: 40px; + width: 90%; + margin: 0 auto; + + &__left-content { + min-width: 50%; + } + + &__content-container { + display: flex; + flex-direction: row; + gap: 40px; + } + + &__title { + font-weight: 500; + } + &__upper-container { + display: flex; + justify-content: space-between; + align-items: end; + margin: 20px 0; + } + &__add-button { + @include mixins.button; + background-color: #ff5255; + } + &__adverts-container { + display: flex; + flex-direction: column; + gap: 0; + min-width: 50%; + } + &__no-adverts-text { + margin-top: 50px; + text-align: center; + font-size: 26px; + } + &__not-host-message { + margin-top: 90px; + font-size: 40px; + text-align: center; + } + + &__right { + display: flex; + margin-top: 80px; + border: 2px solid #e4e4e4; + border-radius: 4px; + padding: 20px; + } + + &__hint { + display: flex; + flex-direction: column; + gap: 20px; + padding: 30px; + + &--hidden { + display: none; + } + + &__header { + font-size: 32px; + font-weight: 500; + } + + &__text { + font-size: 20px; + } + } +} + +@media screen and (max-width: 900px) { + $button-height: 20px; + .ad-list-page { + &__upper-container { + display: flex; + text-align: center; + flex-direction: column; + justify-content: center; + align-items: center; + } + } + .horizontal-ad-card { + border: 1px solid black; + border-radius: 10px; + width: 100%; + display: flex; + flex-direction: column; + gap: 40px; + padding: 10px; + transition: 0.3s all; + + &__buttons-container { + flex-wrap: wrap; + } + &__open-btn { + @include mixins.button; + width: fit-content; + height: $button-height; + background-color: #5289ff; + } + &__edit-btn { + @include mixins.button; + height: $button-height; + } + &__del-btn { + @include mixins.button; + background-color: #ff5900; + height: $button-height; + } + } +} diff --git a/src/pages/AdListPage/AdListPage.ts b/src/pages/AdListPage/AdListPage.ts new file mode 100644 index 00000000..506960b0 --- /dev/null +++ b/src/pages/AdListPage/AdListPage.ts @@ -0,0 +1,88 @@ +'use strict'; + +import ApiClient from '../../modules/ApiClient'; +import router from '../../modules/Router'; +import HorizontalAdCard from '../../components/HorizontalAdCard/HorizontalAdCard'; + +import { HorizontalAdCardData } from '../../components/HorizontalAdCard/HorizontalAdCard'; +import EditAdvertPage from '../EditAdvertPage/EditAdvertPage'; + +function AdListPage(data: HorizontalAdCardData[], isHost: boolean) { + const pageContainer = document.createElement('div'); + + const template = Handlebars.templates['AdListPage.hbs']; + + pageContainer.innerHTML = template({ + ...data, + empty: data.length === 0, + isHost: isHost, + }); + if (!isHost) { + return pageContainer; + } + + requestAnimationFrame(() => { + const advertListElement = + pageContainer.querySelector('.js-advert-list'); + const createAdvertElement = pageContainer.querySelector( + '.js-add-btn' + ) as HTMLButtonElement; + + const root = document.getElementById( + 'js-ad-edit-container' + ) as HTMLDivElement; + const hint = root.querySelector('.ad-list-page__hint') as HTMLElement; + + const onCloseButtonClick = () => { + root.replaceChildren(hint); + hint.classList.remove('ad-list-page__hint--hidden'); + }; + + createAdvertElement.onclick = () => { + const page = new EditAdvertPage({ + action: 'create', + onCloseButtonClick: onCloseButtonClick, + }); + + hint.classList.add('ad-list-page__hint--hidden'); + + root.replaceChildren(hint, page.getElement()); + }; + + for (const d of data) { + const card = HorizontalAdCard( + { + id: d.id, + cityName: d.cityName, + address: d.address, + image: d.image, + }, + { + onOpen: (uuid: string) => + router.navigateTo(`/ads/?id=${uuid}`), + onEdit: async (uuid: string) => { + const data = await ApiClient.getAd(uuid); + const page = new EditAdvertPage({ + action: 'edit', + data, + onCloseButtonClick, + }); + const root = document.getElementById( + 'js-ad-edit-container' + ) as HTMLDivElement; + root.replaceChildren(page.getElement()); + }, + onDel: async (uuid: string) => { + await ApiClient.deleteAd(uuid); + router.navigateTo(location.href); + }, + } + ); + advertListElement?.appendChild(card); + } + }); + + return pageContainer; +} + +export default AdListPage; diff --git a/components/AdPage/AdPage.hbs b/src/pages/AdPage/AdPage.hbs similarity index 63% rename from components/AdPage/AdPage.hbs rename to src/pages/AdPage/AdPage.hbs index 8e67288f..eaa5f499 100644 --- a/components/AdPage/AdPage.hbs +++ b/src/pages/AdPage/AdPage.hbs @@ -97,16 +97,23 @@ - \ No newline at end of file diff --git a/components/AdPage/AdPage.scss b/src/pages/AdPage/AdPage.scss similarity index 54% rename from components/AdPage/AdPage.scss rename to src/pages/AdPage/AdPage.scss index afef0ad9..d0bba3ac 100644 --- a/components/AdPage/AdPage.scss +++ b/src/pages/AdPage/AdPage.scss @@ -1,4 +1,4 @@ -@use '../../mixins'; +@use '../../styles/mixins'; $secondary-card-size: 64px; @@ -60,7 +60,7 @@ $secondary-card-size: 64px; position: relative; overflow: hidden; width: 100%; - height: 500px; + height: 450px; border-radius: 5px; border: none; scroll-snap-align: start; @@ -116,32 +116,176 @@ $secondary-card-size: 64px; } } } -} -.ad-page__fullscreen-overlay { - top: 0; - left: 0; - width: 100vw; - height: 100vh; - position: fixed; - z-index: 3; - display: flex; - justify-content: center; - align-items: center; - background: #00000063; + &__desc { + margin: 30px 0; + font-size: 17px; + line-height: 1.5; + } + + &__info-table { + margin-top: 70px; + border-radius: 10px; + + display: flex; + flex-direction: column; + font-size: 17px; + + &__title { + margin: 20px 0; + font-weight: 500; + font-size: 27px; + } - &__image { - top: 50%; - left: 50%; - width: auto; - height: 85vh; + &__row { + display: flex; + justify-content: space-between; + gap: 20px; + border-bottom: 1px solid #e8e9ec; + padding: 10px 0; + font-weight: 400; + + &:last-child { + border-bottom: none; + } + } + + &__label { + color: #737a8e; + } + &__value { + text-align: right; + } + } + + &__fullscreen-overlay { + top: 0; + left: 0; + width: 100vw; + height: 100vh; + position: fixed; z-index: 3; - cursor: zoom-out; + display: flex; + justify-content: center; + align-items: center; + background: #00000063; + + &__image { + top: 50%; + left: 50%; + width: auto; + height: 85vh; + z-index: 3; + cursor: zoom-out; + } + &_hidden { + display: none; + } } - &_hidden { - display: none; + + &__author-info { + position: sticky; + top: 30px; + display: flex; + flex-direction: column; + width: 350px; + height: 400px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); + background-color: #fff; + align-items: center; + border-radius: 5px; + + &::before { + content: ''; + width: 100%; + height: 190px; + background: #e5f0ff; + top: 0; + } + + &__avatar { + width: 90px; + aspect-ratio: 1/1; + object-fit: cover; + margin-top: -40px; + border: 5px solid #fff; + border-radius: 50%; + } + + &__hoster-text { + padding: 10px 0; + color: #737a8e; + font-weight: 500; + font-size: 13px; + } + + &__name { + font-size: 20px; + font-weight: 500; + text-decoration: none; + color: #000; + + &:hover { + text-decoration: underline; + } + } + + &__inner-content { + margin-top: 30px; + width: 100%; + height: 100%; + padding: 0 20px; + box-sizing: border-box; + display: flex; + flex-direction: column; + gap: 20px; + } + + &__desc { + background: #f1f2f4; + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + padding: 10px 10px; + box-sizing: border-box; + border-radius: 4px; + + &__item { + display: flex; + flex-direction: column; + } + + &__term { + color: #737a8e; + font-size: 12px; + } + + &__definition { + font-size: 14px; + font-weight: 500; + } + } + + &__buttons { + display: flex; + flex-direction: column; + gap: 10px; + } + + &__write-msg-button { + @include mixins.button; + width: 100%; + } + + &__edit-button { + @include mixins.button; + width: 100%; + background-color: #0077cc; + } } } + .advert-apps { display: flex; flex-direction: row; @@ -172,123 +316,7 @@ $secondary-card-size: 64px; } } } -.advert-desc { - margin-top: 20px; - border-radius: 10px; - border: 1px solid #000; - padding: 30px; - - &__text-data { - display: grid; - grid-template-columns: 1fr 7fr; - gap: 14px; - } - &__label { - font-weight: 600; - } - &__value { - font-weight: 500; - } - // PROFILE -} -.ad-page-profile-container { - border: solid; - border-width: 1px; - border-radius: 10px; - display: flex; - flex-direction: column; - height: min-content; - max-width: 280px; - padding: 10px 20px; - background-color: white; - gap: 10px; - &__center { - color: #000; - text-align: center; - text-decoration: none; - - &:visited { - text-decoration: none; - } - &:hover { - text-decoration: underline; - } - } - - &_photo { - border: solid; - border-radius: 50%; - border-width: 1px; - width: 200px; - height: 200px; - margin-top: 10%; - } - &__photo__img1 { - border-radius: 50%; - object-fit: cover; - width: 200px; - height: 200px; - } - &__p1 { - margin-top: 5%; - font-size: 28px; - font-weight: 500; - } - &__p2 { - margin-top: 5%; - font-size: 20px; - } - &__hr { - width: 100%; - } - &__raiting { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - padding-left: 10px; - width: 100%; - margin-top: 5%; - } - &__score-container { - display: flex; - align-items: center; - } - &_img2 { - width: fit-content; - padding-right: 10px; - } - &__score { - font-size: 20px; - font-weight: 300; - } - &__div { - gap: 10px; - display: flex; - width: 100%; - flex-direction: row; - align-items: center; - margin-top: 5%; - justify-content: space-between; - width: fit-content; - } - &__p { - font-size: 20px; - } - &__info { - font-size: 20px; - } - &__write-msg-button { - @include mixins.button; - } - &__show-on-map-button { - color: #808080; - text-align: center; - margin-bottom: 10px; - cursor: pointer; - } -} @media screen and (max-width: 900px) { .ad-page { display: flex; diff --git a/components/AdPage/AdPage.ts b/src/pages/AdPage/AdPage.ts similarity index 84% rename from components/AdPage/AdPage.ts rename to src/pages/AdPage/AdPage.ts index 5d93d19f..483a43e0 100644 --- a/components/AdPage/AdPage.ts +++ b/src/pages/AdPage/AdPage.ts @@ -2,7 +2,9 @@ import { AdvertData, ProfileInfo } from '../../modules/Types'; import { calculateAge } from '../../modules/Utils'; -import ReactiveComponent from '../ReactiveComponent/ReactiveComponent'; +import ReactiveComponent from '../../components/ReactiveComponent/ReactiveComponent'; +import globalStore from '../../modules/GlobalStore'; +import router from '../../modules/Router'; const SECONDARY_IMG_SELECTOR = '.js-carousel-img'; const FULLSCREEN_OVERLAY_SELECTOR = '.js-fullscreen-overlay'; @@ -32,8 +34,9 @@ export default class AdPage extends ReactiveComponent { templateData: { ...data, ...authorInfo, - age: calculateAge(authorInfo.birthDate), + age: calculateAge(authorInfo.birthdate), sex: authorInfo.sex === 'M' ? 'Мужской' : 'Женский', + isAuthor: data.authorUUID === globalStore.auth.userId, }, }); } @@ -98,6 +101,14 @@ export default class AdPage extends ReactiveComponent { ); }; + document + .getElementById('edit-button') + ?.addEventListener('click', () => { + router.navigateTo( + `/ads/?author=me&action=edit&id=${this.templateData.id}` + ); + }); + carouselImages.forEach((el: HTMLImageElement, index) => { el.onclick = () => { this.showImage(carousel, carouselImages, index); diff --git a/components/CityPage/CityPage.sass b/src/pages/CityPage/CityPage.sass similarity index 100% rename from components/CityPage/CityPage.sass rename to src/pages/CityPage/CityPage.sass diff --git a/components/CityPage/CityPage.ts b/src/pages/CityPage/CityPage.ts similarity index 96% rename from components/CityPage/CityPage.ts rename to src/pages/CityPage/CityPage.ts index f584788b..286177aa 100644 --- a/components/CityPage/CityPage.ts +++ b/src/pages/CityPage/CityPage.ts @@ -1,7 +1,7 @@ 'use strict'; -import Filter from '../Filter/Filter'; -import AdCard from '../AdCard/AdCard'; +import Filter from '../../components/Filter/Filter'; +import AdCard from '../../components/AdCard/AdCard'; import ApiClient from '../../modules/ApiClient'; import { AdvertData } from '../../modules/Types'; @@ -29,7 +29,6 @@ class CityPage { const infoResponse = await ApiClient.getCity(name); if (infoResponse.ok) { const data = await infoResponse.json(); - console.log(data); this.#name = data.city['title']; this.#description = data.city['description']; this.#photo = data.city['image']; @@ -69,7 +68,6 @@ class CityPage { #renderFilter(pageContent: HTMLDivElement): void { const filter = new Filter(async (filters) => { filters.location = this.#queryName; - console.log(filters); const data = await ApiClient.getAds(filters); this.#places = data; document.querySelector('.advert')!.remove(); diff --git a/components/CityPage/CityPhoto.hbs b/src/pages/CityPage/CityPhoto.hbs similarity index 100% rename from components/CityPage/CityPhoto.hbs rename to src/pages/CityPage/CityPhoto.hbs diff --git a/src/pages/EditAdvertPage/EditAdvertPage.hbs b/src/pages/EditAdvertPage/EditAdvertPage.hbs new file mode 100644 index 00000000..6ab3955b --- /dev/null +++ b/src/pages/EditAdvertPage/EditAdvertPage.hbs @@ -0,0 +1,96 @@ +
+ close-cross + + +
+ {{#each inputs}} + + {{#if this.isTextArea}} + + {{else if this.isSelect}} + + + {{else}} + }} + /> + {{/if}} + {{/each}} + +
+ +
+ +
+ +
\ No newline at end of file diff --git a/components/EditAdvertPage/EditAdvertPage.scss b/src/pages/EditAdvertPage/EditAdvertPage.scss similarity index 86% rename from components/EditAdvertPage/EditAdvertPage.scss rename to src/pages/EditAdvertPage/EditAdvertPage.scss index d58de543..782eb127 100644 --- a/components/EditAdvertPage/EditAdvertPage.scss +++ b/src/pages/EditAdvertPage/EditAdvertPage.scss @@ -1,20 +1,23 @@ -@use '../../mixins'; +@use '../../styles/mixins'; $secondary-card-size: 64px; .edit-ad-page { - max-width: 70%; - margin: 50px auto; - display: grid; - grid-template-areas: 'main aside'; - gap: 5%; + display: flex; + flex-direction: column; + + position: relative; + + &__close-cross { + width: 32px; + cursor: pointer; + margin-left: auto; + } &__btn { @include mixins.button; } - grid-template-columns: 2fr 1fr; - &__fullscreen-overlay { top: 0; left: 0; @@ -56,8 +59,9 @@ $secondary-card-size: 64px; font-size: 16px; width: 100%; box-sizing: border-box; - border: 1px solid black; + border: 1px solid #b0b2b8; border-radius: 5px; + font-family: inherit; } &__text-area { resize: vertical; @@ -66,15 +70,17 @@ $secondary-card-size: 64px; font-size: 16px; width: 100%; box-sizing: border-box; - border: 1px solid black; + border: 1px solid #b0b2b8; border-radius: 5px; + font-family: inherit; } &__select { width: 100%; - border: 1px solid #000; + border: 1px solid #b0b2b8; border-radius: 5px; padding: 5px 8px; font-size: 16px; + font-family: inherit; cursor: pointer; background-color: #fff; } diff --git a/components/EditAdvertPage/EditAdvertPage.ts b/src/pages/EditAdvertPage/EditAdvertPage.ts similarity index 89% rename from components/EditAdvertPage/EditAdvertPage.ts rename to src/pages/EditAdvertPage/EditAdvertPage.ts index 2e374e8b..1c1745e0 100644 --- a/components/EditAdvertPage/EditAdvertPage.ts +++ b/src/pages/EditAdvertPage/EditAdvertPage.ts @@ -6,7 +6,7 @@ import router from '../../modules/Router'; import { City, AdvertData } from '../../modules/Types'; import { validateImage } from '../../modules/Utils'; -import PopupAlert from '../PopupAlert/PopupAlert'; +import PopupAlert from '../../components/PopupAlert/PopupAlert'; const MAIN_IMG_DIV_SELECTOR = '.js-main-img-div'; const MAIN_IMG_SELECTOR = '.edit-advert-images-carousel__main-img'; @@ -44,12 +44,12 @@ interface InputConfig { export default class EditAdvertPage { #templateContainer: HTMLDivElement; - #mainImg: HTMLImageElement; - #carouselImages: NodeListOf; + #mainImg!: HTMLImageElement; + #carouselImages!: NodeListOf; #currentIndex: number; - #backgroundImg: HTMLImageElement; - #fullscreenImage: HTMLImageElement; - #overlay: HTMLDivElement; + #backgroundImg!: HTMLImageElement; + #fullscreenImage!: HTMLImageElement; + #overlay!: HTMLDivElement; #images: { id: number; path: string; @@ -60,7 +60,17 @@ export default class EditAdvertPage { #id: string | undefined; #secondaryImageTemplate: HandlebarsTemplateDelegate; - constructor(action: 'create' | 'edit', data?: AdvertData) { + private onCloseButtonClick; + + constructor({ + action, + data, + onCloseButtonClick, + }: { + action: 'create' | 'edit'; + data?: AdvertData; + onCloseButtonClick?: () => void; + }) { this.#action = action; this.#id = data?.id; this.#images = data?.images ? data.images : []; @@ -73,6 +83,7 @@ export default class EditAdvertPage { const template = Handlebars.templates['EditAdvertPage.hbs']; this.#templateContainer = document.createElement('div'); + this.onCloseButtonClick = onCloseButtonClick; ApiClient.getCities().then((cities: City[]) => { const selectOptions: SelectOption[] = []; @@ -81,7 +92,7 @@ export default class EditAdvertPage { selectOptions.push({ name: city.title, value: city.title, - selected: data?.city === city.title, + selected: data?.cityName === city.title, }); } @@ -92,7 +103,7 @@ export default class EditAdvertPage { type: 'text', isSelect: true, options: selectOptions, - value: data?.city, + value: data?.cityName, }, { label: 'Адрес', @@ -285,8 +296,16 @@ export default class EditAdvertPage { .querySelector('.js-form') ?.addEventListener('submit', this.#submitData); + if (this.onCloseButtonClick) { + ( + document.getElementById( + 'js-edit-ad-page-close-cross' + ) as HTMLImageElement + ).onclick = () => this.onCloseButtonClick!(); + } + for (const button of document.querySelectorAll('.js-del-img-button')) { - button.onclick = this.#onDeleteImage; + (button as HTMLButtonElement).onclick = this.#onDeleteImage; } } diff --git a/components/EditAdvertPage/SecondaryImage.hbs b/src/pages/EditAdvertPage/SecondaryImage.hbs similarity index 100% rename from components/EditAdvertPage/SecondaryImage.hbs rename to src/pages/EditAdvertPage/SecondaryImage.hbs diff --git a/components/MainPage/MainPage.scss b/src/pages/MainPage/MainPage.scss similarity index 100% rename from components/MainPage/MainPage.scss rename to src/pages/MainPage/MainPage.scss diff --git a/components/MainPage/MainPage.ts b/src/pages/MainPage/MainPage.ts similarity index 91% rename from components/MainPage/MainPage.ts rename to src/pages/MainPage/MainPage.ts index 06c3f767..c2be47bc 100644 --- a/components/MainPage/MainPage.ts +++ b/src/pages/MainPage/MainPage.ts @@ -1,9 +1,9 @@ 'use strict'; -import Filter from '../Filter/Filter'; -import AdCard from '../AdCard/AdCard'; +import Filter from '../../components/Filter/Filter'; +import AdCard from '../../components/AdCard/AdCard'; import { AdvertData } from '../../modules/Types'; -import MainPhoto from '../MainPhoto/MainPhoto'; +import MainPhoto from '../../components/MainPhoto/MainPhoto'; import ApiClient from '../../modules/ApiClient'; /** Главная страница с витриной объявлений, поиском и фильтрами */ diff --git a/components/MapPage/MapPage.sass b/src/pages/MapPage/MapPage.sass similarity index 89% rename from components/MapPage/MapPage.sass rename to src/pages/MapPage/MapPage.sass index 61191ea5..79260b4a 100644 --- a/components/MapPage/MapPage.sass +++ b/src/pages/MapPage/MapPage.sass @@ -9,7 +9,7 @@ grid-area: people position: absolute background-color: #c6c6c6 - height: calc(100vh - 130px) + height: calc(100vh - 100px) width: 25% overflow-y: scroll @@ -18,7 +18,7 @@ .map grid-area: map - height: calc(100vh - 110px) + height: calc(100vh - 80px) [class*="copyrights-pane"] display: none !important diff --git a/components/MapPage/MapPage.ts b/src/pages/MapPage/MapPage.ts similarity index 66% rename from components/MapPage/MapPage.ts rename to src/pages/MapPage/MapPage.ts index 6e641fd8..1a21fcd3 100644 --- a/components/MapPage/MapPage.ts +++ b/src/pages/MapPage/MapPage.ts @@ -2,8 +2,8 @@ import ApiClient from '../../modules/ApiClient'; import { City } from '../../modules/Types'; -import PopupAlert from '../PopupAlert/PopupAlert'; -import ShortHousing from '../ShortAdCard/ShortAdCard'; +import PopupAlert from '../../components/PopupAlert/PopupAlert'; +import ShortHousing from '../../components/ShortAdCard/ShortAdCard'; interface Limit { limit: number; @@ -17,7 +17,7 @@ class MapPage { #CITY_ZOOM: number; #PLACE_ZOOM: number; - constructor(){ + constructor() { this.#TOTAL_ZOOM = 4; this.#CITY_ZOOM = 11; this.#PLACE_ZOOM = 13; @@ -25,9 +25,9 @@ class MapPage { // this.#placemarks = new Map(); } - #getLocation(){ - if (navigator.geolocation){ - navigator.geolocation.getCurrentPosition((position)=>{ + #getLocation() { + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition((position) => { this.#map.setCenter( [position.coords.latitude, position.coords.longitude], this.#CITY_ZOOM, @@ -36,35 +36,40 @@ class MapPage { const myGeo = new ymaps.Placemark( [position.coords.latitude, position.coords.longitude], {}, - {preset: 'islands#redIcon'} + { preset: 'islands#redIcon' } ); this.#map.geoObjects.add(myGeo); }); } } - goToPlace(city: string, address: string){ + goToPlace(city: string, address: string) { const query = city + ', ' + address; const placeOnMap = ymaps.geocode(query); placeOnMap.then( - (res)=>{ + (res) => { const place = res.geoObjects.get(0); - this.#map.setCenter(place.geometry._coordinates, this.#PLACE_ZOOM); - }, - (err)=>{ + this.#map.setCenter( + place.geometry._coordinates, + this.#PLACE_ZOOM + ); + }, + (err) => { const errorPopup = PopupAlert('Место не найдено'); - document.querySelector('.page-container')!.appendChild(errorPopup); + document + .querySelector('.page-container')! + .appendChild(errorPopup); } ); } - async #renderMap(mapContainer: HTMLDivElement){ + async #renderMap(mapContainer: HTMLDivElement) { this.#map = new ymaps.Map('map', { - center: [55.755808716436846,37.61771300861586], - zoom: this.#TOTAL_ZOOM + center: [55.755808716436846, 37.61771300861586], + zoom: this.#TOTAL_ZOOM, }); - const cities = await ApiClient.getCities() as City[]; + const cities = (await ApiClient.getCities()) as City[]; const myClasters = new Map(); for (const city of cities) { myClasters.set(city.title, []); @@ -75,7 +80,9 @@ class MapPage { const query = d.cityName + ', ' + d.address; return ymaps.geocode(query).then( (res) => { - const coordinates = res.geoObjects.get(0).geometry.getCoordinates(); + const coordinates = res.geoObjects + .get(0) + .geometry.getCoordinates(); const placemark = new ymaps.GeoObject({ geometry: { type: 'Point', @@ -87,14 +94,16 @@ class MapPage { }, (err) => { const errorPopup = PopupAlert('Место не найдено'); - document.querySelector('.page-container')!.appendChild(errorPopup); + document + .querySelector('.page-container')! + .appendChild(errorPopup); } ); }); await Promise.all(geocodePromises); - - for (const adsInCity of myClasters.values()){ + + for (const adsInCity of myClasters.values()) { if (adsInCity.length != 0) { const cluster = new ymaps.Clusterer(); cluster.add(adsInCity); @@ -103,17 +112,21 @@ class MapPage { } } - async #renderAds(adsContainer: HTMLDivElement){ - try{ + async #renderAds(adsContainer: HTMLDivElement) { + try { const limit: Limit = { limit: 10, offset: 0, }; const data = await ApiClient.getAds({}, limit); - for (const [ind, d] of data.entries()){ - const housing = new ShortHousing(d, ind, (city: string, address: string)=>{ - this.goToPlace(city, address); - }); + for (const [ind, d] of data.entries()) { + const housing = new ShortHousing( + d, + ind, + (city: string, address: string) => { + this.goToPlace(city, address); + } + ); housing.render(adsContainer); } } catch { @@ -124,7 +137,7 @@ class MapPage { async render(parent: HTMLElement) { parent.replaceChildren(); - const mapPage = document.createElement('div'); + const mapPage = document.createElement('div'); mapPage.classList.add('map-page'); const peopleList = document.createElement('div'); @@ -145,4 +158,4 @@ class MapPage { } } -export default MapPage; \ No newline at end of file +export default MapPage; diff --git a/components/ProfilePage/ProfilePage.scss b/src/pages/ProfilePage/ProfilePage.scss similarity index 100% rename from components/ProfilePage/ProfilePage.scss rename to src/pages/ProfilePage/ProfilePage.scss diff --git a/components/ProfilePage/ProfilePage.ts b/src/pages/ProfilePage/ProfilePage.ts similarity index 87% rename from components/ProfilePage/ProfilePage.ts rename to src/pages/ProfilePage/ProfilePage.ts index 91206312..4cd10d27 100644 --- a/components/ProfilePage/ProfilePage.ts +++ b/src/pages/ProfilePage/ProfilePage.ts @@ -1,7 +1,7 @@ 'use strict'; -import ProfileInfo from '../ProfileInfo/ProfileInfo'; -import ProfileData from '../ProfileData/ProfileData'; +import ProfileInfo from '../../components/ProfileInfo/ProfileInfo'; +import ProfileData from '../../components/ProfileData/ProfileData'; import APIClient from '../../modules/ApiClient'; class ProfilePage { @@ -22,13 +22,13 @@ class ProfilePage { #renderProfileInfoCallback; constructor(userId?: string) { - if (userId){ + if (userId) { this.#isMyProfile = false; this.#otherUserId = userId; } else { this.#isMyProfile = true; } - + //Колбэк для повторного рендера левого столбца после обновления формы this.#renderProfileInfoCallback = async () => { const profileInfoContainer = @@ -64,10 +64,10 @@ class ProfilePage { this.#guestCount = data.guestCount; this.#score = data.score; this.#isHost = data.isHost; - this.#birthdate = data.birthDate; + this.#birthdate = data.birthdate; this.#avatar = data.avatar; this.#sex = this.#calculateSex(data.sex); - this.#age = this.#calculateAge(data.birthDate); + this.#age = this.#calculateAge(data.birthdate); } else if (response.status !== 401) { console.error('Wrong response from server', response); } @@ -132,7 +132,11 @@ class ProfilePage { age: this.#age, avatar: this.#avatar, }; - const profileInfo = new ProfileInfo(profileData, this.#showAge, this.#isMyProfile); + const profileInfo = new ProfileInfo( + profileData, + this.#showAge, + this.#isMyProfile + ); profileInfo.render(parent); } @@ -144,9 +148,16 @@ class ProfilePage { #renderProfileData(parent: HTMLElement) { let profileData; if (this.#isMyProfile) { - profileData = new ProfileData(this.#renderProfileInfoCallback, this.#isMyProfile); + profileData = new ProfileData( + this.#renderProfileInfoCallback, + this.#isMyProfile + ); } else { - profileData = new ProfileData(this.#renderProfileInfoCallback, this.#isMyProfile, this.#otherUserId); + profileData = new ProfileData( + this.#renderProfileInfoCallback, + this.#isMyProfile, + this.#otherUserId + ); } profileData.render(parent); } diff --git a/mixins.scss b/src/styles/mixins.scss similarity index 76% rename from mixins.scss rename to src/styles/mixins.scss index 720e633c..6aaaab86 100644 --- a/mixins.scss +++ b/src/styles/mixins.scss @@ -7,7 +7,7 @@ min-height: 35px; height: fit-content; font-style: normal; - border-radius: 10px; + border-radius: 4px; border: none; font-size: 16px; font-weight: 600; @@ -26,6 +26,24 @@ } } +@mixin small-button { + @include button; + min-height: 0; + min-width: 0; + box-sizing: border-box; + width: min-content; + height: 24px; + padding: 3px 11px; + + &:hover { + box-shadow: none; + } + + &:active { + box-shadow: none; + } +} + @mixin prev-next-image-button-mixin { display: flex; justify-content: center; diff --git a/src/styles/styles.sass b/src/styles/styles.sass new file mode 100644 index 00000000..491c7686 --- /dev/null +++ b/src/styles/styles.sass @@ -0,0 +1,58 @@ +@use '../src/components/Header/Header' +@use '../src/components/AdCard/AdCard' +@use '../src/components/ShortAdCard/ShortAdCard' +@use '../src/components/Filter/Filter' +@use '../src/components/AuthPopup/AuthPopup' +@use '../src/components/MainPhoto/MainPhoto' +@use '../src/components/ProfilePopup/ProfilePopup' +@use "../src/components/ReviewCard/ReviewCard" +@use "../src/components/ProfileData/ProfileData" +@use "../src/components/ProfileData/RatingForm" +@use "../src/components/ReviewsGraphic/ReviewsGraphic" +@use "../src/components/ProfileInfo/ProfileInfo" +@use "../src/components/SearchPopup/SearchPopup" +@use "../src/components/PopupAlert/PopupAlert" +@use "../src/components/ProfileData/NoReviews/NoReviews" +@use "../src/components/Spinner/Spinner" +@use '../src/components/HorizontalAdCard/HorizontalAdCard' + +/* pages */ +@use '../src/pages/MainPage/MainPage' +@use '../src/pages/EditAdvertPage/EditAdvertPage' +@use '../src/pages/AdListPage/AdListPage' +@use "../src/pages/ProfilePage/ProfilePage" +@use "../src/pages/MapPage/MapPage" +@use "../src/pages/CityPage/CityPage" +@use '../src/pages/AdPage/AdPage' + + +@font-face + font-family: Inter + src: url('/fonts/Inter.ttf') + + + +* + margin: 0 + padding: 0 + + +body + font-optical-sizing: auto + font-style: normal + font-family: Inter, Arial, 'sans-serif' + background-color: #fff + + +@font-face + font-family: MarckScript-Regular + src: url("/fonts/MarckScript-Regular.ttf") + +@font-face + font-family: Dimkin-Light + src: url("/fonts/Dimkin-Light.ttf") + +@font-face + font-family: Dimkin-Regular + src: url("/fonts/Dimkin-Regular.ttf") + diff --git a/sw.js b/src/sw.js similarity index 100% rename from sw.js rename to src/sw.js diff --git a/hbs-recompile.js b/src/vite-plugins/hbs-recompile.js similarity index 92% rename from hbs-recompile.js rename to src/vite-plugins/hbs-recompile.js index a6bd2d30..614ee2bb 100644 --- a/hbs-recompile.js +++ b/src/vite-plugins/hbs-recompile.js @@ -29,10 +29,10 @@ const getAllHbsFiles = (dirPath) => { }; const recompileTemplates = () => { - const hbsFiles = getAllHbsFiles(path.resolve(__dirname, 'components')); + const hbsFiles = getAllHbsFiles(path.resolve(__dirname, '../')); // Формируем команду для компиляции всех найденных файлов const hbsFilesCommand = hbsFiles.join(' '); // Собираем все файлы в строку для команды - const command = `handlebars ${hbsFilesCommand} -f components/precompiled-templates.js`; + const command = `handlebars ${hbsFilesCommand} -f precompiled-templates.js`; // Выполняем команду для компиляции exec(command, (err, stdout, stderr) => { diff --git a/style.sass b/style.sass deleted file mode 100644 index a9aacda8..00000000 --- a/style.sass +++ /dev/null @@ -1,54 +0,0 @@ -@use 'components/Header/Header' -@use 'components/AdCard/AdCard' -@use 'components/ShortAdCard/ShortAdCard' -@use 'components/Filter/Filter' -@use 'components/AuthPopup/AuthPopup' -@use 'components/MainPhoto/MainPhoto' -@use 'components/MainPage/MainPage' -@use 'components/ProfilePopup/ProfilePopup' -@use 'components/EditAdvertPage/EditAdvertPage' -@use "components/ReviewCard/ReviewCard" -@use 'components/AdPage/AdPage' -@use 'components/AdListPage/AdListPage' -@use "components/ProfilePage/ProfilePage" -@use "components/ProfileData/ProfileData" -@use "components/ProfileData/RatingForm" -@use "components/ReviewsGraphic/ReviewsGraphic" -@use "components/ProfileInfo/ProfileInfo" -@use "components/CityPage/CityPage" -@use "components/SearchPopup/SearchPopup" -@use "components/PopupAlert/PopupAlert" -@use "components/ProfileData/NoReviews/NoReviews" -@use "components/MapPage/MapPage" -@use "components/Spinner/Spinner" - -@font-face - font-family: Inter - src: url('/fonts/Inter.ttf') - - - -* - margin: 0 - padding: 0 - - -body - font-optical-sizing: auto - font-style: normal - font-family: Inter, Arial, 'sans-serif' - background-color: #f6f6f6 - - -@font-face - font-family: MarckScript-Regular - src: url("/fonts/MarckScript-Regular.ttf") - -@font-face - font-family: Dimkin-Light - src: url("/fonts/Dimkin-Light.ttf") - -@font-face - font-family: Dimkin-Regular - src: url("/fonts/Dimkin-Regular.ttf") - diff --git a/vite.config.ts b/vite.config.ts index e50a72a3..03134c4b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from 'vite'; -import handlebarsCompilePlugin from './hbs-recompile.js'; +import handlebarsCompilePlugin from './src/vite-plugins/hbs-recompile.js'; /** @type {import('vite').UserConfig} */ export default defineConfig({