Skip to content

Commit

Permalink
feat(client): adding analytics
Browse files Browse the repository at this point in the history
Signed-off-by: Vitaly Kuprin <vitas_s@inbox.lv>
  • Loading branch information
vkuprin committed Dec 5, 2024
1 parent 4f4b004 commit adbb470
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions GomokuClient/packages/gomoku-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@tanstack/react-query": "^5.62.0",
"@tanstack/react-query-devtools": "5.62.0",
"@tanstack/react-router": "^1.85.0",
"@vercel/analytics": "^1.4.1",
"@vitejs/plugin-react": "^4.3.4",
"clsx": "^2.1.1",
"jwt-decode": "^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions GomokuClient/packages/gomoku-core/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as Sentry from "@sentry/react";
import { ErrorBoundary } from "@sentry/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createRouter, RouterProvider } from "@tanstack/react-router";
import { Analytics } from "@vercel/analytics/react";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";

Expand Down Expand Up @@ -77,6 +78,7 @@ createRoot(document.getElementById("root")!).render(
</ClerkProvider>
</I18nProvider>
</QueryClientProvider>
<Analytics />
</ErrorBoundary>
</StrictMode>,
);
2 changes: 0 additions & 2 deletions GomokuClient/packages/gomoku-core/src/pages/HomeGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ export const HomeGame = () => {
<div className="lg:col-span-3">
<GameOptionsButtons
createGameText={t`CREATE A GAME`}
playWithFriendText={t`PLAY WITH A FRIEND`}
playWithAIText={t`PLAY WITH AI`}
onCreateGame={handleCreateGame}
isLoadingCreateGame={isLoadingCreateGame}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ export interface GameOptionsButtonsProps {
boardSize: number,
timeControl?: SwaggerTypes.TimeControlDto,
) => void;
onPlayWithFriendClick?: () => void;
onPlayWithAIClick?: () => void;
createGameText: string;
playWithFriendText: string;
playWithAIText: string;
isLoadingCreateGame: boolean;
isLoadingPlayWithFriend?: boolean;
isLoadingPlayWithAI?: boolean;
isLoadingCreateGame?: boolean;
}

const GameButton = ({
Expand All @@ -39,14 +33,8 @@ const GameButton = ({

export const GameOptionsButtons = ({
onCreateGame,
onPlayWithFriendClick,
onPlayWithAIClick,
createGameText,
playWithFriendText,
playWithAIText,
isLoadingCreateGame = false,
isLoadingPlayWithFriend = false,
isLoadingPlayWithAI = false,
}: GameOptionsButtonsProps) => (
<div className="space-y-4 sm:space-y-6">
<GameCreatorButton
Expand All @@ -55,21 +43,5 @@ export const GameOptionsButtons = ({
>
<GameButton text={createGameText} loading={isLoadingCreateGame} />
</GameCreatorButton>

{BETA_FEATURES && (
<>
<GameButton
onClick={onPlayWithFriendClick}
text={playWithFriendText}
loading={isLoadingPlayWithFriend}
/>

<GameButton
onClick={onPlayWithAIClick}
text={playWithAIText}
loading={isLoadingPlayWithAI}
/>
</>
)}
</div>
);
3 changes: 0 additions & 3 deletions GomokuClient/packages/gomoku-story/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export default ({ mode }: { mode: string }) => {
pathsToAliases: true,
}),
],
define: {
BETA_FEATURES: !isProd,
},
build: {
lib: {
entry: path.resolve(__dirname, "src/index.ts"),
Expand Down
31 changes: 31 additions & 0 deletions GomokuClient/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ __metadata:
"@types/react": "npm:^18.3.12"
"@types/react-dom": "npm:^18.3.1"
"@types/uuid": "npm:^10.0.0"
"@vercel/analytics": "npm:^1.4.1"
"@vitejs/plugin-react": "npm:^4.3.4"
autoprefixer: "npm:^10.4.20"
babel-plugin-macros: "npm:^3.1.0"
Expand Down Expand Up @@ -4397,6 +4398,36 @@ __metadata:
languageName: node
linkType: hard

"@vercel/analytics@npm:^1.4.1":
version: 1.4.1
resolution: "@vercel/analytics@npm:1.4.1"
peerDependencies:
"@remix-run/react": ^2
"@sveltejs/kit": ^1 || ^2
next: ">= 13"
react: ^18 || ^19 || ^19.0.0-rc
svelte: ">= 4"
vue: ^3
vue-router: ^4
peerDependenciesMeta:
"@remix-run/react":
optional: true
"@sveltejs/kit":
optional: true
next:
optional: true
react:
optional: true
svelte:
optional: true
vue:
optional: true
vue-router:
optional: true
checksum: 10c0/e79bb0bdf52c0fcdb78fcaec8c0bb827d926e6cce5e72277d86e1a030bf529a04ae2c0f5d679d910358970fa1dc7b086926305560732c201e0b8b12bfee822f9
languageName: node
linkType: hard

"@vitejs/plugin-react@npm:^4.3.4":
version: 4.3.4
resolution: "@vitejs/plugin-react@npm:4.3.4"
Expand Down

0 comments on commit adbb470

Please sign in to comment.