diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c215380e..d4ac7f6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,9 @@ jobs: frontend-test: name: 🧪 frontend-ci runs-on: ubuntu-latest - + # defaults: + # run: + # working-directory: frontend steps: - name: Check out Git repository uses: actions/checkout@v3 @@ -22,6 +24,8 @@ jobs: with: node-version: 16 cache: "yarn" + cache-dependency-path: './frontend' + - name: Install Node.js dependencies run: yarn install --frozen-lockfile - name: Linting check diff --git a/frontend/package.json b/frontend/package.json index 6c51be1c..56551ba1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,8 @@ "@testing-library/jest-dom": "5.16.4", "@testing-library/react": "13.3.0", "@testing-library/user-event": "13.5.0", + "@vercel/analytics": "^1.2.2", + "@vercel/speed-insights": "^1.0.10", "@vitejs/plugin-react": "^4.0.0", "axios": "0.27.2", "dotenv": "^16.0.3", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 0d9c4149..6392501b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -15,6 +15,8 @@ import ReactGA from "react-ga4"; import Brightness4Icon from "@mui/icons-material/Brightness4"; import Brightness7Icon from "@mui/icons-material/Brightness7"; import CssBaseline from "@mui/material/CssBaseline"; +import { Analytics } from "@vercel/analytics/react"; +import { SpeedInsights } from "@vercel/speed-insights/react"; import { PlotSpectra } from "./components/PlotSpectra"; import { palette } from "./constants"; import logo from "./radis.png"; @@ -158,7 +160,7 @@ function App(): React.ReactElement { ); } -// export default App; + export default function ToggleColorMode() { const [mode, setMode] = React.useState<"light" | "dark">("light"); @@ -184,6 +186,10 @@ export default function ToggleColorMode() { return ( + {/*for analytics*/} + + {/*for speed insights*/} + diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index c07a1bf2..079cfcde 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -7,6 +7,9 @@ "esnext", "WebWorker" ], + "paths": { + "react": [ "./node_modules/@types/react" ] + }, "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, diff --git a/frontend/yarn.lock b/frontend/yarn.lock index b574c82e..aac1ec0d 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2926,6 +2926,18 @@ "@typescript-eslint/types" "5.30.7" eslint-visitor-keys "^3.3.0" +"@vercel/analytics@^1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-1.2.2.tgz#715d8f203a170c06ba36b363e03b048c03060d5d" + integrity sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A== + dependencies: + server-only "^0.0.1" + +"@vercel/speed-insights@^1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@vercel/speed-insights/-/speed-insights-1.0.10.tgz#2e2e6a16beff72cbb58fd59ea8deb18f7338a014" + integrity sha512-4uzdKB0RW6Ff2FkzshzjZ+RlJfLPxgm/00i0XXgxfMPhwnnsk92YgtqsxT9OcPLdJUyVU1DqFlSWWjIQMPkh0g== + "@vitejs/plugin-react@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-4.0.0.tgz#46d1c37c507447d10467be1c111595174555ef28" @@ -10543,6 +10555,11 @@ serve-static@1.15.0: parseurl "~1.3.3" send "0.18.0" +server-only@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/server-only/-/server-only-0.0.1.tgz#0f366bb6afb618c37c9255a314535dc412cd1c9e" + integrity sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA== + setprototypeof@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.0.tgz#d0bd85536887b6fe7c0d818cb962d9d91c54e656"