favesalon-embed 0.0.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cjs/chat-button.cjs.entry.js +118 -0
- package/dist/cjs/colors-38421769.js +69 -0
- package/dist/cjs/favesalon-embed.cjs.js +24 -0
- package/dist/cjs/google-map_5.cjs.entry.js +310 -0
- package/{cjs/index-d5de0b9d.js → dist/cjs/index-47c2a5f6.js} +513 -199
- package/{cjs/index-48ac68d0.js → dist/cjs/index-7f190886.js} +1924 -0
- package/dist/cjs/loader.cjs.js +23 -0
- package/dist/cjs/relativeTime-3721080d.js +9 -0
- package/{cjs → dist/cjs}/salon-booking-modal.cjs.entry.js +7 -6
- package/{cjs → dist/cjs}/salon-booking.cjs.entry.js +8 -8
- package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
- package/{cjs → dist/cjs}/salon-gift-card.cjs.entry.js +9 -8
- package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
- package/{cjs/salon-lookbook_2.cjs.entry.js → dist/cjs/salon-lookbook.cjs.entry.js} +28 -58
- package/{cjs → dist/cjs}/salon-ranking.cjs.entry.js +9 -8
- package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
- package/dist/cjs/salon-services.cjs.entry.js +81 -0
- package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
- package/dist/cjs/services-125c82d8.js +21492 -0
- package/dist/cjs/style-detail.cjs.entry.js +312 -0
- package/dist/cjs/user-avatar.cjs.entry.js +45 -0
- package/{collection → dist/collection}/collection-manifest.json +5 -5
- package/dist/collection/components/chat-button/index.css +122 -0
- package/dist/collection/components/chat-button/index.js +218 -0
- package/dist/collection/components/chat-conversation/index.js +103 -0
- package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
- package/{collection → dist/collection}/components/google-map/index.css +0 -1
- package/dist/collection/components/google-map/index.js +90 -0
- package/{collection → dist/collection}/components/salon-booking/index.css +11 -20
- package/dist/collection/components/salon-booking/index.js +126 -0
- package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
- package/dist/collection/components/salon-gift-card/index.css +30 -0
- package/dist/collection/components/salon-gift-card/index.js +126 -0
- package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
- package/dist/collection/components/salon-info/index.js +77 -0
- package/dist/collection/components/salon-latest-reviews/index.js +163 -0
- package/dist/collection/components/salon-latest-styles/index.css +12 -0
- package/dist/collection/components/salon-latest-styles/index.js +183 -0
- package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +7 -4
- package/dist/collection/components/salon-locations/index.js +143 -0
- package/{collection → dist/collection}/components/salon-lookbook/index.css +3 -9
- package/dist/collection/components/salon-lookbook/index.js +368 -0
- package/dist/collection/components/salon-ranking/index.js +117 -0
- package/{collection → dist/collection}/components/salon-reviews/index.css +3 -0
- package/dist/collection/components/salon-reviews/index.js +249 -0
- package/dist/collection/components/salon-schedules/index.css +18 -0
- package/dist/collection/components/salon-schedules/index.js +167 -0
- package/dist/collection/components/salon-services/index.css +1 -0
- package/dist/collection/components/salon-services/index.js +146 -0
- package/dist/collection/components/salon-stylists/index.js +184 -0
- package/dist/collection/components/style-detail/index.css +76 -0
- package/dist/collection/components/style-detail/index.js +386 -0
- package/dist/collection/components/user-avatar/index.js +134 -0
- package/dist/collection/constants/colors.js +65 -0
- package/dist/collection/mocks/users.js +10 -0
- package/dist/collection/services/services.js +295 -0
- package/dist/collection/types/chat.js +23 -0
- package/dist/collection/types/common.js +11 -0
- package/{collection → dist/collection}/types/review.js +9 -5
- package/dist/collection/types/salon.js +58 -0
- package/dist/collection/types/style.js +128 -0
- package/{collection → dist/collection}/types/stylist.js +12 -9
- package/dist/collection/types/user.js +10 -0
- package/{custom-elements → dist/custom-elements}/index.d.ts +18 -18
- package/dist/custom-elements/index.js +28340 -0
- package/dist/esm/chat-button.entry.js +114 -0
- package/dist/esm/colors-ea36347a.js +67 -0
- package/dist/esm/favesalon-embed.js +19 -0
- package/dist/esm/google-map_5.entry.js +302 -0
- package/{esm/index-0f8eed73.js → dist/esm/index-3fae868e.js} +512 -200
- package/{esm/index-67d677ba.js → dist/esm/index-80523fec.js} +1924 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +19 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/relativeTime-cd452e6d.js +7 -0
- package/{esm → dist/esm}/salon-booking-modal.entry.js +7 -6
- package/{esm → dist/esm}/salon-booking.entry.js +7 -7
- package/dist/esm/salon-gift-card-modal.entry.js +25 -0
- package/{esm → dist/esm}/salon-gift-card.entry.js +8 -7
- package/dist/esm/salon-latest-reviews.entry.js +93 -0
- package/{esm/salon-lookbook_2.entry.js → dist/esm/salon-lookbook.entry.js} +29 -58
- package/{esm → dist/esm}/salon-ranking.entry.js +9 -8
- package/dist/esm/salon-reviews.entry.js +189 -0
- package/dist/esm/salon-services.entry.js +77 -0
- package/dist/esm/salon-stylists.entry.js +114 -0
- package/dist/esm/services-40a3e622.js +21485 -0
- package/dist/esm/style-detail.entry.js +308 -0
- package/dist/esm/user-avatar.entry.js +41 -0
- package/dist/favesalon-embed/assets/map--placeholder.jpeg +0 -0
- package/{favesalon-embed → dist/favesalon-embed}/favesalon-embed.css +1 -1
- package/dist/favesalon-embed/favesalon-embed.esm.js +1 -0
- package/dist/favesalon-embed/p-019c5ccd.entry.js +1 -0
- package/dist/favesalon-embed/p-083a8821.entry.js +1 -0
- package/dist/favesalon-embed/p-0d0ed9ea.entry.js +1 -0
- package/dist/favesalon-embed/p-119db8de.entry.js +1 -0
- package/dist/favesalon-embed/p-1432c51b.entry.js +1 -0
- package/dist/favesalon-embed/p-22093506.entry.js +1 -0
- package/dist/favesalon-embed/p-32b314e9.js +2 -0
- package/dist/favesalon-embed/p-4a5eca9a.js +6 -0
- package/dist/favesalon-embed/p-58d2e9be.js +1 -0
- package/dist/favesalon-embed/p-71404b6a.entry.js +1 -0
- package/dist/favesalon-embed/p-857c3a61.entry.js +1 -0
- package/dist/favesalon-embed/p-99ec77f7.entry.js +1 -0
- package/dist/favesalon-embed/p-a33331cc.js +1 -0
- package/dist/favesalon-embed/p-b0c3673a.entry.js +1 -0
- package/dist/favesalon-embed/p-b287b1ea.entry.js +1 -0
- package/dist/favesalon-embed/p-b3af7842.entry.js +1 -0
- package/dist/favesalon-embed/p-b630ae68.js +1580 -0
- package/dist/favesalon-embed/p-ce2c1c9a.entry.js +1 -0
- package/dist/favesalon-embed/p-d9b7ad58.entry.js +1 -0
- package/dist/favesalon-embed/p-fc9a5551.js +6 -0
- package/dist/types/components/chat-button/index.d.ts +24 -0
- package/dist/types/components/google-map/index.d.ts +5 -0
- package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +1 -0
- package/{types → dist/types}/components/salon-info/index.d.ts +0 -1
- package/{types → dist/types}/components/salon-latest-reviews/index.d.ts +2 -0
- package/dist/types/components/salon-latest-styles/index.d.ts +12 -0
- package/{types → dist/types}/components/salon-locations/index.d.ts +2 -0
- package/{types → dist/types}/components/salon-lookbook/index.d.ts +3 -3
- package/dist/types/components/salon-reviews/index.d.ts +24 -0
- package/{types → dist/types}/components/salon-schedules/index.d.ts +2 -0
- package/{types → dist/types}/components/salon-services/index.d.ts +1 -0
- package/{types → dist/types}/components/salon-stylists/index.d.ts +6 -0
- package/dist/types/components/style-detail/index.d.ts +24 -0
- package/{types → dist/types}/components.d.ts +76 -59
- package/dist/types/constants/colors.d.ts +65 -0
- package/dist/types/mocks/users.d.ts +10 -0
- package/dist/types/services/services.d.ts +75 -0
- package/{types → dist/types}/stencil-public-runtime.d.ts +85 -11
- package/dist/types/types/chat.d.ts +17 -0
- package/dist/types/types/common.d.ts +11 -0
- package/{types → dist/types}/types/review.d.ts +4 -0
- package/{types → dist/types}/types/salon.d.ts +3 -1
- package/dist/types/types/style.d.ts +88 -0
- package/{types → dist/types}/types/stylist.d.ts +1 -1
- package/{types → dist/types}/types/user.d.ts +2 -2
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +19 -14
- package/readme.md +24 -7
- package/cjs/colors-7f354880.js +0 -95
- package/cjs/favesalon-embed.cjs.js +0 -20
- package/cjs/google-map.cjs.entry.js +0 -47
- package/cjs/index-95daad08.js +0 -1928
- package/cjs/loader.cjs.js +0 -22
- package/cjs/salon-contact_4.cjs.entry.js +0 -155
- package/cjs/salon-gift-card-modal.cjs.entry.js +0 -25
- package/cjs/salon-info.cjs.entry.js +0 -35
- package/cjs/salon-latest-reviews.cjs.entry.js +0 -58
- package/cjs/salon-lookbook-modal.cjs.entry.js +0 -141
- package/cjs/salon-reviews.cjs.entry.js +0 -205
- package/cjs/salon-services.cjs.entry.js +0 -47
- package/cjs/salon-stylists.cjs.entry.js +0 -54
- package/cjs/services-f1102d4a.js +0 -5762
- package/collection/components/google-map/index.js +0 -97
- package/collection/components/salon-booking/index.js +0 -121
- package/collection/components/salon-booking/salon-booking-modal.js +0 -88
- package/collection/components/salon-contact/index.js +0 -88
- package/collection/components/salon-gift-card/index.css +0 -25
- package/collection/components/salon-gift-card/index.js +0 -120
- package/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -48
- package/collection/components/salon-info/index.css +0 -3
- package/collection/components/salon-info/index.js +0 -97
- package/collection/components/salon-latest-reviews/index.js +0 -108
- package/collection/components/salon-locations/index.js +0 -80
- package/collection/components/salon-lookbook/index.js +0 -376
- package/collection/components/salon-lookbook/lookbook-modal.css +0 -72
- package/collection/components/salon-lookbook/salon-lookbook-modal.js +0 -248
- package/collection/components/salon-ranking/index.js +0 -114
- package/collection/components/salon-reviews/index.js +0 -317
- package/collection/components/salon-schedules/index.css +0 -14
- package/collection/components/salon-schedules/index.js +0 -103
- package/collection/components/salon-services/index.js +0 -113
- package/collection/components/salon-styles/index.css +0 -23
- package/collection/components/salon-styles/index.js +0 -100
- package/collection/components/salon-stylists/index.js +0 -96
- package/collection/components/user-avatar/index.css +0 -0
- package/collection/components/user-avatar/index.js +0 -127
- package/collection/constants/colors.js +0 -91
- package/collection/services/services.js +0 -225
- package/collection/types/common.js +0 -2
- package/collection/types/salon.js +0 -52
- package/collection/types/style.js +0 -103
- package/collection/types/user.js +0 -10
- package/custom-elements/index.js +0 -12125
- package/esm/colors-1ec90c5f.js +0 -93
- package/esm/favesalon-embed.js +0 -18
- package/esm/google-map.entry.js +0 -43
- package/esm/index-09d43e3e.js +0 -1926
- package/esm/loader.js +0 -18
- package/esm/polyfills/css-shim.js +0 -1
- package/esm/salon-contact_4.entry.js +0 -148
- package/esm/salon-gift-card-modal.entry.js +0 -21
- package/esm/salon-info.entry.js +0 -31
- package/esm/salon-latest-reviews.entry.js +0 -54
- package/esm/salon-lookbook-modal.entry.js +0 -137
- package/esm/salon-reviews.entry.js +0 -201
- package/esm/salon-services.entry.js +0 -43
- package/esm/salon-stylists.entry.js +0 -50
- package/esm/services-74d84ca9.js +0 -5756
- package/favesalon-embed/favesalon-embed.esm.js +0 -1
- package/favesalon-embed/p-0188d4dc.entry.js +0 -1
- package/favesalon-embed/p-0318501e.js +0 -1
- package/favesalon-embed/p-078f242d.entry.js +0 -1
- package/favesalon-embed/p-13e23c61.entry.js +0 -1
- package/favesalon-embed/p-17df13ad.js +0 -1
- package/favesalon-embed/p-1a3179c8.entry.js +0 -1
- package/favesalon-embed/p-20aa75de.js +0 -6
- package/favesalon-embed/p-2901a6d6.entry.js +0 -1
- package/favesalon-embed/p-2b861430.entry.js +0 -1
- package/favesalon-embed/p-44d810a0.js +0 -1
- package/favesalon-embed/p-4a5eca9a.js +0 -6
- package/favesalon-embed/p-4c68700f.entry.js +0 -1
- package/favesalon-embed/p-4e2d7b29.js +0 -1
- package/favesalon-embed/p-6b845bf1.entry.js +0 -1
- package/favesalon-embed/p-7350f6b5.entry.js +0 -1
- package/favesalon-embed/p-897c2b1c.entry.js +0 -1
- package/favesalon-embed/p-8e60f56f.entry.js +0 -1
- package/favesalon-embed/p-a49afdc1.entry.js +0 -1
- package/favesalon-embed/p-c93867c4.entry.js +0 -1
- package/favesalon-embed/p-ea6a097f.entry.js +0 -1
- package/types/components/google-map/index.d.ts +0 -10
- package/types/components/salon-contact/index.d.ts +0 -9
- package/types/components/salon-lookbook/salon-lookbook-modal.d.ts +0 -13
- package/types/components/salon-reviews/index.d.ts +0 -24
- package/types/components/salon-styles/index.d.ts +0 -9
- package/types/constants/colors.d.ts +0 -88
- package/types/services/services.d.ts +0 -26
- package/types/types/common.d.ts +0 -2
- package/types/types/style.d.ts +0 -59
- /package/{cjs → dist/cjs}/_commonjsHelpers-5cfcba41.js +0 -0
- /package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
- /package/{cjs → dist/cjs}/index.cjs.js +0 -0
- /package/{cjs → dist/cjs}/utils-c5a33b3c.js +0 -0
- /package/{esm/index.js → dist/collection/components/salon-info/index.css} +0 -0
- /package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -0
- /package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
- /package/{collection → dist/collection}/components/salon-stylists/index.css +0 -0
- /package/{collection/components/salon-locations → dist/collection/components/user-avatar}/index.css +0 -0
- /package/{collection → dist/collection}/global/global.js +0 -0
- /package/{collection → dist/collection}/index.js +0 -0
- /package/{collection → dist/collection}/types/service.js +0 -0
- /package/{collection → dist/collection}/utils/utils.js +0 -0
- /package/{esm → dist/esm}/_commonjsHelpers-098d5b27.js +0 -0
- /package/{esm → dist/esm}/global-e1089ffd.js +0 -0
- /package/{esm → dist/esm}/polyfills/core-js.js +0 -0
- /package/{esm → dist/esm}/polyfills/dom.js +0 -0
- /package/{esm → dist/esm}/polyfills/es5-html-element.js +0 -0
- /package/{esm → dist/esm}/polyfills/index.js +0 -0
- /package/{esm → dist/esm}/polyfills/system.js +0 -0
- /package/{esm → dist/esm}/utils-e97485e0.js +0 -0
- /package/{favesalon-embed → dist/favesalon-embed}/index.esm.js +0 -0
- /package/{favesalon-embed → dist/favesalon-embed}/p-47e646f8.js +0 -0
- /package/{favesalon-embed → dist/favesalon-embed}/p-d6083940.js +0 -0
- /package/{index.cjs.js → dist/index.cjs.js} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{collection/components/salon-services/index.css → dist/types/components/chat-conversation/index.d.ts} +0 -0
- /package/{types → dist/types}/components/salon-booking/index.d.ts +0 -0
- /package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +0 -0
- /package/{types → dist/types}/components/salon-gift-card/index.d.ts +0 -0
- /package/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
- /package/{types → dist/types}/components/user-avatar/index.d.ts +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
- /package/{types → dist/types}/types/service.d.ts +0 -0
- /package/{types → dist/types}/utils/utils.d.ts +0 -0
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { Component, Prop, h, State, Method } from '@stencil/core';
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
4
|
-
import { Colors } from '../../constants/colors';
|
|
5
|
-
import HttpService from '../../services/services';
|
|
6
|
-
dayjs.extend(relativeTime);
|
|
7
|
-
export class SalonBookingModal {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.salonLookbook = '';
|
|
10
|
-
this.lookbookComments = [];
|
|
11
|
-
this.isModalOpen = true;
|
|
12
|
-
}
|
|
13
|
-
componentWillLoad() {
|
|
14
|
-
if (!!this.salonLookbook) {
|
|
15
|
-
this.lookbookInfo = JSON.parse(this.salonLookbook);
|
|
16
|
-
this.fetchData();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
fetchData() {
|
|
20
|
-
try {
|
|
21
|
-
const promises = [
|
|
22
|
-
HttpService().fetchStyleDetail(this.lookbookInfo.id).then(lookbookInfo => {
|
|
23
|
-
if (lookbookInfo) {
|
|
24
|
-
this.lookbookInfo = lookbookInfo;
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
HttpService().fetchStyleComments({ photo_id: [this.lookbookInfo.id] }).then(lookbookComments => this.lookbookComments = lookbookComments),
|
|
28
|
-
];
|
|
29
|
-
return Promise.all(promises);
|
|
30
|
-
}
|
|
31
|
-
catch (e) { }
|
|
32
|
-
}
|
|
33
|
-
orderedStylePhotos(albumPhotos, activeId) {
|
|
34
|
-
let selectedStyles = [];
|
|
35
|
-
let restStyles = [];
|
|
36
|
-
(albumPhotos || []).forEach(s => {
|
|
37
|
-
if (s.id === activeId) {
|
|
38
|
-
selectedStyles = selectedStyles.concat(s);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
restStyles = restStyles.concat(s);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return selectedStyles.concat(restStyles);
|
|
45
|
-
}
|
|
46
|
-
closeModal() {
|
|
47
|
-
this.isModalOpen = false;
|
|
48
|
-
const el = document.querySelector('salon-lookbook-modal');
|
|
49
|
-
el.remove();
|
|
50
|
-
}
|
|
51
|
-
render() {
|
|
52
|
-
const { id, caption, createdDate, albumPhotos, totalView, totalLike, totalBooking, owner, stylist, album, } = this.lookbookInfo;
|
|
53
|
-
const oderedStyles = albumPhotos ? this.orderedStylePhotos(albumPhotos, id) : [];
|
|
54
|
-
return (h("div", { class: "salon-lookbook--modal" }, this.isModalOpen && (h("div", { class: "salon-modal salon-modal--lookbook-detail" },
|
|
55
|
-
h("div", { class: "salon-modal--backdrop", onClick: () => this.closeModal() }),
|
|
56
|
-
h("div", { class: "salon-modal--close", onClick: () => this.closeModal() }),
|
|
57
|
-
h("div", { class: "salon-modal--inner" },
|
|
58
|
-
h("div", { class: "salon-modal--content" },
|
|
59
|
-
h("div", { class: "style-detail--container", style: {
|
|
60
|
-
backgroundColor: Colors.White,
|
|
61
|
-
marginRight: 'auto',
|
|
62
|
-
marginLeft: 'auto',
|
|
63
|
-
maxWidth: '990',
|
|
64
|
-
} },
|
|
65
|
-
oderedStyles.length > 0 && (h("div", { class: "style-detail--photos" },
|
|
66
|
-
h("div", { id: "style-detail-carousel", class: "carousel slide", "data-bs-ride": "carousel" },
|
|
67
|
-
h("div", { class: "carousel-inner" }, oderedStyles.map((photo, index) => {
|
|
68
|
-
const { caption, description,
|
|
69
|
-
// mediaType,
|
|
70
|
-
fullImageUrl, fullImageUrlThumb, fullImageUrlMedium, imgWidth, imgHeight, } = photo;
|
|
71
|
-
const isLandscape = imgWidth >= imgHeight;
|
|
72
|
-
return (h("div", { class: `carousel-item ${index === 0 ? 'active' : ''}` },
|
|
73
|
-
h("div", { class: "salon-styles--item", style: {
|
|
74
|
-
flexDirection: isLandscape ? 'column' : 'row',
|
|
75
|
-
justifyContent: 'center',
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
overflow: 'hidden',
|
|
78
|
-
position: 'relative',
|
|
79
|
-
display: 'flex',
|
|
80
|
-
height: '240px',
|
|
81
|
-
borderRadius: '8px 8px 0 0',
|
|
82
|
-
} },
|
|
83
|
-
h("div", { class: "salon-styles--item-background", style: Object.assign(Object.assign({}, fullImageUrlThumb ? { backgroundImage: `url(${fullImageUrlThumb})` } : {}), { backgroundColor: Colors.Gray06, backgroundPosition: 'center', backgroundRepeat: 'no-repeat', backgroundSize: 'cover', position: 'absolute', bottom: '0px', right: '0px', left: '0px', top: '0px', zIndex: '1' }) }),
|
|
84
|
-
h("img", { alt: caption, class: "salon-styles--item-image", src: fullImageUrlThumb || fullImageUrlMedium || fullImageUrl, style: Object.assign({ display: 'inline-block', position: 'relative', zIndex: '2' }, isLandscape ? { width: '100%' } : { height: '100%' }) }),
|
|
85
|
-
h("div", { class: "carousel-caption d-none d-md-block" },
|
|
86
|
-
caption && h("h5", null, caption),
|
|
87
|
-
description && h("p", null, description)))));
|
|
88
|
-
})),
|
|
89
|
-
h("button", { type: "button", "data-bs-slide": "prev", class: "carousel-control-prev", "data-bs-target": "#style-detail-carousel" },
|
|
90
|
-
h("span", { class: "carousel-control-prev-icon", "aria-hidden": "true" }),
|
|
91
|
-
h("span", { class: "visually-hidden" }, "Previous")),
|
|
92
|
-
h("button", { type: "button", "data-bs-slide": "next", class: "carousel-control-next", "data-bs-target": "#style-detail-carousel" },
|
|
93
|
-
h("span", { class: "carousel-control-next-icon", "aria-hidden": "true" }),
|
|
94
|
-
h("span", { class: "visually-hidden" }, "Next"))))),
|
|
95
|
-
h("div", { class: "style-detail--metadata" },
|
|
96
|
-
h("div", { class: "style-detail--metadata-detail", style: {
|
|
97
|
-
position: 'relative',
|
|
98
|
-
overflowY: 'auto',
|
|
99
|
-
padding: '16px 24px',
|
|
100
|
-
height: '100%',
|
|
101
|
-
} },
|
|
102
|
-
h("div", { class: "style-detail--info--field style-detail--metadata-stats", style: {
|
|
103
|
-
display: 'flex',
|
|
104
|
-
flexDirection: 'row',
|
|
105
|
-
justifyContent: 'flex-start',
|
|
106
|
-
marginBottom: '16px',
|
|
107
|
-
} },
|
|
108
|
-
h("div", { style: { display: 'flex', alignItems: 'center' } },
|
|
109
|
-
h("i", { class: "ri-eye-line", style: {
|
|
110
|
-
color: Colors.Gray03,
|
|
111
|
-
fontSize: '16px',
|
|
112
|
-
marginRight: '4px',
|
|
113
|
-
position: 'relative',
|
|
114
|
-
top: '1px',
|
|
115
|
-
} }),
|
|
116
|
-
" ",
|
|
117
|
-
totalView,
|
|
118
|
-
" ",
|
|
119
|
-
totalView === 1 ? 'view' : 'views'),
|
|
120
|
-
h("div", { style: { display: 'flex', alignItems: 'center', marginLeft: '16px' } },
|
|
121
|
-
h("i", { class: "ri-heart-fill", style: {
|
|
122
|
-
color: Colors.Gray03,
|
|
123
|
-
fontSize: '16px',
|
|
124
|
-
marginRight: '4px',
|
|
125
|
-
position: 'relative',
|
|
126
|
-
top: '1px',
|
|
127
|
-
} }),
|
|
128
|
-
" ",
|
|
129
|
-
totalLike,
|
|
130
|
-
" ",
|
|
131
|
-
totalLike === 1 ? 'fave' : 'faves'),
|
|
132
|
-
h("div", { style: { display: 'flex', alignItems: 'center', marginLeft: '16px' } },
|
|
133
|
-
h("i", { class: "ri-calendar-check-line", style: {
|
|
134
|
-
color: Colors.Gray03,
|
|
135
|
-
fontSize: '16px',
|
|
136
|
-
marginRight: '4px',
|
|
137
|
-
position: 'relative',
|
|
138
|
-
top: '1px',
|
|
139
|
-
} }),
|
|
140
|
-
" ",
|
|
141
|
-
totalBooking,
|
|
142
|
-
" booked")),
|
|
143
|
-
h("div", { style: {
|
|
144
|
-
display: 'flex',
|
|
145
|
-
flexDirection: 'row',
|
|
146
|
-
justifyContent: 'space-between',
|
|
147
|
-
} },
|
|
148
|
-
owner && (h("div", { class: "style-detail--info--field" },
|
|
149
|
-
h("span", { style: {
|
|
150
|
-
fontSize: '14px',
|
|
151
|
-
color: Colors.Gray03,
|
|
152
|
-
} }, "Posted by"),
|
|
153
|
-
" ",
|
|
154
|
-
h("span", { style: {
|
|
155
|
-
fontSize: '16px',
|
|
156
|
-
fontWeight: 'bold',
|
|
157
|
-
color: Colors.Gray01,
|
|
158
|
-
} }, owner.name))),
|
|
159
|
-
h("div", { class: "style-detail--info--field", style: {
|
|
160
|
-
fontSize: '14px',
|
|
161
|
-
color: Colors.Gray03,
|
|
162
|
-
} }, dayjs(createdDate).fromNow())),
|
|
163
|
-
caption && (h("div", { class: "style-detail--info--field", style: {
|
|
164
|
-
color: Colors.Gray01,
|
|
165
|
-
marginTop: '12px',
|
|
166
|
-
fontSize: '24px',
|
|
167
|
-
} }, caption)),
|
|
168
|
-
stylist && (h("div", { class: "style-detail--info--field", style: { marginTop: '24px' } },
|
|
169
|
-
h("div", { style: { fontSize: '14px', color: Colors.Gray03, marginBottom: '8px' } }, "Stylist"),
|
|
170
|
-
h("div", { style: {
|
|
171
|
-
display: 'flex',
|
|
172
|
-
flexDirection: 'row',
|
|
173
|
-
justifyContent: 'space-between',
|
|
174
|
-
alignItems: 'center',
|
|
175
|
-
} },
|
|
176
|
-
h("user-avatar", { size: 32, name: stylist.name, shortName: `${(stylist.firstName || '').charAt(0)}${(stylist.lastName || '').charAt(0)}`, avatar: stylist.avatar, nameStyle: { fontSize: 16, fontWeight: 'bold' } })))),
|
|
177
|
-
album && album.service && (h("div", { class: "style-detail--info--field", style: { marginTop: '24px' } },
|
|
178
|
-
h("div", { style: { fontSize: '14px', color: Colors.Gray03, marginBottom: '8px' } }, "Services"),
|
|
179
|
-
h("div", { style: { fontSize: '16px', color: Colors.Gray01 } }, album.service.name))))))))))));
|
|
180
|
-
}
|
|
181
|
-
static get is() { return "salon-lookbook-modal"; }
|
|
182
|
-
static get originalStyleUrls() { return {
|
|
183
|
-
"$": ["lookbook-modal.less"]
|
|
184
|
-
}; }
|
|
185
|
-
static get styleUrls() { return {
|
|
186
|
-
"$": ["lookbook-modal.css"]
|
|
187
|
-
}; }
|
|
188
|
-
static get properties() { return {
|
|
189
|
-
"salonId": {
|
|
190
|
-
"type": "number",
|
|
191
|
-
"mutable": false,
|
|
192
|
-
"complexType": {
|
|
193
|
-
"original": "number",
|
|
194
|
-
"resolved": "number",
|
|
195
|
-
"references": {}
|
|
196
|
-
},
|
|
197
|
-
"required": false,
|
|
198
|
-
"optional": false,
|
|
199
|
-
"docs": {
|
|
200
|
-
"tags": [],
|
|
201
|
-
"text": ""
|
|
202
|
-
},
|
|
203
|
-
"attribute": "salon-id",
|
|
204
|
-
"reflect": false
|
|
205
|
-
},
|
|
206
|
-
"salonLookbook": {
|
|
207
|
-
"type": "string",
|
|
208
|
-
"mutable": false,
|
|
209
|
-
"complexType": {
|
|
210
|
-
"original": "string",
|
|
211
|
-
"resolved": "string",
|
|
212
|
-
"references": {}
|
|
213
|
-
},
|
|
214
|
-
"required": false,
|
|
215
|
-
"optional": false,
|
|
216
|
-
"docs": {
|
|
217
|
-
"tags": [],
|
|
218
|
-
"text": ""
|
|
219
|
-
},
|
|
220
|
-
"attribute": "salon-lookbook",
|
|
221
|
-
"reflect": false,
|
|
222
|
-
"defaultValue": "''"
|
|
223
|
-
}
|
|
224
|
-
}; }
|
|
225
|
-
static get states() { return {
|
|
226
|
-
"lookbookInfo": {},
|
|
227
|
-
"lookbookComments": {},
|
|
228
|
-
"isModalOpen": {}
|
|
229
|
-
}; }
|
|
230
|
-
static get methods() { return {
|
|
231
|
-
"fetchData": {
|
|
232
|
-
"complexType": {
|
|
233
|
-
"signature": "() => Promise<any[]>",
|
|
234
|
-
"parameters": [],
|
|
235
|
-
"references": {
|
|
236
|
-
"Promise": {
|
|
237
|
-
"location": "global"
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
"return": "Promise<any[]>"
|
|
241
|
-
},
|
|
242
|
-
"docs": {
|
|
243
|
-
"text": "",
|
|
244
|
-
"tags": []
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}; }
|
|
248
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Component, Prop, h } from '@stencil/core';
|
|
2
|
-
import { Colors } from '../../constants/colors';
|
|
3
|
-
export class SalonRanking {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.height = 16;
|
|
6
|
-
this.width = 16;
|
|
7
|
-
}
|
|
8
|
-
getRankingData(ranking) {
|
|
9
|
-
if (ranking === 5) {
|
|
10
|
-
return {
|
|
11
|
-
color: Colors.Danger,
|
|
12
|
-
text: 'Viral',
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
if (ranking === 4) {
|
|
16
|
-
return {
|
|
17
|
-
color: Colors.Pink03,
|
|
18
|
-
text: 'Advancing',
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
if (ranking === 3) {
|
|
22
|
-
return {
|
|
23
|
-
color: Colors.Orange03,
|
|
24
|
-
text: 'Progressing',
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
if (ranking === 2) {
|
|
28
|
-
return {
|
|
29
|
-
color: Colors.DarkBlue03,
|
|
30
|
-
text: 'Building',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
color: Colors.Gray01,
|
|
35
|
-
text: 'Starting',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
render() {
|
|
39
|
-
const rankingData = this.getRankingData(this.ranking);
|
|
40
|
-
return (h("div", { style: {
|
|
41
|
-
display: 'flex',
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
justifyContent: 'center',
|
|
44
|
-
width: '100%',
|
|
45
|
-
color: rankingData.color,
|
|
46
|
-
} },
|
|
47
|
-
h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", width: this.width, height: this.height, viewBox: `0 0 ${this.width} ${this.height}`, style: { maxWidth: `${this.width}px`, height: 'auto', marginRight: '8px' } },
|
|
48
|
-
h("path", { d: "M14.9984 14.1273C15.0188 14.2658 14.8369 14.3204 14.7415 14.2251L8.11345 7.6028C6.41272 5.90355 6.42184 3.19468 8.23887 1.76037C9.63972 0.678363 11.7259 0.753791 13.1793 1.96961C14.1899 2.80207 14.706 3.93808 14.7471 5.07223L14.9984 14.1273Z", fill: "currentColor" }),
|
|
49
|
-
h("path", { d: "M1.74847 8.24513C3.18403 6.42967 5.91004 6.40579 7.61078 8.10504L14.2548 14.7432C14.3501 14.8385 14.2795 15.0043 14.1568 14.9999L5.078 14.7329C3.94287 14.6918 2.78997 14.1604 1.97268 13.1665C0.755801 11.7144 0.680308 9.62998 1.74847 8.24513Z", fill: "currentColor" })),
|
|
50
|
-
rankingData.text));
|
|
51
|
-
}
|
|
52
|
-
static get is() { return "salon-ranking"; }
|
|
53
|
-
static get originalStyleUrls() { return {
|
|
54
|
-
"$": ["index.css"]
|
|
55
|
-
}; }
|
|
56
|
-
static get styleUrls() { return {
|
|
57
|
-
"$": ["index.css"]
|
|
58
|
-
}; }
|
|
59
|
-
static get properties() { return {
|
|
60
|
-
"ranking": {
|
|
61
|
-
"type": "number",
|
|
62
|
-
"mutable": false,
|
|
63
|
-
"complexType": {
|
|
64
|
-
"original": "number",
|
|
65
|
-
"resolved": "number",
|
|
66
|
-
"references": {}
|
|
67
|
-
},
|
|
68
|
-
"required": false,
|
|
69
|
-
"optional": false,
|
|
70
|
-
"docs": {
|
|
71
|
-
"tags": [],
|
|
72
|
-
"text": ""
|
|
73
|
-
},
|
|
74
|
-
"attribute": "ranking",
|
|
75
|
-
"reflect": false
|
|
76
|
-
},
|
|
77
|
-
"height": {
|
|
78
|
-
"type": "number",
|
|
79
|
-
"mutable": false,
|
|
80
|
-
"complexType": {
|
|
81
|
-
"original": "number",
|
|
82
|
-
"resolved": "number",
|
|
83
|
-
"references": {}
|
|
84
|
-
},
|
|
85
|
-
"required": false,
|
|
86
|
-
"optional": true,
|
|
87
|
-
"docs": {
|
|
88
|
-
"tags": [],
|
|
89
|
-
"text": ""
|
|
90
|
-
},
|
|
91
|
-
"attribute": "height",
|
|
92
|
-
"reflect": false,
|
|
93
|
-
"defaultValue": "16"
|
|
94
|
-
},
|
|
95
|
-
"width": {
|
|
96
|
-
"type": "number",
|
|
97
|
-
"mutable": false,
|
|
98
|
-
"complexType": {
|
|
99
|
-
"original": "number",
|
|
100
|
-
"resolved": "number",
|
|
101
|
-
"references": {}
|
|
102
|
-
},
|
|
103
|
-
"required": false,
|
|
104
|
-
"optional": true,
|
|
105
|
-
"docs": {
|
|
106
|
-
"tags": [],
|
|
107
|
-
"text": ""
|
|
108
|
-
},
|
|
109
|
-
"attribute": "width",
|
|
110
|
-
"reflect": false,
|
|
111
|
-
"defaultValue": "16"
|
|
112
|
-
}
|
|
113
|
-
}; }
|
|
114
|
-
}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import { Component, Prop, h, Method, State } from '@stencil/core';
|
|
2
|
-
import dayjs from 'dayjs';
|
|
3
|
-
import groupBy from 'lodash/groupBy';
|
|
4
|
-
import sortBy from 'lodash/sortBy';
|
|
5
|
-
import { css } from 'glamor';
|
|
6
|
-
import { Colors } from '../../constants/colors';
|
|
7
|
-
import { getRatingText } from '../../utils/utils';
|
|
8
|
-
import { shortDate } from '../../types/common';
|
|
9
|
-
import HttpService from '../../services/services';
|
|
10
|
-
const pageLimited = 10;
|
|
11
|
-
const sortOptions = [{
|
|
12
|
-
value: 'newest',
|
|
13
|
-
label: 'Newest first',
|
|
14
|
-
}, {
|
|
15
|
-
value: 'oldest',
|
|
16
|
-
label: 'Oldest first',
|
|
17
|
-
}, {
|
|
18
|
-
value: 'rating_desc',
|
|
19
|
-
label: 'High rating first',
|
|
20
|
-
}, {
|
|
21
|
-
value: 'rating_asc',
|
|
22
|
-
label: 'Low rating first',
|
|
23
|
-
}];
|
|
24
|
-
const scoreValuesMapping = {
|
|
25
|
-
all: 'all',
|
|
26
|
-
star1: 1,
|
|
27
|
-
star2: 2,
|
|
28
|
-
star3: 3,
|
|
29
|
-
star4: 4,
|
|
30
|
-
star5: 5,
|
|
31
|
-
};
|
|
32
|
-
export class SalonReviews {
|
|
33
|
-
constructor() {
|
|
34
|
-
this.primaryColor = Colors.Coral03;
|
|
35
|
-
this.totalReviews = 0;
|
|
36
|
-
this.salonReviews = [];
|
|
37
|
-
this.pageOffset = pageLimited;
|
|
38
|
-
this.ratings = [scoreValuesMapping.all, 'star1', 'star2', 'star3', 'star4', 'star5'];
|
|
39
|
-
this.sorting = sortOptions[0].value;
|
|
40
|
-
this.renderReviewsList = () => {
|
|
41
|
-
const ratingTexts = getRatingText();
|
|
42
|
-
const filteredReviews = this.getFilteredReviews(this.pageOffset);
|
|
43
|
-
const filteredReviewsCount = this.ratings.indexOf(scoreValuesMapping.all) > -1
|
|
44
|
-
? this.totalReviews : filteredReviews.length;
|
|
45
|
-
return (h("div", { class: "reviews-list" },
|
|
46
|
-
h("div", { class: "reviews-list--header", style: {
|
|
47
|
-
display: 'flex',
|
|
48
|
-
flexDirection: 'row',
|
|
49
|
-
justifyContent: 'space-between',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
marginBottom: '24px',
|
|
52
|
-
} },
|
|
53
|
-
h("div", { class: "reviews-list--couter", style: { fontWeight: 'bold' } },
|
|
54
|
-
filteredReviewsCount,
|
|
55
|
-
" ",
|
|
56
|
-
filteredReviewsCount === 1 ? `review` : `reviews`),
|
|
57
|
-
h("div", { class: "reviews-list--sorting", style: {
|
|
58
|
-
display: 'flex',
|
|
59
|
-
flexDirection: 'row',
|
|
60
|
-
alignItems: 'center',
|
|
61
|
-
} },
|
|
62
|
-
h("label", { style: { marginRight: '8px', marginBottom: '0' } }, "Sort by"),
|
|
63
|
-
h("select", { class: "form-select", style: { width: '160px' }, onChange: (evt) => this.onChangeSorting(evt.target.value) }, sortOptions.map(sortOption => (h("option", { value: sortOption.value, selected: sortOption.value === this.sorting }, sortOption.label)))))),
|
|
64
|
-
h("div", { class: "view-content" }, filteredReviewsCount > 0 && filteredReviews.map(review => {
|
|
65
|
-
const { user } = review;
|
|
66
|
-
return (h("div", { class: "salon-review", style: {
|
|
67
|
-
marginBottom: '24px',
|
|
68
|
-
paddingBottom: '24px',
|
|
69
|
-
borderBottom: `1px solid ${Colors.Gray05}`,
|
|
70
|
-
} },
|
|
71
|
-
h("div", { class: "salon-review--user", style: { marginBottom: '24px' } },
|
|
72
|
-
h("user-avatar", { size: 48, avatar: user.avatar, name: user.name, shortName: `${(user.firstName || '').charAt(0)}${(user.lastName || '').charAt(0)}`, nameStyle: { fontWeight: 'bold' } })),
|
|
73
|
-
h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row', marginBottom: '4px' } },
|
|
74
|
-
[1, 2, 3, 4, 5].map(score => {
|
|
75
|
-
const isHightlight = score <= review.point;
|
|
76
|
-
return (h("i", { class: isHightlight ? 'ri-heart-fill' : 'ri-heart-line', style: Object.assign({ fontSize: '16px', marginRight: '4px' }, isHightlight ? { color: this.primaryColor } : { color: Colors.Gray03 }) }));
|
|
77
|
-
}),
|
|
78
|
-
review.createdDate && (h("div", { class: "salon-review--rating--date", style: { color: Colors.Gray03, marginLeft: '16px' } }, dayjs(review.createdDate).format(shortDate)))),
|
|
79
|
-
h("div", { class: "salon-review--rating-text", style: { fontSize: '16px', fontWeight: 'bold' } }, ratingTexts[review.point]),
|
|
80
|
-
(review.title || review.description) && (h("div", { class: "salon-review--detail", style: { marginTop: '24px' } },
|
|
81
|
-
h("div", { class: "salon-review--title", style: { fontSize: '18px', fontWeight: 'bold' }, innerHTML: review.title }),
|
|
82
|
-
h("div", { class: "salon-review--description", style: { fontSize: '16px' }, innerHTML: review.description }))),
|
|
83
|
-
review.photos.length > 0 && (h("div", { style: {
|
|
84
|
-
display: 'flex',
|
|
85
|
-
flexDirection: 'row',
|
|
86
|
-
overflowX: 'auto',
|
|
87
|
-
} }, review.photos.map(fileObj => (h("div", { style: {
|
|
88
|
-
border: '1px solid #d9d9d9',
|
|
89
|
-
position: 'relative',
|
|
90
|
-
cursor: 'pointer',
|
|
91
|
-
borderRadius: '2px',
|
|
92
|
-
height: '66px',
|
|
93
|
-
marginTop: '16px',
|
|
94
|
-
marginRight: '16px',
|
|
95
|
-
} },
|
|
96
|
-
h("img", { alt: "", src: fileObj.imageUrlThumb, height: "64", style: { width: 'auto' } }))))))));
|
|
97
|
-
})),
|
|
98
|
-
this.canLoadMore && (h("div", { class: "view-footer", style: { textAlign: 'center' } },
|
|
99
|
-
h("button", { type: "button", class: "btn btn-light", onClick: () => this.onLoadMore() }, this.isLoadingMore ? 'Loading' : 'Load more')))));
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
componentWillLoad() {
|
|
103
|
-
this.fetchData();
|
|
104
|
-
}
|
|
105
|
-
fetchData() {
|
|
106
|
-
try {
|
|
107
|
-
const promises = [
|
|
108
|
-
HttpService().fetchSalonInfo(this.salonId).then(salonInfo => this.salonInfo = salonInfo),
|
|
109
|
-
HttpService().fetchSalonReviews(this.salonId, { limit: pageLimited }).then(response => {
|
|
110
|
-
const { total, allItems } = response;
|
|
111
|
-
this.totalReviews = total;
|
|
112
|
-
this.salonReviews = allItems;
|
|
113
|
-
if (total > pageLimited) {
|
|
114
|
-
this.canLoadMore = true;
|
|
115
|
-
}
|
|
116
|
-
}),
|
|
117
|
-
];
|
|
118
|
-
return Promise.all(promises);
|
|
119
|
-
}
|
|
120
|
-
catch (e) { }
|
|
121
|
-
}
|
|
122
|
-
sortReviews(filteredReviews) {
|
|
123
|
-
return sortBy(filteredReviews, [review => {
|
|
124
|
-
if (this.sorting === 'rating_desc') {
|
|
125
|
-
return -review.point;
|
|
126
|
-
}
|
|
127
|
-
if (this.sorting === 'rating_asc') {
|
|
128
|
-
return review.point;
|
|
129
|
-
}
|
|
130
|
-
const createdTime = dayjs(review.createdDate).unix();
|
|
131
|
-
return this.sorting === 'oldest' ? createdTime : -createdTime;
|
|
132
|
-
}]);
|
|
133
|
-
}
|
|
134
|
-
getFilteredReviews(pageOffset) {
|
|
135
|
-
let filteredReviews = [...this.salonReviews];
|
|
136
|
-
if (this.ratings.indexOf(scoreValuesMapping.all) === -1) {
|
|
137
|
-
const reviewRatingScores = this.ratings.map(r => scoreValuesMapping[r]);
|
|
138
|
-
filteredReviews = [...filteredReviews].filter(review => reviewRatingScores.indexOf(review.point) > -1);
|
|
139
|
-
}
|
|
140
|
-
const sortedReviews = this.sortReviews(filteredReviews);
|
|
141
|
-
return pageOffset ? sortedReviews.slice(0, pageOffset) : sortedReviews;
|
|
142
|
-
}
|
|
143
|
-
onLoadMore() {
|
|
144
|
-
this.isLoadingMore = true;
|
|
145
|
-
try {
|
|
146
|
-
this.pageOffset += pageLimited;
|
|
147
|
-
const totalResults = this.getFilteredReviews(this.pageOffset).length;
|
|
148
|
-
if (this.pageOffset > totalResults) {
|
|
149
|
-
this.canLoadMore = false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
catch (error) { }
|
|
153
|
-
this.isLoadingMore = false;
|
|
154
|
-
}
|
|
155
|
-
onChangeSorting(sorting) {
|
|
156
|
-
this.sorting = sorting;
|
|
157
|
-
this.pageOffset = pageLimited;
|
|
158
|
-
this.canLoadMore = this.getFilteredReviews(pageLimited).length >= pageLimited;
|
|
159
|
-
}
|
|
160
|
-
;
|
|
161
|
-
onChangeFilterRating(rating) {
|
|
162
|
-
if (rating === scoreValuesMapping.all) {
|
|
163
|
-
this.ratings = [scoreValuesMapping.all, 'star1', 'star2', 'star3', 'star4', 'star5'];
|
|
164
|
-
}
|
|
165
|
-
else if (this.ratings.indexOf(rating) > -1) {
|
|
166
|
-
this.ratings = this.ratings.filter(r => r !== scoreValuesMapping.all && r !== rating);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
const needFilterByAll = this.ratings.concat([rating]).filter(r => r !== scoreValuesMapping.all).length === 5;
|
|
170
|
-
this.ratings = needFilterByAll
|
|
171
|
-
? [scoreValuesMapping.all, 'star1', 'star2', 'star3', 'star4', 'star5']
|
|
172
|
-
: this.ratings.concat([rating]);
|
|
173
|
-
}
|
|
174
|
-
this.pageOffset = pageLimited;
|
|
175
|
-
this.canLoadMore = this.getFilteredReviews(pageLimited).length >= pageLimited;
|
|
176
|
-
}
|
|
177
|
-
;
|
|
178
|
-
renderReviewsFilters() {
|
|
179
|
-
const reviewsByScore = groupBy(this.salonReviews, review => review.point);
|
|
180
|
-
const isAllChecked = this.ratings.indexOf(scoreValuesMapping.all) > -1;
|
|
181
|
-
const inputCheckedStyle = css({
|
|
182
|
-
outline: 'none !important',
|
|
183
|
-
backgroundColor: `${this.primaryColor} !important`,
|
|
184
|
-
borderColor: `${this.primaryColor} !important`,
|
|
185
|
-
});
|
|
186
|
-
return (h("div", { class: "salon-reviews--filters-by-ratings" },
|
|
187
|
-
h("div", { style: {
|
|
188
|
-
fontWeight: 'bold',
|
|
189
|
-
marginBottom: '12px',
|
|
190
|
-
marginTop: '32px',
|
|
191
|
-
} }, "Filter by ratings"),
|
|
192
|
-
h("div", { class: "salon-reviews--filters-by-ratings--options" },
|
|
193
|
-
h("div", { class: "checkbox--wrapper", style: { marginBottom: '12px' } },
|
|
194
|
-
h("div", { class: "checkbox--box" },
|
|
195
|
-
h("div", { class: "form-check" },
|
|
196
|
-
h("input", Object.assign({ type: "checkbox", class: "form-check-input", value: scoreValuesMapping.all, onChange: () => this.onChangeFilterRating(scoreValuesMapping.all), checked: isAllChecked }, isAllChecked ? inputCheckedStyle : {})),
|
|
197
|
-
h("label", { class: "form-check-label" }, "All ratings")))),
|
|
198
|
-
[5, 4, 3, 2, 1].filter(score => reviewsByScore[score]).map(score => {
|
|
199
|
-
const scoreReviewCount = reviewsByScore[score].length;
|
|
200
|
-
const isChecked = this.ratings.indexOf(scoreValuesMapping.all) > -1 || this.ratings.indexOf(`star${score}`) > -1;
|
|
201
|
-
return (h("div", { style: {
|
|
202
|
-
display: 'flex',
|
|
203
|
-
flexDirection: 'row',
|
|
204
|
-
justifyContent: 'space-between',
|
|
205
|
-
marginBottom: '12px',
|
|
206
|
-
} },
|
|
207
|
-
h("div", { class: "form-check" },
|
|
208
|
-
h("input", Object.assign({ value: "", type: "checkbox", class: "form-check-input", onChange: () => this.onChangeFilterRating(`star${score}`), checked: isChecked }, isChecked ? inputCheckedStyle : {})),
|
|
209
|
-
h("label", { class: "form-check-label" }, [1, 2, 3, 4, 5].map(point => {
|
|
210
|
-
const isHightlight = point <= score;
|
|
211
|
-
return (h("i", { class: isHightlight ? 'ri-heart-fill' : 'ri-heart-line', style: { fontSize: '16px', marginRight: '4px' } }));
|
|
212
|
-
}))),
|
|
213
|
-
h("div", { style: { color: Colors.Gray01 } }, scoreReviewCount)));
|
|
214
|
-
}))));
|
|
215
|
-
}
|
|
216
|
-
render() {
|
|
217
|
-
const { rating } = this.salonInfo || {};
|
|
218
|
-
return (h("div", { class: "salon-reviews", style: { display: 'flex', flexDirection: 'row' } },
|
|
219
|
-
h("div", { class: "salon-reviews--filters", style: { width: '264px' } },
|
|
220
|
-
h("div", { class: "salon-reviews--score" },
|
|
221
|
-
h("div", { class: "salon-review--rating", style: { display: 'flex', flexDirection: 'row' } }, [1, 2, 3, 4, 5].map(score => {
|
|
222
|
-
return (h("i", { class: score <= rating ? 'ri-heart-fill' : 'ri-heart-line', style: Object.assign({ fontSize: '32px', marginRight: '4px' }, score <= rating ? { color: this.primaryColor } : { color: Colors.Gray03 }) }));
|
|
223
|
-
})),
|
|
224
|
-
h("div", { class: "salon-review--rating--date", style: {
|
|
225
|
-
display: 'flex',
|
|
226
|
-
flexDirection: 'row',
|
|
227
|
-
alignItems: 'center',
|
|
228
|
-
marginTop: '-8px',
|
|
229
|
-
} },
|
|
230
|
-
h("span", { style: { fontSize: '24px' } },
|
|
231
|
-
rating,
|
|
232
|
-
"/5"),
|
|
233
|
-
" ",
|
|
234
|
-
h("span", { style: { color: Colors.Gray02, marginLeft: '8px' } },
|
|
235
|
-
"(",
|
|
236
|
-
this.totalReviews,
|
|
237
|
-
" reviews)"))),
|
|
238
|
-
h("div", { class: "salon-reviews--filters--options" }, this.renderReviewsFilters())),
|
|
239
|
-
h("div", { class: "salon-reviews--list", style: {
|
|
240
|
-
flexGrow: '1',
|
|
241
|
-
flexShrink: '1',
|
|
242
|
-
paddingLeft: '64px',
|
|
243
|
-
} }, this.renderReviewsList())));
|
|
244
|
-
}
|
|
245
|
-
static get is() { return "salon-reviews"; }
|
|
246
|
-
static get originalStyleUrls() { return {
|
|
247
|
-
"$": ["index.less"]
|
|
248
|
-
}; }
|
|
249
|
-
static get styleUrls() { return {
|
|
250
|
-
"$": ["index.css"]
|
|
251
|
-
}; }
|
|
252
|
-
static get properties() { return {
|
|
253
|
-
"salonId": {
|
|
254
|
-
"type": "number",
|
|
255
|
-
"mutable": false,
|
|
256
|
-
"complexType": {
|
|
257
|
-
"original": "number",
|
|
258
|
-
"resolved": "number",
|
|
259
|
-
"references": {}
|
|
260
|
-
},
|
|
261
|
-
"required": false,
|
|
262
|
-
"optional": false,
|
|
263
|
-
"docs": {
|
|
264
|
-
"tags": [],
|
|
265
|
-
"text": ""
|
|
266
|
-
},
|
|
267
|
-
"attribute": "salon-id",
|
|
268
|
-
"reflect": false
|
|
269
|
-
},
|
|
270
|
-
"primaryColor": {
|
|
271
|
-
"type": "string",
|
|
272
|
-
"mutable": false,
|
|
273
|
-
"complexType": {
|
|
274
|
-
"original": "string",
|
|
275
|
-
"resolved": "string",
|
|
276
|
-
"references": {}
|
|
277
|
-
},
|
|
278
|
-
"required": false,
|
|
279
|
-
"optional": false,
|
|
280
|
-
"docs": {
|
|
281
|
-
"tags": [],
|
|
282
|
-
"text": ""
|
|
283
|
-
},
|
|
284
|
-
"attribute": "primary-color",
|
|
285
|
-
"reflect": false,
|
|
286
|
-
"defaultValue": "Colors.Coral03"
|
|
287
|
-
}
|
|
288
|
-
}; }
|
|
289
|
-
static get states() { return {
|
|
290
|
-
"salonInfo": {},
|
|
291
|
-
"totalReviews": {},
|
|
292
|
-
"salonReviews": {},
|
|
293
|
-
"canLoadMore": {},
|
|
294
|
-
"isLoadingMore": {},
|
|
295
|
-
"pageOffset": {},
|
|
296
|
-
"ratings": {},
|
|
297
|
-
"sorting": {}
|
|
298
|
-
}; }
|
|
299
|
-
static get methods() { return {
|
|
300
|
-
"fetchData": {
|
|
301
|
-
"complexType": {
|
|
302
|
-
"signature": "() => Promise<any[]>",
|
|
303
|
-
"parameters": [],
|
|
304
|
-
"references": {
|
|
305
|
-
"Promise": {
|
|
306
|
-
"location": "global"
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
"return": "Promise<any[]>"
|
|
310
|
-
},
|
|
311
|
-
"docs": {
|
|
312
|
-
"text": "",
|
|
313
|
-
"tags": []
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}; }
|
|
317
|
-
}
|