Skip to content

Commit

Permalink
feat: Track course subject and name when adding course (#35)
Browse files Browse the repository at this point in the history
* feat: track adding course

* fix: async track action

* chore(tsconfig): global type comment
  • Loading branch information
jsun969 authored Dec 8, 2024
1 parent 3e89f42 commit 769a2a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/umami": "^2.10.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"eslint": "^9.10.0",
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/components/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ export const SearchForm = () => {
e.preventDefault();
const course = courses?.find((c) => c.id === selectedCourseId);
if (!course) return;
const name = `${course.name.subject} ${course.name.code}`;
await umami.track('Add course', { subject: course.name.subject, name });
enrolledCourses.addCourse({
name: `${course.name.subject} ${course.name.code}`,
name,
id: course.id,
});
setSelectedCourseId(null);
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,

/* Testing */
"types": ["vitest/globals"]
"types": ["vitest/globals", "umami"]
},
"include": ["src", "__tests__"]
}

0 comments on commit 769a2a5

Please sign in to comment.