diff --git a/dist/samples/place-reviews/app/index.ts b/dist/samples/place-reviews/app/index.ts index d6abac96a2..cbcdd3eeae 100644 --- a/dist/samples/place-reviews/app/index.ts +++ b/dist/samples/place-reviews/app/index.ts @@ -33,7 +33,7 @@ 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; @@ -41,12 +41,12 @@ async function initMap() { let authorUri = place.reviews[0].authorAttribution!.uri; // Format the review using HTML. - contentString = - '
' + place.displayName + '
' + - '
' + place.formattedAddress + '
' + - 'Author: ' + authorName + '' + - '
Rating: ' + reviewRating + ' stars
' + - '

Review: ' + reviewText + '

'; + contentString =` +
${place.displayName}
+
${place.formattedAddress}
+ Author: ${authorName} +
Rating: ${reviewRating} stars
+

Review: ${reviewText}

`; } else { contentString = 'No reviews were found for ' + place.displayName + '.'; } diff --git a/dist/samples/place-reviews/docs/index.js b/dist/samples/place-reviews/docs/index.js index 807d4d6b3a..5d82804d85 100644 --- a/dist/samples/place-reviews/docs/index.js +++ b/dist/samples/place-reviews/docs/index.js @@ -33,7 +33,7 @@ async function initMap() { fields: ["displayName", "formattedAddress", "location", "reviews"], }); // 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; @@ -41,24 +41,12 @@ async function initMap() { let authorUri = place.reviews[0].authorAttribution.uri; // Format the review using HTML. - contentString = - '
' + - place.displayName + - "
" + - '
' + - place.formattedAddress + - "
" + - 'Author: ' + - authorName + - "" + - '
Rating: ' + - reviewRating + - " stars
" + - '

Review: ' + - reviewText + - "

"; + contentString = ` +
${place.displayName}
+
${place.formattedAddress}
+ Author: ${authorName} +
Rating: ${reviewRating} stars
+

Review: ${reviewText}

`; } else { contentString = "No reviews were found for " + place.displayName + "."; } diff --git a/dist/samples/place-reviews/iframe/index.html b/dist/samples/place-reviews/iframe/index.html index 0ee8ffa169..3d6904588c 100644 --- a/dist/samples/place-reviews/iframe/index.html +++ b/dist/samples/place-reviews/iframe/index.html @@ -8,7 +8,7 @@ Place Reviews - + diff --git a/dist/samples/place-reviews/jsfiddle/demo.js b/dist/samples/place-reviews/jsfiddle/demo.js index 8d7e48d83a..8a7f1f39fb 100644 --- a/dist/samples/place-reviews/jsfiddle/demo.js +++ b/dist/samples/place-reviews/jsfiddle/demo.js @@ -31,7 +31,7 @@ async function initMap() { fields: ["displayName", "formattedAddress", "location", "reviews"], }); // 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; @@ -39,24 +39,12 @@ async function initMap() { let authorUri = place.reviews[0].authorAttribution.uri; // Format the review using HTML. - contentString = - '
' + - place.displayName + - "
" + - '
' + - place.formattedAddress + - "
" + - 'Author: ' + - authorName + - "" + - '
Rating: ' + - reviewRating + - " stars
" + - '

Review: ' + - reviewText + - "

"; + contentString = ` +
${place.displayName}
+
${place.formattedAddress}
+ Author: ${authorName} +
Rating: ${reviewRating} stars
+

Review: ${reviewText}

`; } else { contentString = "No reviews were found for " + place.displayName + "."; } diff --git a/dist/samples/place-reviews/playground/index.ts b/dist/samples/place-reviews/playground/index.ts index ee8f1973c7..869a3b9d7a 100644 --- a/dist/samples/place-reviews/playground/index.ts +++ b/dist/samples/place-reviews/playground/index.ts @@ -33,7 +33,7 @@ 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; @@ -41,24 +41,12 @@ async function initMap() { let authorUri = place.reviews[0].authorAttribution!.uri; // Format the review using HTML. - contentString = - '
' + - place.displayName + - "
" + - '
' + - place.formattedAddress + - "
" + - 'Author: ' + - authorName + - "" + - '
Rating: ' + - reviewRating + - " stars
" + - '

Review: ' + - reviewText + - "

"; + contentString = ` +
${place.displayName}
+
${place.formattedAddress}
+ Author: ${authorName} +
Rating: ${reviewRating} stars
+

Review: ${reviewText}

`; } else { contentString = "No reviews were found for " + place.displayName + "."; }