Felix Zieger
commited on
Commit
·
a87b7db
1
Parent(s):
d78d0c6
app update
Browse files
src/components/HighScoreBoard.tsx
CHANGED
@@ -141,7 +141,7 @@ export const HighScoreBoard = ({
|
|
141 |
return (
|
142 |
<div className="space-y-6">
|
143 |
<div className="text-center">
|
144 |
-
<h2 className="text-2xl font-bold mb-2">
|
145 |
<p className="text-gray-600">
|
146 |
Your score: {currentScore} rounds
|
147 |
{currentScore > 0 && ` (${avgWordsPerRound.toFixed(1)} words/round)`}
|
@@ -232,4 +232,4 @@ export const HighScoreBoard = ({
|
|
232 |
</div>
|
233 |
</div>
|
234 |
);
|
235 |
-
};
|
|
|
141 |
return (
|
142 |
<div className="space-y-6">
|
143 |
<div className="text-center">
|
144 |
+
<h2 className="text-2xl font-bold mb-2">Leaderboard</h2>
|
145 |
<p className="text-gray-600">
|
146 |
Your score: {currentScore} rounds
|
147 |
{currentScore > 0 && ` (${avgWordsPerRound.toFixed(1)} words/round)`}
|
|
|
232 |
</div>
|
233 |
</div>
|
234 |
);
|
235 |
+
};
|
src/components/game/GuessDisplay.tsx
CHANGED
@@ -69,7 +69,7 @@ export const GuessDisplay = ({
|
|
69 |
<Button
|
70 |
className="w-full bg-secondary text-lg hover:bg-secondary/90"
|
71 |
>
|
72 |
-
View
|
73 |
</Button>
|
74 |
</DialogTrigger>
|
75 |
<DialogContent className="max-w-md bg-white">
|
@@ -95,4 +95,4 @@ export const GuessDisplay = ({
|
|
95 |
</div>
|
96 |
</motion.div>
|
97 |
);
|
98 |
-
};
|
|
|
69 |
<Button
|
70 |
className="w-full bg-secondary text-lg hover:bg-secondary/90"
|
71 |
>
|
72 |
+
View Leaderboard 🏆
|
73 |
</Button>
|
74 |
</DialogTrigger>
|
75 |
<DialogContent className="max-w-md bg-white">
|
|
|
95 |
</div>
|
96 |
</motion.div>
|
97 |
);
|
98 |
+
};
|
src/components/game/WelcomeScreen.tsx
CHANGED
@@ -1,29 +1,56 @@
|
|
1 |
import { Button } from "@/components/ui/button";
|
2 |
import { motion } from "framer-motion";
|
|
|
|
|
|
|
3 |
|
4 |
interface WelcomeScreenProps {
|
5 |
onStart: () => void;
|
6 |
}
|
7 |
|
8 |
export const WelcomeScreen = ({ onStart }: WelcomeScreenProps) => {
|
|
|
|
|
9 |
return (
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
<h1 className="mb-6 text-4xl font-bold text-gray-900">Think in Sync</h1>
|
16 |
-
<p className="mb-8 text-gray-600">
|
17 |
-
This game is a variation of a classical childrens game.
|
18 |
-
You will be given a secret word. Your goal is to describe this secret word so that an AI can guess it.
|
19 |
-
However, you are only allowed to say one word at the time, taking turns with another AI.
|
20 |
-
</p>
|
21 |
-
<Button
|
22 |
-
onClick={onStart}
|
23 |
-
className="w-full bg-primary text-lg hover:bg-primary/90"
|
24 |
>
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
);
|
29 |
};
|
|
|
1 |
import { Button } from "@/components/ui/button";
|
2 |
import { motion } from "framer-motion";
|
3 |
+
import { useState } from "react";
|
4 |
+
import { HighScoreBoard } from "../HighScoreBoard";
|
5 |
+
import { Dialog, DialogContent } from "@/components/ui/dialog";
|
6 |
|
7 |
interface WelcomeScreenProps {
|
8 |
onStart: () => void;
|
9 |
}
|
10 |
|
11 |
export const WelcomeScreen = ({ onStart }: WelcomeScreenProps) => {
|
12 |
+
const [showHighScores, setShowHighScores] = useState(false);
|
13 |
+
|
14 |
return (
|
15 |
+
<>
|
16 |
+
<motion.div
|
17 |
+
initial={{ opacity: 0 }}
|
18 |
+
animate={{ opacity: 1 }}
|
19 |
+
className="text-center"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
>
|
21 |
+
<h1 className="mb-6 text-4xl font-bold text-gray-900">Think in Sync</h1>
|
22 |
+
<p className="mb-8 text-gray-600">
|
23 |
+
This game is a variation of a classical childrens game.
|
24 |
+
You will be given a secret word. Your goal is to describe this secret word so that an AI can guess it.
|
25 |
+
However, you are only allowed to say one word at the time, taking turns with another AI.
|
26 |
+
</p>
|
27 |
+
<div className="space-y-4">
|
28 |
+
<Button
|
29 |
+
onClick={onStart}
|
30 |
+
className="w-full bg-primary text-lg hover:bg-primary/90"
|
31 |
+
>
|
32 |
+
Start Game ⏎
|
33 |
+
</Button>
|
34 |
+
<Button
|
35 |
+
onClick={() => setShowHighScores(true)}
|
36 |
+
variant="outline"
|
37 |
+
className="w-full text-lg"
|
38 |
+
>
|
39 |
+
View Leaderboard 🏆
|
40 |
+
</Button>
|
41 |
+
</div>
|
42 |
+
</motion.div>
|
43 |
+
|
44 |
+
<Dialog open={showHighScores} onOpenChange={setShowHighScores}>
|
45 |
+
<DialogContent className="max-h-[90vh] overflow-y-auto sm:max-w-[600px]">
|
46 |
+
<HighScoreBoard
|
47 |
+
currentScore={0}
|
48 |
+
avgWordsPerRound={0}
|
49 |
+
onClose={() => setShowHighScores(false)}
|
50 |
+
onPlayAgain={onStart}
|
51 |
+
/>
|
52 |
+
</DialogContent>
|
53 |
+
</Dialog>
|
54 |
+
</>
|
55 |
);
|
56 |
};
|