From 06aa5d5339df94f3d158dffac86a99f999b80ced Mon Sep 17 00:00:00 2001 From: joneugster Date: Mon, 16 Oct 2023 14:59:55 +0200 Subject: [PATCH] help button explaining Game Rules --- client/src/components/welcome.tsx | 11 ++++++++--- client/src/components/world_tree.css | 10 ++++++++-- client/src/components/world_tree.tsx | 20 +++++++++++++------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/client/src/components/welcome.tsx b/client/src/components/welcome.tsx index c2ead1a..0efd1bb 100644 --- a/client/src/components/welcome.tsx +++ b/client/src/components/welcome.tsx @@ -14,7 +14,8 @@ import { Button } from './button' import { MobileContext } from './infoview/context' import { InventoryPanel } from './inventory' import Markdown from './markdown' -import {PrivacyPolicyPopup} from './privacy_policy' +import { PrivacyPolicyPopup } from './privacy_policy' +import { RulesHelpPopup } from './popup/rules_help' import { WorldTreePanel, downloadFile } from './world_tree' import './welcome.css' @@ -182,8 +183,11 @@ function Welcome() { // impressum pop-up const [impressum, setImpressum] = React.useState(false) + const [rulesHelp, setRulesHelp] = React.useState(false) + function closeImpressum() {setImpressum(false)} function toggleImpressum() {setImpressum(!impressum)} + function closeRulesHelp() {setRulesHelp(false)} const [info, setInfo] = React.useState(false) function closeInfo() {setInfo(false)} @@ -219,7 +223,7 @@ function Welcome() { {(pageNumber == 0 ? : pageNumber == 1 ? - + : )} @@ -227,12 +231,13 @@ function Welcome() { : - + } {impressum ? : null} + {rulesHelp ? : null} {eraseMenu? : null} {uploadMenu? : null} {info ? : null} diff --git a/client/src/components/world_tree.css b/client/src/components/world_tree.css index 7835f56..f923093 100644 --- a/client/src/components/world_tree.css +++ b/client/src/components/world_tree.css @@ -49,7 +49,6 @@ svg .disabled { } .world-selection-menu { - padding: .5em 1em; position: absolute; right: 1em; top: 1em; @@ -75,7 +74,7 @@ svg .disabled { /* width: 100%; */ height: 7em; /* min-width: 16em; */ - padding-bottom: .8em; + padding: .5em 1em 1.3em 1em; margin-left: auto; margin-right: auto; } @@ -109,3 +108,10 @@ svg .disabled { padding: .2em; border-radius: .5em; } + +.world-selection-menu .helpButton { + position: absolute; + right: .5em; + top: .5em; + color: var(--clr-primary); +} diff --git a/client/src/components/world_tree.tsx b/client/src/components/world_tree.tsx index 5e3b922..e588834 100644 --- a/client/src/components/world_tree.tsx +++ b/client/src/components/world_tree.tsx @@ -8,7 +8,7 @@ import { Slider } from '@mui/material' import cytoscape, { LayoutOptions } from 'cytoscape' import klay from 'cytoscape-klay' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faDownload, faUpload, faEraser, faGlobe, faArrowLeft } from '@fortawesome/free-solid-svg-icons' +import { faDownload, faUpload, faEraser, faGlobe, faArrowLeft, faXmark, faCircleQuestion } from '@fortawesome/free-solid-svg-icons' import { GameIdContext } from '../app' import { useAppDispatch } from '../hooks' @@ -195,7 +195,7 @@ export const downloadFile = ({ data, fileName, fileType } : } /** The menu that is shown next to the world selection graph */ -export function WorldSelectionMenu() { +export function WorldSelectionMenu({rulesHelp, setRulesHelp}) { const gameId = React.useContext(GameIdContext) const difficulty = useSelector(selectDifficulty(gameId)) const dispatch = useAppDispatch() @@ -204,12 +204,15 @@ export function WorldSelectionMenu() { return x == 0 ? 'none' : x == 1 ? 'relaxed' : 'regular' } + return