diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00ebeaf7b8..b7b9db32a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,9 @@ jobs: - name: ๐Ÿงช Test project run: pnpm test tests/unit + - name: ๐Ÿ”Ž Glean Lint + run: pnpm lint:glean + - name: ๐Ÿ“ Lint run: pnpm lint # Mozilla.Social changes have errors with this check, disabling for now. diff --git a/components/nav/NavFooter.vue b/components/nav/NavFooter.vue index b785274837..5447140600 100644 --- a/components/nav/NavFooter.vue +++ b/components/nav/NavFooter.vue @@ -34,7 +34,7 @@ function toggleDark() {
- + About · diff --git a/components/settings/SettingsAbout.vue b/components/settings/SettingsAbout.vue new file mode 100644 index 0000000000..c26f0b11cd --- /dev/null +++ b/components/settings/SettingsAbout.vue @@ -0,0 +1,84 @@ + + + diff --git a/locales/en.json b/locales/en.json index 610982e844..91a891886c 100644 --- a/locales/en.json +++ b/locales/en.json @@ -6,6 +6,19 @@ "locale_changing": "Changing language, please wait", "route_loaded": "Page {0} loaded" }, + "about": { + "administered_by": "Administered by", + "contact": "Contact: {0}", + "footer_about": "About", + "footer_content_policy": "Content Policies", + "footer_copyright_policies": "Copyright Policies", + "footer_privacy_notice": "Privacy Notice", + "footer_profiles_directory": "Profiles Directory", + "footer_terms_of_service": "Terms of Service", + "footer_view_code": "View Mastodon Source Code {0}", + "server_rules": "Server/Community Rules", + "subtitle": "Decentralized social media powered by Mastodon" + }, "account": { "avatar_description": "{0}'s avatar", "blocked_by": "You're blocked by this user.", diff --git a/modules/glean/runtime/glean-plugin.client.ts b/modules/glean/runtime/glean-plugin.client.ts index 96f8e9fe06..55cb9bad94 100644 --- a/modules/glean/runtime/glean-plugin.client.ts +++ b/modules/glean/runtime/glean-plugin.client.ts @@ -33,24 +33,41 @@ export default defineNuxtPlugin((nuxtApp) => { } } + function recordEngagement(element: Element) { + if (!element) + return + + if (!element.hasAttribute('data-glean')) + return + + const data = element.getAttribute('data-glean') || '' + const value = element.getAttribute('data-glean-value') || '' + engagement.record({ ui_identifier: data, engagement_value: value, ...engagementDetails[data] }) + } + function handleButtonClick(ev: MouseEvent) { const eventTarget = ev?.target as Element const closestButton = eventTarget.closest('button') + if (!closestButton) + return + if (closestButton?.hasAttribute('href')) linkClick.record({ target_url: closestButton.getAttribute('href') || '' }) - const data = eventTarget?.getAttribute('data-glean') || '' - const value = eventTarget?.getAttribute('data-glean-value') || '' - if (eventTarget.hasAttribute('data-glean')) - engagement.record({ ui_identifier: data, engagement_value: value, ...engagementDetails[data] }) + recordEngagement(eventTarget) } function handleLinkClick(ev: MouseEvent) { const eventTarget = ev?.target as Element const closestLink = eventTarget.closest('a') - if (closestLink) - linkClick.record({ target_url: closestLink.getAttribute('href') || '' }) + + if (!closestLink) + return + + linkClick.record({ target_url: closestLink.getAttribute('href') || '' }) + + recordEngagement(closestLink) } window.addEventListener('click', eventListener) diff --git a/package.json b/package.json index 44bb881d59..02b3af2edf 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ } }, "simple-git-hooks": { - "pre-commit": "pnpm lint-staged" + "pre-commit": "pnpm lint-staged && pnpm lint:glean" }, "lint-staged": { "*": "eslint --fix" diff --git a/pages/about.vue b/pages/about.vue new file mode 100644 index 0000000000..7ea8282c74 --- /dev/null +++ b/pages/about.vue @@ -0,0 +1,19 @@ + + + diff --git a/pages/settings.vue b/pages/settings.vue index 1e7ccb59f6..b050619e01 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -76,7 +76,7 @@ const devMode = useAppConfig().env === ('dev' || 'canary' || 'preview') command icon="i-ri:information-line" :text="isHydrated ? $t('settings.about.label') : ''" - to="https://mozilla.social/about" + to="/about" />