generated from Arquisoft/wiq_0
-
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
d829bb5
commit 6d3df2b
Showing
9 changed files
with
318 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
|
||
export type props = { | ||
showBlue: boolean, | ||
showGreen: boolean, | ||
showYellow: boolean, | ||
showPink: boolean, | ||
showCyan: boolean, | ||
} | ||
|
||
export const Cheese = (props : props) => { | ||
console.log(props); | ||
return ( | ||
<div className="caja-quesitos "> | ||
|
||
<div className="caja"> | ||
{props.showBlue && <div className="quesito-azul"></div>} | ||
{props.showGreen && <div className="quesito-verde"></div>} | ||
{props.showYellow && <div className="quesito-amarillo"></div>} | ||
{props.showPink && <div className="quesito-rosa"></div>} | ||
{props.showCyan && <div className="quesito-cian"></div>} | ||
|
||
</div> | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useRef } from 'react' | ||
import ReactDice, { ReactDiceRef } from 'react-dice-complete' | ||
|
||
type props = { | ||
setDiceResult: (diceResult: number) => void | ||
} | ||
|
||
|
||
export const Dice = (props:props) => { | ||
|
||
const reactDice = useRef<ReactDiceRef>(null) | ||
|
||
const rollDone = (totalValue: number, values: number[]) => { | ||
|
||
props.setDiceResult(totalValue) | ||
} | ||
|
||
const rollAll = () => { | ||
reactDice.current?.rollAll() | ||
} | ||
|
||
return ( | ||
<ReactDice | ||
numDice={1} | ||
ref={reactDice} | ||
rollDone={rollDone} | ||
defaultRoll={6} | ||
faceColor='#00c896' | ||
dotColor='#f2ecff' | ||
|
||
/> | ||
) | ||
} |
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,61 @@ | ||
import React from 'react'; | ||
import { Cheese } from './Cheese'; | ||
import { useState } from 'react'; | ||
import { Dice } from './Dice'; | ||
|
||
|
||
export const TriviaGame = () => { | ||
|
||
const[showBlue, setShowBlue] = useState(true); | ||
const[showGreen, setShowGreen] = useState(true); | ||
const[showYellow, setShowYellowCheese] = useState(true); | ||
const[showPink, setShowPinkCheese] = useState(true); | ||
const[showCyan, setShowCyanCheese] = useState(true); | ||
|
||
const[diceResult, setDiceResult] = useState(0) | ||
|
||
|
||
const getCategory = (diceResult: number) => { | ||
if (diceResult === 1 || diceResult === 2) { | ||
return 'Science'; | ||
} | ||
if (diceResult === 3 || diceResult === 4) { | ||
return 'History'; | ||
} | ||
if (diceResult === 5 || diceResult === 6) { | ||
return 'Geography'; | ||
} | ||
return 'Science'; | ||
} | ||
|
||
|
||
return ( | ||
<div className='p-5 gap-8 flex justify-start items-start flex-col h-full w-ful'> | ||
<div className='flex justify-start gap-4 items-center'> | ||
<Cheese | ||
showBlue={showBlue} | ||
showGreen={showGreen} | ||
showYellow={showYellow} | ||
showPink={showPink} | ||
showCyan={showCyan} | ||
/> | ||
<button onClick={() => setShowBlue(!showBlue)} className='bg-blue-500 text-white p-2 rounded-md'>Toggle Blue</button> | ||
<button onClick={() => setShowGreen(!showGreen)} className='bg-green-500 text-white p-2 rounded-md'>Toggle Green</button> | ||
<button onClick={() => setShowYellowCheese(!showYellow)} className='bg-yellow-500 text-white p-2 rounded-md'>Toggle Yellow</button> | ||
<button onClick={() => setShowPinkCheese(!showPink)} className='bg-pink-500 text-white p-2 rounded-md'>Toggle Pink</button> | ||
<button onClick={() => setShowCyanCheese(!showCyan)} className='bg-cyan-500 text-white p-2 rounded-md'>Toggle Cyan</button> | ||
</div> | ||
|
||
<Dice setDiceResult={setDiceResult} /> | ||
|
||
|
||
<h1 className='text-text text-2xl'>Category: {getCategory(diceResult)}</h1> | ||
|
||
|
||
|
||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { handleShowDialog, usePlayingState, useStats } from "../../stores/playing-store"; | ||
import { logout, getQuestionsAnswered, getCorrectlyAnsweredQuestions } from "../../services/auth-service"; | ||
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar"; | ||
import { Button } from "../ui/button"; | ||
import React from "react"; | ||
import { useUserStore } from "../../stores/user-store"; | ||
import { Link } from "react-router-dom"; | ||
|
||
export const SimpleNav = () => { | ||
let username : string = useUserStore(state => state.user?.username!); | ||
|
||
const getLinkStyle = ():string => { | ||
return "text-text text-sm font-bold hover:text-primary transition-colors duration-300 ease-in-out" | ||
} | ||
|
||
return ( | ||
<div className="aspect-square h-12 px-5 py-3 flex items-center w-full justify-between border-b "> | ||
<div className="flex items-center gap-5 "> | ||
<Avatar className="w-9 h-9 rounded-full"> | ||
<AvatarImage src="https://pbs.twimg.com/media/Frq7CQ-WwAEnXzh?format=jpg&name=large" /> | ||
<AvatarFallback>CN</AvatarFallback> | ||
</Avatar> | ||
<div className="flex items-center gap-2 text-text text-sm font-thin "> | ||
<h2 className="font-bold">{username}</h2> | ||
|
||
</div> | ||
</div> | ||
<div className="flex gap-5"> | ||
<Link className={getLinkStyle()} to={`/`}>Home</Link> | ||
<Link className={getLinkStyle()} to={`/logout`}>Logout</Link> | ||
</div> | ||
</div> | ||
|
||
); | ||
}; |
Oops, something went wrong.