Skip to content

feat: Migrates the Place Photos sample.#1064

Open
willum070 wants to merge 5 commits intomainfrom
migrate-place-photos
Open

feat: Migrates the Place Photos sample.#1064
willum070 wants to merge 5 commits intomainfrom
migrate-place-photos

Conversation

@willum070
Copy link
Collaborator

This PR does the following things:

  • Migrates the place-photos sample to js-api-samples.
  • Makes the sample accessible (wraps thumbnails in button elements, other a11y enhancements).
  • Improves visual appearance and UI behavior.

@snippet-bot
Copy link

snippet-bot bot commented Jan 28, 2026

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@willum070 willum070 requested a review from noelle-jung January 29, 2026 21:42
Comment on lines +24 to +27
let heading = document.getElementById('heading') as HTMLElement;
let summary = document.getElementById('summary') as HTMLElement;
let gallery = document.getElementById('gallery') as HTMLElement;
let expandedImageDiv = document.getElementById(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be chagned to const

Suggested change
let heading = document.getElementById('heading') as HTMLElement;
let summary = document.getElementById('summary') as HTMLElement;
let gallery = document.getElementById('gallery') as HTMLElement;
let expandedImageDiv = document.getElementById(
const heading = document.getElementById('heading') as HTMLElement;
const summary = document.getElementById('summary') as HTMLElement;
const gallery = document.getElementById('gallery') as HTMLElement;
const expandedImageDiv = document.getElementById(

let expandedImageDiv = document.getElementById(
'expanded-image'
) as HTMLElement;
let attributionLabel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed and declared inside each block that needs an attributionLabel

expandedImage.alt = altText;
expandedImageDiv.innerHTML = '';
expandedImageDiv.appendChild(expandedImage);
attributionLabel = createAttribution(photo.authorAttributions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attributionLabel = createAttribution(photo.authorAttributions);
const attributionLabel = createAttribution(photo.authorAttributions);

img.alt = 'Photo of ' + place.displayName;
img.src = place.photos![0].getURI();
expandedImageDiv.appendChild(img);
attributionLabel = createAttribution(place.photos![0].authorAttributions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attributionLabel = createAttribution(place.photos![0].authorAttributions);
const attributionLabel = createAttribution(place.photos![0].authorAttributions);

}

// Helper function to create attribution DIV.
function createAttribution(attribution) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a type for attribution? Also suggest renaming the parameter to attributions since multiple are passed.

Suggested change
function createAttribution(attribution) {
function createAttribution(attributions: google.maps.places.AuthorAttribution[]) {

Comment on lines +79 to +81
if (attribution && attribution[0]) {
attributionLabel.textContent = attribution[0].displayName;
attributionLabel.href = attribution[0].uri;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (attribution && attribution[0]) {
attributionLabel.textContent = attribution[0].displayName;
attributionLabel.href = attribution[0].uri;
if (attributions && attributions[0]) {
attributionLabel.textContent = attributions[0].displayName;
attributionLabel.href = attributions[0].uri;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants