From 9eb399c1ad12d1c64e3e3779732f84709e7224a1 Mon Sep 17 00:00:00 2001 From: Andrei Palchys Date: Mon, 20 Nov 2023 00:53:25 +0200 Subject: [PATCH] fix: analytics --- client/package.json | 2 +- client/src/components/Timer.tsx | 4 +++- client/src/pages/_app.tsx | 2 ++ client/src/pages/_document.tsx | 21 --------------------- client/src/pages/analytics.tsx | 30 ++++++++++++++++++++++++++++++ package-lock.json | 22 ++++++++++++++++++++-- 6 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 client/src/pages/analytics.tsx diff --git a/client/package.json b/client/package.json index af51cb491b..ef0308689f 100644 --- a/client/package.json +++ b/client/package.json @@ -54,7 +54,7 @@ "@types/cookie": "0.5.4", "@types/jest": "29.5.8", "@types/lodash": "4.14.201", - "@types/node": "^18.18.10", + "@types/node": "20.9.2", "@types/react": "18.2.37", "@types/react-dom": "18.2.7", "@typescript-eslint/eslint-plugin": "6.6.0", diff --git a/client/src/components/Timer.tsx b/client/src/components/Timer.tsx index 05a714b367..c591d3fc42 100644 --- a/client/src/components/Timer.tsx +++ b/client/src/components/Timer.tsx @@ -18,7 +18,9 @@ export function Timer({ onElapsed, seconds }: { onElapsed: () => void; seconds: onElapsed(); } return () => { - timeout && clearTimeout(timeout); + if (timeout) { + clearTimeout(timeout as NodeJS.Timeout); + } }; }, [leftSeconds]); diff --git a/client/src/pages/_app.tsx b/client/src/pages/_app.tsx index 9a0e3bc900..68022d81c2 100644 --- a/client/src/pages/_app.tsx +++ b/client/src/pages/_app.tsx @@ -5,6 +5,7 @@ import Head from 'next/head'; import 'antd/dist/reset.css'; import '../styles/main.css'; import { initializeFeatures } from 'services/features'; +import { Analytics } from './analytics'; class RsSchoolApp extends App { render() { @@ -12,6 +13,7 @@ class RsSchoolApp extends App { initializeFeatures(router.query); return ( <> + App / The Rolling Scopes School diff --git a/client/src/pages/_document.tsx b/client/src/pages/_document.tsx index def900be1d..b16cf73448 100644 --- a/client/src/pages/_document.tsx +++ b/client/src/pages/_document.tsx @@ -1,8 +1,5 @@ import * as React from 'react'; import Document, { Head, Html, Main, NextScript } from 'next/document'; -import Script from 'next/script'; - -const enableAnalytics = process.env.NODE_ENV === 'production'; export default class extends Document { render() { @@ -10,16 +7,6 @@ export default class extends Document { - - {enableAnalytics && + +