-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed merge conflicts Signed-off-by: Fanit Kolchina <[email protected]> * Backports final UI changes to 2.2 Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: Fanit Kolchina <[email protected]>
- Loading branch information
1 parent
e300a80
commit 2c3249d
Showing
6 changed files
with
48 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
document.addEventListener('click', function(event) { | ||
const { target } = event; | ||
if (target.matches('.feedback-issue')) { | ||
gtag('event', 'submit_issue_click'); | ||
} | ||
else if (target.matches('.feedback-edit')) { | ||
gtag('event', 'edit_page_click'); | ||
} | ||
else if (target.matches('.feedback-button')) { | ||
sendFeedback(target); | ||
} | ||
else if (target.matches('.copy-button')) { | ||
window.navigator.clipboard.writeText(target.getAttribute('data-text')); | ||
} | ||
}); | ||
|
||
function sendFeedback(button) { | ||
gtag('event', 'feedback_click', { | ||
'helpful': button.value | ||
}); | ||
// show the hidden feedback text | ||
const parent = button.parentElement; | ||
const index = [...parent.children].indexOf(button) + 1; | ||
const sibling = parent.querySelector(`:nth-child(${index}) ~ .text-small.hidden`); | ||
sibling?.classList.remove('hidden'); | ||
|
||
// disable the feedback buttons | ||
button.disabled = true; | ||
button[button.id === 'yes' ? 'nextElementSibling' : 'previousElementSibling']?.setAttribute('disabled', true); | ||
} |