From 47d3686b6cb4e9734e1e40db92a22c72b0dfbf30 Mon Sep 17 00:00:00 2001
From: Claas Augner <495429+caugner@users.noreply.github.com>
Date: Thu, 19 Oct 2023 17:47:47 +0200
Subject: [PATCH] chore(telemetry): measure "Add/edit note" on collection items
(#9850)
- Adds measurement.
- Merges Collections-related constants into frozen PLUS_COLLECTIONS object.
---
client/src/plus/collections/collection.tsx | 13 +++++++--
client/src/plus/collections/index.tsx | 11 +++-----
.../collections/new-edit-collection-modal.tsx | 4 +--
client/src/telemetry/constants.ts | 27 ++++++++++---------
.../article-actions/bookmark-menu/index.tsx | 17 +++++-------
5 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/client/src/plus/collections/collection.tsx b/client/src/plus/collections/collection.tsx
index 6c388e47c7e1..d480435e916d 100644
--- a/client/src/plus/collections/collection.tsx
+++ b/client/src/plus/collections/collection.tsx
@@ -22,6 +22,8 @@ import {
FrequentlyViewedCollection,
useFrequentlyViewed,
} from "./frequently-viewed";
+import { useGleanClick } from "../../telemetry/glean-context";
+import { PLUS_COLLECTIONS } from "../../telemetry/constants";
dayjs.extend(relativeTime);
export function CollectionComponent() {
@@ -174,6 +176,7 @@ function ItemComponent({
const [note, setNote] = useState();
const locale = useLocale();
+ const gleanClick = useGleanClick();
useEffect(() => {
const slicedNote = item.notes && charSlice(item.notes, 0, 180);
@@ -255,7 +258,10 @@ function ItemComponent({
@@ -294,7 +300,10 @@ function ItemComponent({
extraClasses="add-note"
icon="edit"
type="action"
- onClickHandler={openBookmarkMenu}
+ onClickHandler={(e) => {
+ gleanClick(PLUS_COLLECTIONS.ACTIONS_NOTE_ADD);
+ return openBookmarkMenu(e);
+ }}
>
Add note
diff --git a/client/src/plus/collections/index.tsx b/client/src/plus/collections/index.tsx
index d348ad2232ec..593089e7b130 100644
--- a/client/src/plus/collections/index.tsx
+++ b/client/src/plus/collections/index.tsx
@@ -21,10 +21,7 @@ import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import Mandala from "../../ui/molecules/mandala";
import { useGleanClick } from "../../telemetry/glean-context";
-import {
- COLLECTIONS_BANNER_NEW_COLLECTION,
- NEW_COLLECTION_MODAL_SUBMIT_COLLECTIONS_PAGE,
-} from "../../telemetry/constants";
+import { PLUS_COLLECTIONS } from "../../telemetry/constants";
import { camelWrap } from "../../utils";
import { useFrequentlyViewed } from "./frequently-viewed";
import { Icon } from "../../ui/atoms/icon";
@@ -89,7 +86,7 @@ function Overview() {