Skip to content

Commit

Permalink
Jeopardy: Admin: show badges on cat in bag and auction questions bunj…
Browse files Browse the repository at this point in the history
  • Loading branch information
bunjdo committed Mar 4, 2022
1 parent 2e38ea4 commit 3686478
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions client/src/jeopardy/Admin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import {BlockContent, Content, Footer, FooterItem, GameAdmin, Header, TextContent} from "common/Admin";

import {ThemesList, ThemesGrid, QuestionsGrid} from "jeopardy/Themes";
import {getStatusName, getTypeName, getRoundName} from "jeopardy/Common";
import {getStatusName, EventType, getRoundName} from "jeopardy/Common";
import styles from "jeopardy/Admin.scss";
import {FaVolumeMute} from "react-icons/all";

Expand All @@ -32,7 +32,7 @@ const QuestionEvent = ({question}) => {
}
return <BlockContent>
<div>
<div className={styles.type}>{getTypeName(type)}</div>
<div className={styles.type}><EventType type={type}/></div>
{themeDiv}
<div>Value: {value}</div>
</div>
Expand Down
15 changes: 9 additions & 6 deletions client/src/jeopardy/Common.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {FaCat, RiAuctionFill} from "react-icons/all";
import React from "react";

const getStatusName = (status) => {
switch (status) {
Expand Down Expand Up @@ -38,15 +40,16 @@ const getStatusName = (status) => {
}
}

const getTypeName = (status) => {
switch (status) {
const EventType = ({type}) => {
switch (type) {
case 'standard':
return "Standard";
return <div>Standard</div>;
case 'auction':
return "Auction";
return <div>Auction<br/><RiAuctionFill/></div>;
case 'bagcat':
return "Cat in the bag";
return <div>Cat in the bag<br/><FaCat/></div>;
}
return <div/>
}

const getRoundName = (game) => {
Expand All @@ -56,4 +59,4 @@ const getRoundName = (game) => {
return "ROUND " + String(game.round)
}

export {getStatusName, getTypeName, getRoundName}
export {getStatusName, EventType, getRoundName}
7 changes: 6 additions & 1 deletion client/src/jeopardy/Themes.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import styles from "./Themes.scss";
import {FaCat, RiAuctionFill} from "react-icons/all";

const Theme = ({theme, onSelect, active = false}) => (
<div className={css(active && styles.active, styles.theme)}
Expand All @@ -12,7 +13,11 @@ const Theme = ({theme, onSelect, active = false}) => (
const Question = ({question, onSelect}) => (
<div className={css(!question.is_processed && styles.active, styles.question)}
onClick={() => !question.is_processed && onSelect(question.id)}>
<div>{!question.is_processed && question.value}</div>
<div>
{!question.is_processed && onSelect && question.type === "bagcat" && <FaCat/>}
{!question.is_processed && onSelect && question.type === "auction" && <RiAuctionFill/>}
{!question.is_processed && question.value}
</div>
</div>
);

Expand Down
8 changes: 4 additions & 4 deletions client/src/jeopardy/View.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {useEffect} from "react";

import {AudioPlayer, HowlWrapper, ImagePlayer, VideoPlayer, Loading, useGame, useAuth} from "common/Essentials";
import {AdminAuth} from "common/Auth";
import {AudioPlayer, HowlWrapper, ImagePlayer, VideoPlayer, Loading, useGame, useAuth} from "../common/Essentials";
import {AdminAuth} from "../common/Auth";

import {ThemesList, ThemesGrid, QuestionsGrid} from "jeopardy/Themes";
import {getRoundName, getTypeName} from "jeopardy/Common";
import {getRoundName, EventType} from "jeopardy/Common";
import {Content, ExitButton, GameView, TextContent, QRCodeContent} from "common/View";
import styles from "jeopardy/View.scss";
import {useHistory} from "react-router-dom";
Expand Down Expand Up @@ -65,7 +65,7 @@ const useStateContent = (game) => {
case "questions":
return <QuestionsGrid game={game}/>;
case "question_event":
return <TextContent>{getTypeName(game.question.type)}</TextContent>;
return <TextContent><EventType type={game.question.type}/></TextContent>;
case "question": case "answer": case "final_question": case "final_answer":
return <QuestionMessage
game={game} text={question.text} image={question.image} audio={question.audio} video={question.video}
Expand Down

0 comments on commit 3686478

Please sign in to comment.