Skip to content

Commit

Permalink
fix: Update index.ts with reviewer comments
Browse files Browse the repository at this point in the history
Updated the TS file with Tom's suggestions.
  • Loading branch information
willum070 authored Jul 25, 2024
1 parent 05d6166 commit 788d4c9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions samples/place-reviews/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ async function initMap() {
});

// If there are any reviews display the first one.
if (place.reviews) {
if (place.reviews && place.reviews.length > 0) {
// Get info for the first review.
let reviewRating = place.reviews[0].rating;
let reviewText = place.reviews[0].text;
let authorName = place.reviews[0].authorAttribution!.displayName;
let authorUri = place.reviews[0].authorAttribution!.uri;

// Format the review using HTML.
contentString =
'<div id="title"><b>' + place.displayName + '</b></div>' +
'<div id="address">' + place.formattedAddress + '</div>' +
'<a href="' + authorUri + '" target="_blank">Author: ' + authorName + '</a>' +
'<div id="rating">Rating: ' + reviewRating + ' stars</div>' +
'<div id="rating"><p>Review: ' + reviewText + '</p></div>';
contentString =`
<div id="title"><b>${place.displayName}</b></div>
<div id="address">${place.formattedAddress}</div>
<a href="${authorUri}" target="_blank">Author: ${authorName}</a>
<div id="rating">Rating: ${reviewRating} stars</div>
<div id="rating"><p>Review: ${reviewText}</p></div>`;
} else {
contentString = 'No reviews were found for ' + place.displayName + '.';
}
Expand Down

0 comments on commit 788d4c9

Please sign in to comment.