Skip to content

Commit

Permalink
fix: umami can be undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Rei-x committed Sep 6, 2024
1 parent 47d184b commit 3af521a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 179 deletions.
172 changes: 0 additions & 172 deletions public/script-for-umami.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const queryClient = new QueryClient();

declare global {
interface Window {
umami: UmamiTracker;
umami?: UmamiTracker;
}
}

Expand All @@ -30,7 +30,7 @@ export default function App({ Component, pageProps }: AppProps) {
<Seo />
<Script
defer={true}
src="/script-for-umami.js"
src="https://analytics.solvro.pl/script.js"
data-website-id="ab126a0c-c0ab-401b-bf9d-da652aab69ec"
data-domains="planer.solvro.pl"
/>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/createplan/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ const CreatePlan = ({
const inputRef = useRef<HTMLInputElement>(null);

const changePlanName = (newName: string) => {
void window.umami.track("Change plan name");
void window.umami?.track("Change plan name");
setPlan({
...plan,
name: newName,
});
};

const checkCourse = (id: string) => {
void window.umami.track("Check course");
void window.umami?.track("Check course");
setPlan({
...plan,
courses: plan.courses.map((course) =>
Expand All @@ -283,7 +283,7 @@ const CreatePlan = ({
});
};
const checkGroup = (id: string) => {
void window.umami.track("Change group");
void window.umami?.track("Change group");
setPlan({
...plan,
groups: plan.groups.map((group) =>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/plans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Plans = () => {
id: plans.length + 1,
};

void window.umami.track("Create plan", {
void window.umami?.track("Create plan", {
numberOfPlans: plans.length,
});

Expand Down
2 changes: 1 addition & 1 deletion src/pages/shareplan/[hash].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const SharePlan = ({
courses: plan.courses,
};

void window.umami.track("Create plan", {
void window.umami?.track("Create plan", {
numberOfPlans: plans.length,
});

Expand Down

0 comments on commit 3af521a

Please sign in to comment.