-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08d54c3
commit 0d1b9da
Showing
6 changed files
with
119 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { GameState } from '../types'; | ||
|
||
export default function Chat({ | ||
gameState, | ||
onGuess, | ||
isDrawer, | ||
}: { | ||
gameState: GameState; | ||
onGuess?: (guess: string) => Promise<any>; | ||
isDrawer: boolean; | ||
}) { | ||
const handleGuess = async (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
const formData = new FormData(e.currentTarget); | ||
const guess = formData.get('guess') as string; | ||
await onGuess?.(guess); | ||
}; | ||
|
||
return ( | ||
<div className="bg-muted p-4 rounded-lg flex-1"> | ||
<h3 className="font-medium mb-2">Game Guesses:</h3> | ||
<div className="space-y-2 max-h-[400px] overflow-y-auto"> | ||
{gameState.guesses.map((guess, index) => ( | ||
<div | ||
key={index} | ||
className={`text-sm p-2 rounded ${ | ||
guess.correct ? 'bg-green-100 dark:bg-green-900' : 'bg-background' | ||
}`} | ||
> | ||
<span className="font-medium">{guess.playerName}:</span>{' '} | ||
{guess.guess} | ||
</div> | ||
))} | ||
{!isDrawer && <span>TODO: Put a form here to guess</span>} | ||
</div> | ||
</div> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
apps/web/components/DrawingCanvas/Components/GenerateDrawing.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Loader2 } from 'lucide-react'; | ||
|
||
import { Button } from '../../ui/button'; | ||
import { GameState } from '../types'; | ||
|
||
export function GenerateDrawing({ | ||
handleSubmit, | ||
loading, | ||
gameState, | ||
}: { | ||
handleSubmit: () => void; | ||
loading: boolean; | ||
gameState: GameState; | ||
}) { | ||
return ( | ||
<div className="bg-card p-4 rounded-lg border shadow-sm"> | ||
<div className="prose dark:prose-invert mb-4"> | ||
<h3 className="text-lg font-medium">Generate AI Art</h3> | ||
<p className="text-sm text-muted-foreground"> | ||
Draw anything you like and get an AI-generated painting based on your | ||
drawing. | ||
</p> | ||
</div> | ||
<Button | ||
onClick={handleSubmit} | ||
disabled={loading || gameState.isActive} | ||
className="w-full" | ||
size="lg" | ||
variant="default" | ||
> | ||
{loading ? ( | ||
<> | ||
<Loader2 className="mr-2 h-4 w-4 animate-spin" /> | ||
Generating... | ||
</> | ||
) : ( | ||
'Submit Drawing' | ||
)} | ||
</Button> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters