= props => {
+ const {
+ teamLeft,
+ teamTop,
+ } = props;
+
+ const {
+ games,
+ gameState,
+ getGameByTeams,
+ } = useGameLogic();
+
+ const game = useMemo(() => {
+ // console.log({teamLeft, teamTop});
+ // console.log('useMemo game');
+ const theGame = getGameByTeams(teamLeft, teamTop);
+ // console.log({theGame});
+ return theGame;
+ }, [teamLeft, teamTop, games]);
+
+ const pointsLeft = useMemo(() => {
+ if (!game)
+ return 0;
+
+ if (game.team1 == teamLeft.id)
+ return game.goals1;
+ else
+ return game.goals2;
+ }, [teamLeft, game]);
+
+ const pointsTop = useMemo(() => {
+ if (!game)
+ return 0;
+
+ if (game.team1 == teamTop.id)
+ return game.goals1;
+ else
+ return game.goals2;
+ }, [teamLeft, game]);
+
+ if (!game || !gameState)
+ return (- | );
+
+ if (gameState.currentGameNo == game.no) {
+ return (
+ {pointsLeft} : {pointsTop} |
+ );
+ }
+
+ return (
+ {pointsLeft} : {pointsTop} |
+ );
+};
diff --git a/src/pages/voting.tsx b/src/pages/voting.tsx
new file mode 100644
index 0000000..3ccd9f4
--- /dev/null
+++ b/src/pages/voting.tsx
@@ -0,0 +1,9 @@
+import React from 'react';
+
+export const VotingPage: React.FC = () => {
+ return (
+
+ minule nebylo, co? :)
+
+ );
+};
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 11f02fe..b98d12f 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1 +1,10 @@
///
+
+interface ImportMetaEnv {
+ readonly VITE_POCKETBASE_ENDPOINT: string
+ // more env variables...
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv
+}
diff --git a/tsconfig.json b/tsconfig.json
index c81ef9f..8f399b9 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -19,6 +19,6 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
- "include": ["src"],
+ "include": ["src", "scripts"],
"references": [{ "path": "./tsconfig.node.json" }]
}