@ecomplus/widget-martan 1.1.22 → 1.2.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/.version +0 -0
- package/CHANGELOG.md +14 -0
- package/cms.config.js +78 -83
- package/dist/public/widget-martan.0.min.js +62 -0
- package/dist/public/widget-martan.0.min.js.map +1 -0
- package/dist/public/widget-martan.1.min.js.map +1 -1
- package/dist/public/widget-martan.2.min.js +1 -1
- package/dist/public/widget-martan.2.min.js.map +1 -1
- package/dist/public/widget-martan.3.min.js +1 -1
- package/dist/public/widget-martan.3.min.js.map +1 -1
- package/dist/public/widget-martan.4.min.js +1 -1
- package/dist/public/widget-martan.4.min.js.map +1 -1
- package/dist/public/widget-martan.5.min.js +1 -1
- package/dist/public/widget-martan.5.min.js.map +1 -1
- package/dist/public/widget-martan.6.min.js +2 -0
- package/dist/public/widget-martan.6.min.js.map +1 -0
- package/dist/public/widget-martan.7.min.js +2 -0
- package/dist/public/widget-martan.7.min.js.map +1 -0
- package/dist/public/widget-martan.8.min.js +2 -0
- package/dist/public/widget-martan.8.min.js.map +1 -0
- package/dist/public/widget-martan.9.min.js +2 -0
- package/dist/public/widget-martan.9.min.js.map +1 -0
- package/dist/public/widget-martan.var.min.js +3 -3
- package/dist/public/widget-martan.var.min.js.map +1 -1
- package/dist/widget-martan.0.min.js +62 -0
- package/dist/widget-martan.0.min.js.map +1 -0
- package/dist/widget-martan.1.min.js.map +1 -1
- package/dist/widget-martan.2.min.js +1 -1
- package/dist/widget-martan.2.min.js.map +1 -1
- package/dist/widget-martan.3.min.js +1 -1
- package/dist/widget-martan.3.min.js.map +1 -1
- package/dist/widget-martan.4.min.js +1 -1
- package/dist/widget-martan.4.min.js.map +1 -1
- package/dist/widget-martan.5.min.js +1 -1
- package/dist/widget-martan.5.min.js.map +1 -1
- package/dist/widget-martan.6.min.js +2 -0
- package/dist/widget-martan.6.min.js.map +1 -0
- package/dist/widget-martan.7.min.js +2 -0
- package/dist/widget-martan.7.min.js.map +1 -0
- package/dist/widget-martan.8.min.js +2 -0
- package/dist/widget-martan.8.min.js.map +1 -0
- package/dist/widget-martan.9.min.js +2 -0
- package/dist/widget-martan.9.min.js.map +1 -0
- package/dist/widget-martan.min.js +3 -3
- package/dist/widget-martan.min.js.map +1 -1
- package/package.json +2 -2
- package/src/append/product-block.ejs +5 -1
- package/src/append/product-card-slots.ejs +1 -1
- package/src/append/product-slots.ejs +1 -9
- package/src/index.js +17 -12
- package/src/utils/configProps.js +29 -0
- package/src/utils/lighten-color.js +20 -0
- package/src/utils/widget-initializer.js +60 -0
- package/src/widgets/questions/Questions.vue +436 -0
- package/src/widgets/questions/index.js +10 -0
- package/src/widgets/ratings/Rating.vue +223 -0
- package/src/widgets/ratings/index.js +232 -0
- package/src/widgets/reviews/Reviews.vue +317 -288
- package/src/widgets/reviews/components/Quickview.vue +390 -0
- package/src/widgets/reviews/components/Rating.vue +106 -0
- package/src/widgets/reviews/components/RatingBreakdown.vue +171 -0
- package/src/widgets/reviews/components/RatingHistogram.vue +306 -0
- package/src/widgets/reviews/components/RatingSummary.vue +226 -0
- package/src/widgets/reviews/components/RatingSummaryG.vue +104 -0
- package/src/widgets/reviews/components/ReviewCard.vue +223 -0
- package/src/widgets/reviews/{ReviewReply.vue → components/ReviewReply.vue} +42 -1
- package/src/widgets/reviews/{Score.vue → components/Score.vue} +3 -4
- package/src/widgets/reviews/{Sort.vue → components/Sort.vue} +1 -1
- package/src/widgets/reviews/components/SortDropdown.vue +184 -0
- package/src/widgets/reviews/components/VerifiedPurchase.vue +121 -0
- package/src/widgets/reviews/headers/Center.vue +248 -0
- package/src/widgets/reviews/headers/Compact.vue +225 -0
- package/src/widgets/reviews/headers/Histogram.vue +224 -0
- package/src/widgets/reviews/headers/Padrao.vue +113 -0
- package/src/widgets/reviews/headers/Summary.vue +217 -0
- package/src/widgets/reviews/index.js +2 -48
- package/src/append/body.ejs +0 -79
- package/src/append/head.ejs +0 -5
- package/src/append/stamps.ejs +0 -3
- package/src/widgets/reviews/AuthorAndRating.vue +0 -30
- package/src/widgets/reviews/AverageScore.vue +0 -160
- package/src/widgets/reviews/AverageTotal.vue +0 -35
- package/src/widgets/reviews/CardReview.vue +0 -87
- package/src/widgets/reviews/GridView.vue +0 -113
- package/src/widgets/reviews/HeaderExpanded.vue +0 -84
- package/src/widgets/reviews/HeaderMinimal.vue +0 -110
- package/src/widgets/reviews/ListView.vue +0 -47
- package/src/widgets/reviews/Quickview.vue +0 -397
- package/src/widgets/reviews/ReviewBody.vue +0 -39
- package/src/widgets/reviews/ThumbsPictures.vue +0 -135
- package/src/widgets/reviews/Total.vue +0 -79
- package/src/widgets/reviews/VerifiedPurchase.vue +0 -110
- package/src/widgets/reviews/isRecommended.vue +0 -44
- package/src/widgets/snippets/Rating.vue +0 -71
- package/src/widgets/snippets/Snippets.vue +0 -311
- package/src/widgets/snippets/index.js +0 -45
- /package/src/widgets/reviews/{VideoPlayer.vue → components/VideoPlayer.vue} +0 -0
|
@@ -1,107 +1,80 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</
|
|
2
|
+
<div v-show="total > 0" class="martan-reviews container">
|
|
3
|
+
<p class="lead" v-if="title">
|
|
4
|
+
<a href="#reviews" :name="title || 'reviews'">#</a>
|
|
5
|
+
{{ title }}
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<component :is="config.widget_review.header_layout" :config="config" :rating="average"
|
|
9
|
+
:recommended="totalRecommended" :average="averageTotal" :total-rating="total" @rating-selected="updateOrderBy"
|
|
10
|
+
:list="list" :order-rating="orderRating" :offset="offset" />
|
|
11
|
+
|
|
12
|
+
<div :class="config.widget_review.reviews_layout">
|
|
13
|
+
<transition-group name="review-list" tag="div" :class="config.widget_review.reviews_layout">
|
|
14
|
+
<review-card
|
|
15
|
+
v-for="review in list"
|
|
16
|
+
:key="review.id"
|
|
17
|
+
:review="review"
|
|
18
|
+
:star-color="config.widget_review.star_color"
|
|
19
|
+
class="masonry-item"
|
|
20
|
+
@openQuickview="openQuickview"
|
|
21
|
+
/>
|
|
22
|
+
</transition-group>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="actions" v-if="showLoadMore()">
|
|
26
|
+
<div class="pagination">
|
|
27
|
+
<button class="btn btn-primary" @click="loadMore" :disabled="loading">
|
|
28
|
+
{{ loading ? "Carregando.." : "Mostrar mais avaliações" }}
|
|
29
|
+
</button>
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
|
-
<
|
|
34
|
-
|
|
33
|
+
<Quickview @onClose="onCloseQuickview" :isOpen="isOpenQuickView" :review="selectedReview" :starColor="config.widget_review.star_color" />
|
|
34
|
+
|
|
35
|
+
<div class="credit">
|
|
36
|
+
Avaliações reais, auditadas por
|
|
37
|
+
<a :href="getUrl" target="_blank" rel="noopener">MARTAN.app</a>
|
|
38
|
+
</div>
|
|
35
39
|
</div>
|
|
36
40
|
</template>
|
|
37
41
|
|
|
38
42
|
<script>
|
|
43
|
+
import { MARTAN_API } from "../..";
|
|
39
44
|
|
|
40
|
-
import
|
|
41
|
-
|
|
42
|
-
import
|
|
43
|
-
import Quickview from "./Quickview.vue";
|
|
44
|
-
import { MARTAN_API } from '../..';
|
|
45
|
+
import Ratings from "../ratings";
|
|
46
|
+
|
|
47
|
+
import { configProp } from "../../utils/configProps";
|
|
45
48
|
|
|
46
49
|
export default {
|
|
47
50
|
name: "Reviews",
|
|
48
51
|
|
|
49
52
|
props: {
|
|
50
|
-
|
|
51
|
-
type: Number,
|
|
52
|
-
required: true
|
|
53
|
-
},
|
|
54
|
-
webId: {
|
|
55
|
-
type: String,
|
|
56
|
-
required: true
|
|
57
|
-
},
|
|
53
|
+
...configProp,
|
|
58
54
|
product: {
|
|
59
55
|
type: String,
|
|
60
|
-
required: true
|
|
61
|
-
}
|
|
62
|
-
backgroundColor: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: "#fff",
|
|
65
|
-
},
|
|
66
|
-
starColor: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: "#212529",
|
|
69
|
-
},
|
|
70
|
-
primaryColor: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: "#212529",
|
|
73
|
-
},
|
|
74
|
-
headerLayout: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: "header-minimal",
|
|
77
|
-
},
|
|
78
|
-
reviewsLayout: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: "list-grid",
|
|
81
|
-
},
|
|
82
|
-
title: {
|
|
83
|
-
type: String,
|
|
84
|
-
},
|
|
85
|
-
showTitle: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: true,
|
|
88
|
-
},
|
|
56
|
+
required: true,
|
|
57
|
+
}
|
|
89
58
|
},
|
|
90
59
|
|
|
91
60
|
data() {
|
|
92
61
|
return {
|
|
93
62
|
list: [],
|
|
94
63
|
total: 0,
|
|
95
|
-
limit:
|
|
64
|
+
limit: 4,
|
|
96
65
|
offset: 0,
|
|
66
|
+
|
|
97
67
|
loading: false,
|
|
68
|
+
|
|
98
69
|
orderRating: null,
|
|
99
70
|
orderReviews: null,
|
|
100
|
-
averageTotal: 0,
|
|
101
71
|
|
|
102
72
|
$isSorting: false,
|
|
103
73
|
$count: null,
|
|
74
|
+
hasMore: false,
|
|
104
75
|
|
|
76
|
+
averageTotal: 0,
|
|
77
|
+
totalRecommended: null,
|
|
105
78
|
average: {
|
|
106
79
|
one: 0,
|
|
107
80
|
two: 0,
|
|
@@ -112,10 +85,18 @@ export default {
|
|
|
112
85
|
|
|
113
86
|
isOpenQuickView: false,
|
|
114
87
|
selectedReview: null,
|
|
88
|
+
isScrollable: false,
|
|
89
|
+
|
|
90
|
+
$listEl: null,
|
|
115
91
|
};
|
|
116
92
|
},
|
|
117
93
|
|
|
118
94
|
watch: {
|
|
95
|
+
onlyWithPictures: function (newVal) {
|
|
96
|
+
if (!this.$listEl && newVal.length > 0) {
|
|
97
|
+
this.$listEl = document.querySelector(".reviews-with-pictures");
|
|
98
|
+
}
|
|
99
|
+
},
|
|
119
100
|
orderRating: function (oldOrder, newOrder) {
|
|
120
101
|
if (oldOrder !== newOrder) {
|
|
121
102
|
this.list = [];
|
|
@@ -139,6 +120,28 @@ export default {
|
|
|
139
120
|
},
|
|
140
121
|
},
|
|
141
122
|
|
|
123
|
+
computed: {
|
|
124
|
+
i19basedOn$1Reviews: () => "Baseado em $1 avaliações",
|
|
125
|
+
i19basedOn$1Review: () => "Baseado em $1 avaliação",
|
|
126
|
+
i19noReview: () => "Nenhuma avaliação",
|
|
127
|
+
onlyWithPictures() {
|
|
128
|
+
return this.list.filter(
|
|
129
|
+
(review) => review.pictures && review.pictures.length > 0
|
|
130
|
+
);
|
|
131
|
+
},
|
|
132
|
+
getUrl() {
|
|
133
|
+
const url = new URL(window.location.href);
|
|
134
|
+
const ref = url.origin;
|
|
135
|
+
return `https://www.martan.app/?ref=${ref}`;
|
|
136
|
+
},
|
|
137
|
+
title() {
|
|
138
|
+
if (this.config.widget_review.title) {
|
|
139
|
+
return this.config.widget_review.title;
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
|
|
142
145
|
methods: {
|
|
143
146
|
fetchReviews() {
|
|
144
147
|
const params = {
|
|
@@ -161,16 +164,19 @@ export default {
|
|
|
161
164
|
this.loading = true;
|
|
162
165
|
|
|
163
166
|
axios({
|
|
164
|
-
url: MARTAN_API +
|
|
167
|
+
url: MARTAN_API + "/api/v1/reviews.json",
|
|
165
168
|
headers: {
|
|
166
|
-
"X-Store-Id": this.
|
|
167
|
-
"X-
|
|
169
|
+
"X-Store-Id": this.config.store_id,
|
|
170
|
+
"X-Api-Key": this.config.web_id,
|
|
168
171
|
},
|
|
169
172
|
params,
|
|
170
173
|
})
|
|
171
174
|
.then(({ data }) => {
|
|
172
175
|
const { result, count } = data;
|
|
173
176
|
let list = [];
|
|
177
|
+
|
|
178
|
+
this.hasMore = result.length >= this.limit;
|
|
179
|
+
|
|
174
180
|
if (
|
|
175
181
|
(Array.isArray(this.list) && !this.orderReviews) ||
|
|
176
182
|
(this.orderReviews && this.$isSorting)
|
|
@@ -183,7 +189,7 @@ export default {
|
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
191
|
|
|
186
|
-
list = [...this.list
|
|
192
|
+
list = [...this.list];
|
|
187
193
|
} else if (
|
|
188
194
|
(Array.isArray(this.list) && this.orderReviews) ||
|
|
189
195
|
this.orderRating
|
|
@@ -201,7 +207,6 @@ export default {
|
|
|
201
207
|
} else {
|
|
202
208
|
this.total = count;
|
|
203
209
|
}
|
|
204
|
-
|
|
205
210
|
this.list = list;
|
|
206
211
|
|
|
207
212
|
return list;
|
|
@@ -216,28 +221,23 @@ export default {
|
|
|
216
221
|
});
|
|
217
222
|
},
|
|
218
223
|
|
|
219
|
-
fetchAverage() {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
"X-Web-Id": this.webId,
|
|
225
|
-
},
|
|
226
|
-
params: {
|
|
227
|
-
sku: this.product,
|
|
228
|
-
},
|
|
229
|
-
})
|
|
230
|
-
.then(({ data }) => {
|
|
231
|
-
if (data.length) {
|
|
232
|
-
const { average, rating } = data[0];
|
|
233
|
-
Object.assign(this.average, rating);
|
|
234
|
-
this.averageTotal = average;
|
|
235
|
-
}
|
|
224
|
+
async fetchAverage() {
|
|
225
|
+
try {
|
|
226
|
+
const rating = new Ratings({
|
|
227
|
+
store_id: this.config.store_id,
|
|
228
|
+
web_id: this.config.web_id,
|
|
236
229
|
})
|
|
237
|
-
|
|
238
|
-
.
|
|
239
|
-
|
|
240
|
-
|
|
230
|
+
await rating.fetchRatings()
|
|
231
|
+
const data = rating.getProductRatingFromList(this.product);
|
|
232
|
+
if (data) {
|
|
233
|
+
const { average, rate, recommended_percentage } = data;
|
|
234
|
+
Object.assign(this.average, rate);
|
|
235
|
+
this.averageTotal = average;
|
|
236
|
+
this.totalRecommended = recommended_percentage;
|
|
237
|
+
}
|
|
238
|
+
} catch (error) {
|
|
239
|
+
console.error('Failed to load average from Martan', error);
|
|
240
|
+
}
|
|
241
241
|
},
|
|
242
242
|
|
|
243
243
|
loadMore() {
|
|
@@ -249,34 +249,34 @@ export default {
|
|
|
249
249
|
},
|
|
250
250
|
|
|
251
251
|
showLoadMore() {
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
this.total > 0 &&
|
|
255
|
-
this.list.length < this.total
|
|
256
|
-
) {
|
|
257
|
-
return true;
|
|
252
|
+
if (this.loading) {
|
|
253
|
+
return false;
|
|
258
254
|
}
|
|
259
255
|
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
) {
|
|
265
|
-
return
|
|
256
|
+
if (!this.hasMore) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (this.orderRating) {
|
|
261
|
+
return this.$count > 0 && this.list.length < this.$count;
|
|
262
|
+
} else {
|
|
263
|
+
return this.total > 0 && this.list.length < this.total;
|
|
266
264
|
}
|
|
267
265
|
},
|
|
268
266
|
|
|
269
|
-
updateOrderBy(
|
|
267
|
+
updateOrderBy(rating) {
|
|
270
268
|
if (rating === this.orderRating) {
|
|
271
269
|
this.orderRating = null;
|
|
272
270
|
} else {
|
|
273
271
|
this.offset = 0;
|
|
274
272
|
this.orderRating = rating;
|
|
275
273
|
}
|
|
274
|
+
this.hasMore = true;
|
|
276
275
|
},
|
|
277
276
|
|
|
278
277
|
onSort({ order }) {
|
|
279
278
|
this.orderReviews = order;
|
|
279
|
+
this.hasMore = true;
|
|
280
280
|
},
|
|
281
281
|
|
|
282
282
|
openQuickview: function ({ review }) {
|
|
@@ -288,209 +288,238 @@ export default {
|
|
|
288
288
|
this.isOpenQuickView = false;
|
|
289
289
|
this.selectedReview = null;
|
|
290
290
|
},
|
|
291
|
-
},
|
|
292
|
-
|
|
293
|
-
mounted() {
|
|
294
|
-
Promise.all([this.fetchAverage(), this.fetchReviews()]);
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
components: {
|
|
298
|
-
"list-grid": () => import("./GridView.vue"),
|
|
299
|
-
"list-expanded": () => import("./ListView.vue"),
|
|
300
|
-
"header-expanded": () => import("./HeaderExpanded.vue"),
|
|
301
|
-
"header-minimal": () => import("./HeaderMinimal.vue"),
|
|
302
|
-
Total,
|
|
303
|
-
ListView,
|
|
304
|
-
GridView,
|
|
305
|
-
Quickview
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
</script>
|
|
309
|
-
|
|
310
|
-
<style lang="scss">
|
|
311
|
-
.mt-review {
|
|
312
|
-
padding: 25px 0 22px;
|
|
313
|
-
|
|
314
|
-
&:first-child {
|
|
315
|
-
padding-top: 0;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
291
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
292
|
+
checkScrollability() {
|
|
293
|
+
const list = this.$listEl;
|
|
294
|
+
if (!list) return;
|
|
323
295
|
|
|
324
|
-
.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
.mt-review__body {
|
|
331
|
-
opacity: 0.9;
|
|
332
|
-
margin-top: 10px;
|
|
333
|
-
font-size: 16px;
|
|
334
|
-
line-height: 1.6;
|
|
335
|
-
text-align: justify;
|
|
336
|
-
}
|
|
296
|
+
this.isScrollable = list.scrollWidth > list.clientWidth;
|
|
297
|
+
},
|
|
298
|
+
scrollLeft() {
|
|
299
|
+
const list = this.$listEl;
|
|
300
|
+
if (!list) return;
|
|
337
301
|
|
|
338
|
-
.
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
302
|
+
list.scrollBy({ left: -1500, behavior: "smooth" });
|
|
303
|
+
},
|
|
304
|
+
scrollRight() {
|
|
305
|
+
const list = this.$listEl;
|
|
306
|
+
if (!list) return;
|
|
344
307
|
|
|
345
|
-
.
|
|
346
|
-
|
|
347
|
-
color: #333;
|
|
348
|
-
font-weight: bolder;
|
|
349
|
-
display: flex;
|
|
350
|
-
align-items: center;
|
|
351
|
-
justify-content: center;
|
|
352
|
-
gap: 5px;
|
|
353
|
-
}
|
|
308
|
+
list.scrollBy({ left: 1500, behavior: "smooth" });
|
|
309
|
+
},
|
|
354
310
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
cursor: pointer;
|
|
358
|
-
}
|
|
311
|
+
initMasonry() {
|
|
312
|
+
const supportsMasonry = CSS.supports('grid-template-rows', 'masonry');
|
|
359
313
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
margin-top: 0.75rem;
|
|
365
|
-
color: #777;
|
|
366
|
-
border: 1px solid #777;
|
|
367
|
-
border-radius: 50px;
|
|
368
|
-
max-width: 100px;
|
|
369
|
-
justify-content: space-evenly;
|
|
370
|
-
height: 30px;
|
|
371
|
-
}
|
|
314
|
+
if (!supportsMasonry) {
|
|
315
|
+
const gridContainer = this.$el.querySelector('.list-grid');
|
|
316
|
+
if (gridContainer) {
|
|
317
|
+
gridContainer.classList.add('list-grid--masonry-fallback');
|
|
372
318
|
|
|
373
|
-
.
|
|
374
|
-
|
|
375
|
-
|
|
319
|
+
const cards = gridContainer.querySelectorAll('review-card');
|
|
320
|
+
cards.forEach(card => {
|
|
321
|
+
card.classList.add('masonry-item');
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
const gridContainer = this.$el.querySelector('.list-grid');
|
|
326
|
+
if (gridContainer) {
|
|
327
|
+
gridContainer.classList.remove('list-grid--masonry-fallback');
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
},
|
|
376
332
|
|
|
377
|
-
|
|
378
|
-
.
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
333
|
+
mounted() {
|
|
334
|
+
Promise.all([this.fetchAverage(), this.fetchReviews()]).then(() => {
|
|
335
|
+
this.checkScrollability();
|
|
336
|
+
this.initMasonry();
|
|
337
|
+
window.addEventListener("resize", () => {
|
|
338
|
+
this.checkScrollability();
|
|
339
|
+
this.initMasonry();
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
},
|
|
382
343
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
344
|
+
beforeDestroy() {
|
|
345
|
+
window.removeEventListener("resize", this.checkScrollability);
|
|
346
|
+
},
|
|
386
347
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
border-left: 3px solid rgb(230, 230, 230);
|
|
399
|
-
}
|
|
348
|
+
components: {
|
|
349
|
+
ReviewCard: () => import("./components/ReviewCard.vue"),
|
|
350
|
+
Quickview: () => import("./components/Quickview.vue"),
|
|
351
|
+
Compact: () => import("./headers/Compact.vue"),
|
|
352
|
+
Center: () => import("./headers/Center.vue"),
|
|
353
|
+
Summary: () => import("./headers/Summary.vue"),
|
|
354
|
+
Padrao: () => import("./headers/Padrao.vue"),
|
|
355
|
+
Histogram: () => import("./headers/Histogram.vue"),
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
</script>
|
|
400
359
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
360
|
+
<style lang="scss" scoped>
|
|
361
|
+
.martan-reviews {
|
|
362
|
+
color: #444;
|
|
363
|
+
.widget-header {
|
|
364
|
+
display: flex;
|
|
365
|
+
justify-content: space-between;
|
|
366
|
+
align-items: center;
|
|
367
|
+
gap: 1rem;
|
|
368
|
+
|
|
369
|
+
&__score {
|
|
370
|
+
max-width: 500px;
|
|
371
|
+
width: 100%;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
&__score-average {
|
|
375
|
+
font-size: 1.25rem;
|
|
376
|
+
color: #444;
|
|
377
|
+
}
|
|
404
378
|
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
.mt-reply__date {
|
|
408
|
-
font-weight: normal;
|
|
409
|
-
font-size: 14px;
|
|
410
|
-
text-decoration: none;
|
|
411
|
-
color: #475569;
|
|
412
|
-
color: #777;
|
|
413
|
-
}
|
|
414
379
|
|
|
415
|
-
.
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
380
|
+
.list-expanded {
|
|
381
|
+
display: flex;
|
|
382
|
+
flex-direction: column;
|
|
383
|
+
gap: 1rem;
|
|
384
|
+
}
|
|
420
385
|
|
|
421
|
-
.
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
386
|
+
.list-grid {
|
|
387
|
+
display: grid;
|
|
388
|
+
grid-template-columns: repeat(2, 1fr);
|
|
389
|
+
grid-template-rows: masonry;
|
|
390
|
+
gap: 1rem;
|
|
391
|
+
max-width: 1200px;
|
|
392
|
+
margin: 0 auto;
|
|
393
|
+
align-items: start;
|
|
394
|
+
|
|
395
|
+
@media (max-width: 768px) {
|
|
396
|
+
grid-template-columns: 1fr;
|
|
397
|
+
grid-template-rows: masonry;
|
|
398
|
+
max-width: 100%;
|
|
399
|
+
gap: 0.75rem;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@media (min-width: 769px) and (max-width: 1200px) {
|
|
403
|
+
grid-template-columns: repeat(2, 1fr);
|
|
404
|
+
grid-template-rows: masonry;
|
|
405
|
+
max-width: 100%;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
@media (min-width: 1201px) {
|
|
409
|
+
grid-template-columns: repeat(2, minmax(0, 580px));
|
|
410
|
+
grid-template-rows: masonry;
|
|
411
|
+
justify-content: center;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
@supports not (grid-template-rows: masonry) {
|
|
415
|
+
display: flex;
|
|
416
|
+
flex-direction: column;
|
|
417
|
+
flex-wrap: wrap;
|
|
418
|
+
max-height: none;
|
|
419
|
+
align-content: flex-start;
|
|
420
|
+
|
|
421
|
+
@media (min-width: 769px) {
|
|
422
|
+
flex-direction: row;
|
|
423
|
+
align-content: flex-start;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
426
427
|
|
|
427
|
-
.
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
428
|
+
.list-grid--masonry-fallback {
|
|
429
|
+
display: block;
|
|
430
|
+
column-count: 1;
|
|
431
|
+
column-gap: 1rem;
|
|
432
|
+
|
|
433
|
+
@media (min-width: 769px) {
|
|
434
|
+
column-count: 2;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
@media (min-width: 1201px) {
|
|
438
|
+
column-count: 2;
|
|
439
|
+
max-width: 1200px;
|
|
440
|
+
margin: 0 auto;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.masonry-item {
|
|
444
|
+
break-inside: avoid;
|
|
445
|
+
margin-bottom: 1rem;
|
|
446
|
+
display: inline-block;
|
|
447
|
+
width: 100%;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
432
450
|
|
|
433
|
-
.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
451
|
+
.reviews-with-pictures {
|
|
452
|
+
display: flex;
|
|
453
|
+
gap: 0.5rem;
|
|
454
|
+
flex-direction: column;
|
|
455
|
+
background-color: rgba(255, 236, 219, 0.102);
|
|
456
|
+
border: 1px solid rgba(255, 236, 219, 0.102);
|
|
457
|
+
border-radius: 0.25rem;
|
|
458
|
+
display: flex;
|
|
459
|
+
font-size: 80%;
|
|
460
|
+
margin-top: 1rem;
|
|
461
|
+
padding: 2rem;
|
|
462
|
+
width: 100%;
|
|
443
463
|
|
|
444
|
-
.
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
464
|
+
.list {
|
|
465
|
+
display: flex;
|
|
466
|
+
gap: 1rem;
|
|
467
|
+
flex-direction: row;
|
|
468
|
+
overflow-x: auto;
|
|
469
|
+
scroll-snap-type: x mandatory;
|
|
470
|
+
-webkit-overflow-scrolling: touch;
|
|
471
|
+
scrollbar-width: none;
|
|
472
|
+
|
|
473
|
+
&::-webkit-scrollbar {
|
|
474
|
+
display: none;
|
|
475
|
+
}
|
|
448
476
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
477
|
+
img {
|
|
478
|
+
width: 80px;
|
|
479
|
+
height: 80px;
|
|
480
|
+
object-fit: cover;
|
|
481
|
+
border-radius: 0.25rem;
|
|
482
|
+
cursor: pointer;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
452
486
|
|
|
453
|
-
.
|
|
454
|
-
|
|
455
|
-
|
|
487
|
+
.credit {
|
|
488
|
+
margin-top: 1rem;
|
|
489
|
+
font-size: 0.75rem;
|
|
490
|
+
line-height: 1rem;
|
|
491
|
+
text-align: right;
|
|
492
|
+
color: rgb(161 161 170 / 1);
|
|
456
493
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
494
|
+
a {
|
|
495
|
+
color: rgb(15 23 42 / 1) !important;
|
|
496
|
+
}
|
|
460
497
|
}
|
|
461
498
|
|
|
462
|
-
.
|
|
463
|
-
|
|
464
|
-
|
|
499
|
+
.actions {
|
|
500
|
+
display: flex;
|
|
501
|
+
justify-content: center;
|
|
502
|
+
margin-top: 1rem;
|
|
503
|
+
margin-bottom: 1rem;
|
|
465
504
|
}
|
|
466
505
|
|
|
467
|
-
.
|
|
468
|
-
|
|
506
|
+
.review-list-enter-active,
|
|
507
|
+
.review-list-leave-active {
|
|
508
|
+
transition: all 0.3s ease;
|
|
469
509
|
}
|
|
470
510
|
|
|
471
|
-
.
|
|
472
|
-
|
|
511
|
+
.review-list-enter-from {
|
|
512
|
+
opacity: 0;
|
|
513
|
+
transform: translateY(20px);
|
|
473
514
|
}
|
|
474
|
-
}
|
|
475
515
|
|
|
476
|
-
.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
width: 100%;
|
|
481
|
-
margin-right: 8px;
|
|
482
|
-
border-radius: 50%;
|
|
483
|
-
background: #858585;
|
|
484
|
-
display: inline-flex;
|
|
485
|
-
align-items: center;
|
|
486
|
-
justify-content: center;
|
|
487
|
-
color: #fff;
|
|
488
|
-
font-size: 25px;
|
|
489
|
-
font-weight: 500;
|
|
490
|
-
}
|
|
516
|
+
.review-list-leave-to {
|
|
517
|
+
opacity: 0;
|
|
518
|
+
transform: translateY(-20px);
|
|
519
|
+
}
|
|
491
520
|
|
|
492
|
-
.
|
|
493
|
-
|
|
494
|
-
|
|
521
|
+
.review-list-move {
|
|
522
|
+
transition: transform 0.3s ease;
|
|
523
|
+
}
|
|
495
524
|
}
|
|
496
525
|
</style>
|