-
Notifications
You must be signed in to change notification settings - Fork 187
Conversation
Rounded the average for the ratings.
…views # Conflicts: # js/languages/en-US.json
…views # Conflicts: # js/languages/en-US.json # js/views/modals/listingDetail/Listing.js
Nice, will review soon. |
…views # Conflicts: # js/languages/en-US.json # js/views/modals/listingDetail/Listing.js
@morebrownies pull latest, I forgot to commit a missing comma I fixed earlier today. |
Ok I found a few issues for you to revisit when you're back from vacation @jjeffryes
|
Should the expanded review really have an ellipse? In this case it was so long, it looks like the server truncated it, but since the client has no way of knowing this... how would it be able to put the ellipse in that case? (my guess is if you made a review that was too long for the client's non expanded view, but short enough where the server didn't truncate, it would wrongly show the ellipse) |
js/collections/listing/Reviews.js
Outdated
return new BaseModel({ | ||
...attrs, | ||
}, options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simplify this and just do?
return new BaseModel(attrs, options);
The syntax you're using is useful if you're merging something with the attrs, but since you're not, it just makes sense to pass in the full object.
js/collections/listing/Reviews.js
Outdated
|
||
|
||
export default class extends Collection { | ||
constructor(models = [], options = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this constructor really needed? Since you're not doing anything custom, removing it would have the same result as the code in place.
@@ -508,6 +549,11 @@ export default class extends BaseModal { | |||
this.setSelectedPhoto(this.activePhotoIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have two super.render()'s in the render() function of this view.
@@ -508,6 +549,11 @@ export default class extends BaseModal { | |||
this.setSelectedPhoto(this.activePhotoIndex); | |||
this.setActivePhotoThumbnail(this.activePhotoIndex); | |||
this.adjustPriceBySku(); | |||
this.$reviews = this.$('.js-reviews'); | |||
|
|||
// get the ratings data, if any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This horse is probably dead at this point, but I think it's a very poor practice in 99% of the cases to make a fetch in render. You're coupling the rendering of your view to a server request... but I'll put that aside for now.
At the very least, please cancel this call both in remove() and in render() as well. You want to cancel it in render() because you may re-render (e.g. user clicks on the data changed pop-up before the initial call finishes and since you're kicking off a second call, you want to ignore the first one).
@@ -508,6 +549,11 @@ export default class extends BaseModal { | |||
this.setSelectedPhoto(this.activePhotoIndex); | |||
this.setActivePhotoThumbnail(this.activePhotoIndex); | |||
this.adjustPriceBySku(); | |||
this.$reviews = this.$('.js-reviews'); | |||
|
|||
// get the ratings data, if any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there's no error handling here. For example, if a user has no reviews, the endpoint will error with:
{
"success": false,
"reason": "no link named 'index.json' under QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
}
In the case of an error, the first argument to always is the xhr which you end up passing to onRatings() which subsequently bombs with:
I would think instead of always(), you would want to use done() and fail() so you could identify errors (not sure if we want to display them to the user or just not show reviews in that case - the latter may be fine for now, but ideally we handle it in a way that doesn't leave exceptions in the code.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you want to fight this battle... I've logged many server issue today, so I'm over it, but ideally the server would return a 200 and an empty array if there are no reviews instead of:
{
"success": false,
"reason": "no link named 'index.json' under QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
}
As it is now, there's really no way to distinguish between a user having no reviews and there being an error fetching them. We may be able to punt on this if we decide to both silently ignore errors and no reviews.
(but as soon as Wolf asks for a 'This listing has no reviews' placeholder punting is not an option)
styles/components/_misc.scss
Outdated
} | ||
|
||
.orderCompleteEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this could be removed if it's being driven by the 'clickable' state.
js/templates/ratingsStrip.html
Outdated
const selected = ob.curRating >= ob.maxRating - i; | ||
%> | ||
<a class="ion-star ratingIcon js-ratingIcon <%= ob.iconClrClass %> <% if (selected) print('selected') %>"></a> | ||
<!--<a class="ion-star ratingIcon js-ratingIcon <%= ob.iconClrClass %> <% if (selected) print('selected') %>"></a>--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we remove the commented out line?
width: 50%; | ||
padding-bottom: $padSm; | ||
|
||
.emoji { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this could go away since you're globally applying these styles in _misc.scss?
@morebrownies and @rmisio this has been updated, including dead horses. |
@morebrownies there have been several updates, it's possible this doesn't work with old nodes any more. I'll look into it. |
…views # Conflicts: # js/languages/en-US.json
@morebrownies you can retest now, make sure you're using servers updated in the last 30 minutes or so. |
.fail((jqXhr) => { | ||
if (jqXhr.statusText === 'abort') return; | ||
// if there are no ratings, no response is returned. | ||
if (jqXhr.status === 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this if block really needed? I'm don't think there would ever be a case where a 200 triggers the fail handler.
…views # Conflicts: # js/languages/en-US.json
…views # Conflicts: # js/languages/en-US.json # styles/modules/modals/_orderDetail.scss
@morebrownies this is just waiting for a final thumbs up from you to merge. |
Awesome. I'll test it again shortly. |
- Style the no reviews text the same as other no data text. - Push the ratings in the user card all the way to the right. - Apply the same changes to the ratings in list view. - Remove extra space after the star.
@morebrownies this has been updated. Notes: Search Results - the seach data doesn't have the number of reviews yet. When Tyler adds that, they will show up. Zero Ratings - this is fixed, it will show zeroes instead of blanks when there is no value. Mismatch in ratings on the top bar: this is a server bug, I told @cpacia about it a while back, but it doesn't appear to be fixed. I have filed an issue at OpenBazaar/openbazaar-go#566 Italicize and color 2 on no reviews text is fixed. Right align rating is fixed. Formatting in the grid view is fixed. The spacing after the star was reduced, it had an extra space. |
Ok, great. Thanks for the update @jjeffryes Is this a bug I'm seeing here? I noticed on @cpacia store in the grid view it shows the listing has 4 reviews, but when I click into the listing detail modal I do not see any. ob://QmZXGKrRRe5RTDhvzhZfSTe8vYBDGV7HBoNz5FS3U9FnUa/store/piss |
…ng rating data from options.
@morebrownies that isn't a bug, Chris manually deleted his reviews while testing something, so that store has bad data. |
Ok curious why it still shows reviews at the grid view level? Shouldn't it show the same thing between grid view and listing modal? |
@morebrownies he must have put them back, I get correct reviews on the listing now. |
I see them now too, but the grid view and modal still aren't showing the same number of reviews and rating. Is this due to caching or something? |
@morebrownies I don't know, it's a server issue one way or another. You can use the test store I set up, it's up to date and has clean data. ob://QmYfqEPxcFqA1eTDx8vVeNkadLwWbSJpNzvhghDvsSSQG5/store/ |
…views # Conflicts: # js/languages/en-US.json
Ok cool. Other than some server weirdness, I think this is looking pretty good. |
This adds the review display section to the listings details modal.
This PR also adds the average rating and number of ratings icons to the listing cards.
Closes #465