Skip to content

Commit 20e48c4

Browse files
authored
Add flag URL support to summary tabs
1 parent c67bf67 commit 20e48c4

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

samples/ai-powered-summaries/index.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const summaryContent = document.getElementById(
1818
'summary-content'
1919
) as HTMLDivElement;
2020
const aiDisclosure = document.getElementById('ai-disclosure') as HTMLDivElement;
21+
const flagContentLink = document.getElementById('flag-content-link') as HTMLAnchorElement;
2122

2223
let innerMap;
2324
let marker: google.maps.marker.AdvancedMarkerElement;
@@ -100,7 +101,8 @@ function updateSummaryPanel(place: google.maps.places.Place) {
100101
const createTab = (
101102
label: string,
102103
content: string | Node,
103-
disclosure: string
104+
disclosure: string,
105+
flagUrl: string
104106
) => {
105107
const btn = document.createElement('button');
106108
btn.className = 'tab-button';
@@ -126,6 +128,12 @@ function updateSummaryPanel(place: google.maps.places.Place) {
126128

127129
// Set the disclosure text.
128130
aiDisclosure.textContent = disclosure || 'AI-generated content.';
131+
132+
// Add the content flag URI.
133+
if (flagUrl) {
134+
flagContentLink.href = flagUrl;
135+
flagContentLink.textContent = "Report an issue"
136+
}
129137
};
130138

131139
tabContainer.appendChild(btn);
@@ -145,7 +153,9 @@ function updateSummaryPanel(place: google.maps.places.Place) {
145153
//@ts-ignore
146154
place.generativeSummary.overview,
147155
//@ts-ignore
148-
place.generativeSummary.disclosureText
156+
place.generativeSummary.disclosureText,
157+
//@ts-ignore
158+
place.generativeSummary.flagContentURI
149159
);
150160
}
151161

@@ -157,7 +167,9 @@ function updateSummaryPanel(place: google.maps.places.Place) {
157167
//@ts-ignore
158168
place.reviewSummary.text,
159169
//@ts-ignore
160-
place.reviewSummary.disclosureText
170+
place.reviewSummary.disclosureText,
171+
//@ts-ignore
172+
place.reviewSummary.flagContentURI
161173
);
162174
}
163175

@@ -169,7 +181,9 @@ function updateSummaryPanel(place: google.maps.places.Place) {
169181
//@ts-ignore
170182
place.neighborhoodSummary.overview.content,
171183
//@ts-ignore
172-
place.neighborhoodSummary.disclosureText
184+
place.neighborhoodSummary.disclosureText,
185+
//@ts-ignore
186+
place.neighborhoodSummary.flagContentURI
173187
);
174188
}
175189

@@ -223,7 +237,8 @@ function updateSummaryPanel(place: google.maps.places.Place) {
223237
createTab(
224238
'EV Amenities',
225239
evContainer, // Passing a Node instead of string
226-
evSummary.disclosureText
240+
evSummary.disclosureText,
241+
evSummary.flagContentURI
227242
);
228243
}
229244
}

0 commit comments

Comments
 (0)