refactor(tracker): better tracker injection

This commit is contained in:
Corentin Thomasset 2022-12-21 21:02:57 +01:00
parent bf88836dbe
commit def60e7248
No known key found for this signature in database
GPG key ID: DBD997E935996158
6 changed files with 67 additions and 37 deletions

View file

@ -9,6 +9,7 @@ import { config } from '@/config';
import MenuIconItem from '@/components/MenuIconItem.vue';
import type { Tool } from '@/tools/tools.types';
import { useToolStore } from '@/tools/tools.store';
import { useTracker } from '@/modules/tracker/tracker.services';
import SearchBar from '../components/SearchBar.vue';
import HeroGradient from '../assets/hero-gradient.svg?component';
import MenuLayout from '../components/MenuLayout.vue';
@ -23,6 +24,8 @@ const commitSha = config.app.lastCommitSha.slice(0, 7);
const makeLabel = (tool: Tool) => () => h(RouterLink, { to: tool.path }, { default: () => tool.name });
const makeIcon = (tool: Tool) => () => h(MenuIconItem, { tool });
const { tracker } = useTracker();
const toolStore = useToolStore();
const menuOptions = computed<MenuGroupOption[]>(() =>
@ -157,7 +160,7 @@ const menuOptions = computed<MenuGroupOption[]>(() =>
target="_blank"
class="support-button"
:bordered="false"
@click="() => $tracker.trackEvent({ eventName: 'Support button clicked' })"
@click="() => tracker.trackEvent({ eventName: 'Support button clicked' })"
>
Buy me a coffee
<n-icon v-if="!styleStore.isSmallScreen" :component="Heart" style="margin-left: 5px" />