diff --git a/src/App.test.tsx b/src/App.test.tsx
index a64c386..2710b73 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,7 +1,14 @@
import { render, screen } from '@testing-library/react'
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+import { useAnalytics } from 'use-analytics'
import App from './App'
+// Mock the analytics module
+vi.mock('use-analytics', () => ({
+ useAnalytics: () => ({ plugins: { enable: vi.fn(), disable: vi.fn() }, page: vi.fn() }),
+}))
+
describe('App component', () => {
test('renders MainPage without crashing', async () => {
render()
diff --git a/src/App.tsx b/src/App.tsx
index c1aba46..047dccd 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,8 +1,8 @@
import React from 'react'
import { createBrowserRouter, RouterProvider } from 'react-router-dom'
-import { Backdrop, CircularProgress } from '@mui/material'
-import { ErrorPage } from 'components/pages'
+import ErrorPage from 'components/pages/ErrorPage/index.js'
+import RootLayout from 'components/templates/RouteTracker/index.js'
const MainPage = React.lazy(() => import('components/pages/MainPage'))
const ProjectsPage = React.lazy(() => import('components/pages/ProjectsPage'))
@@ -18,36 +18,42 @@ const Loading = () => (
const router = createBrowserRouter([
{
path: '/',
- element: (
- }>
-
-
- ),
+ element: ,
errorElement: ,
- },
- {
- path: '/projects',
- element: (
- }>
-
-
- ),
- },
- {
- path: '/curriculum',
- element: (
- }>
-
-
- ),
- },
- {
- path: '/contacts',
- element: (
- }>
-
-
- ),
+ children: [
+ {
+ index: true,
+ element: (
+ }>
+
+
+ ),
+ },
+ {
+ path: 'projects',
+ element: (
+ }>
+
+
+ ),
+ },
+ {
+ path: 'curriculum',
+ element: (
+ }>
+
+
+ ),
+ },
+ {
+ path: 'contacts',
+ element: (
+ }>
+
+
+ ),
+ },
+ ],
},
])
diff --git a/src/components/molecules/Toolbar/index.tsx b/src/components/molecules/Toolbar/index.tsx
index 13be7a6..261ec60 100644
--- a/src/components/molecules/Toolbar/index.tsx
+++ b/src/components/molecules/Toolbar/index.tsx
@@ -100,7 +100,7 @@ const CustomToolbar: React.FC = ({ drawerWidth = 240, window
sx={{
display: 'flex',
// maxWidth: '100%',
- // [theme.breakpoints.up('md')]: { width: '80em', mx: 'auto' },
+ // [theme.breakpoints.up('md')]: { width: theme => theme.breakpoints.values.lg, mx: 'auto' },
}}>
{
+ const location = useLocation()
+ const analytics = useAnalytics()
+
+ useEffect(() => {
+ analytics.page()
+ }, [analytics, location])
+
+ return
+}
+
+export default RouteTracker
diff --git a/src/components/templates/index.ts b/src/components/templates/index.ts
index c6f64a4..eba39ba 100644
--- a/src/components/templates/index.ts
+++ b/src/components/templates/index.ts
@@ -1 +1,2 @@
-export { default as Page } from './Page'
+export { default as Page } from './Page/index.js'
+export { default as RouteTracker } from './RouteTracker/index.js'
diff --git a/src/main.tsx b/src/main.tsx
index e40bf2d..fcf4f83 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,19 +1,22 @@
/* istanbul ignore file */
import React from 'react'
import ReactDOM from 'react-dom/client'
-import { ThemeProvider } from '@mui/material/styles'
-import { CssBaseline } from '@mui/material'
+import { AnalyticsProvider } from 'use-analytics'
+import { ThemeProvider, CssBaseline } from '@mui/material'
-import App from './App.tsx'
-import theme from 'style/theme.ts'
+import analytics from 'components/utils/analytics/index.js'
+import theme from 'style/theme.js'
+import App from './App.js'
import './index.css'
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
-
-
-
-
+
+
+
+
+
+
)