From d05eede14f17e81a7918295f7262f775e7e60273 Mon Sep 17 00:00:00 2001
From: fbruc03 <65135023+fbruc03@users.noreply.github.com>
Date: Thu, 12 Jan 2023 12:39:21 +0100
Subject: [PATCH 1/4] add new navbar
---
package.json | 6 +-
src/components/Navbar.js | 244 +++++++++++++++++++++++++++++++--------
2 files changed, 200 insertions(+), 50 deletions(-)
diff --git a/package.json b/package.json
index 9ebe8f1..436e093 100644
--- a/package.json
+++ b/package.json
@@ -12,9 +12,9 @@
"@blockly/zoom-to-fit": "^2.0.14",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
- "@fortawesome/fontawesome-svg-core": "^1.2.36",
- "@fortawesome/free-solid-svg-icons": "^5.15.4",
- "@fortawesome/react-fontawesome": "^0.1.19",
+ "@fortawesome/fontawesome-svg-core": "^6.2.1",
+ "@fortawesome/free-solid-svg-icons": "^6.2.1",
+ "@fortawesome/react-fontawesome": "^0.2.0",
"@monaco-editor/react": "^4.3.1",
"@mui/lab": "^5.0.0-alpha.110",
"@mui/material": "^5.10.16",
diff --git a/src/components/Navbar.js b/src/components/Navbar.js
index 9b03d76..f0fc14a 100644
--- a/src/components/Navbar.js
+++ b/src/components/Navbar.js
@@ -37,10 +37,18 @@ import {
faLightbulb,
faCode,
faPuzzlePiece,
+ faUser,
+ faFlag,
+ faMicrochip,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Blockly from "blockly";
import Tooltip from "@mui/material/Tooltip";
+import MenuItem from '@mui/material/MenuItem'
+import Menu from '@mui/material/Menu'
+import { setLanguage } from "../actions/generalActions";
+import { setBoard } from "../actions/boardAction";
+import { Redirect } from "react-router-dom";
const styles = (theme) => ({
drawerWidth: {
@@ -63,6 +71,9 @@ class Navbar extends Component {
this.state = {
open: false,
isTourOpen: false,
+ anchorElLang: null,
+ anchorElBoard: null,
+ anchorElUser: null
};
}
@@ -80,7 +91,6 @@ class Navbar extends Component {
render() {
var isHome = /^\/(\/.*$|$)/g.test(this.props.location.pathname);
- var isTutorial = /^\/tutorial(\/.*$|$)/g.test(this.props.location.pathname);
var isAssessment =
/^\/tutorial\/.{1,}$/g.test(this.props.location.pathname) &&
!this.props.tutorialIsLoading &&
@@ -127,55 +137,189 @@ class Navbar extends Component {
- {isTutorial ? (
-
+ { { this.setState({ anchorElLang: event.target }) }}
+ style={{ margin: "0 30px 0 auto" }}
+ size="large"
+ sx={{ display: { xs: 'none', md: 'block' } }}
+ >
+
+ }
+
+ { { this.setState({ anchorElBoard: event.target }) }}
+ style={{ margin: "0 30px 0 auto" }}
+ size="large"
+ sx={{ display: { xs: 'none', md: 'block' } }}
+ >
+
+ }
+
+ {isHome ? (
+
+ {
+ this.openTour();
+ }}
+ style={{ margin: "0 30px 0 auto" }}
+ size="large">
+
+
+
+ ) : null}
+ {isAssessment ? (
+
+ {
+ this.openTour();
+ }}
+ style={{ margin: "0 30px 0 auto" }}
+ size="large">
+
+
+
+ ) : null}
+ {
+ this.closeTour();
+ }}
+ />
+ {this.props.user ? (
+
+
{ this.setState({ anchorElUser: event.target }) }}
+ style={{ margin: "0 30px 0 auto" }}
+ size="large"
+ sx={{ display: { xs: 'none', md: 'block' } }}
+ >
+
+
+
+
+ )
+ :
+ (
+
+
+
+
+ )
+ }
+
({
@@ -378,8 +526,10 @@ const mapStateToProps = (state) => ({
user: state.auth.user,
tutorial: state.tutorial.tutorials[0],
activeStep: state.tutorial.activeStep,
+ language: state.general.language,
+ selectedBoard: state.board.board
});
-export default connect(mapStateToProps, { logout })(
+export default connect(mapStateToProps, { logout, setLanguage, setBoard })(
withStyles(styles, { withTheme: true })(withRouter(Navbar))
);
From 2c1594227ebf4d5f0b96118d0dd388ffa66fa816 Mon Sep 17 00:00:00 2001
From: fbruc03 <65135023+fbruc03@users.noreply.github.com>
Date: Thu, 12 Jan 2023 22:30:41 +0100
Subject: [PATCH 2/4] style navbar items
---
src/components/Navbar.js | 231 ++++++++++++++++++++++++---------------
1 file changed, 144 insertions(+), 87 deletions(-)
diff --git a/src/components/Navbar.js b/src/components/Navbar.js
index f0fc14a..50d626f 100644
--- a/src/components/Navbar.js
+++ b/src/components/Navbar.js
@@ -38,8 +38,10 @@ import {
faCode,
faPuzzlePiece,
faUser,
- faFlag,
faMicrochip,
+ faEarthEurope,
+ faEarthAmericas,
+ faCaretDown
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Blockly from "blockly";
@@ -48,7 +50,6 @@ import MenuItem from '@mui/material/MenuItem'
import Menu from '@mui/material/Menu'
import { setLanguage } from "../actions/generalActions";
import { setBoard } from "../actions/boardAction";
-import { Redirect } from "react-router-dom";
const styles = (theme) => ({
drawerWidth: {
@@ -138,92 +139,150 @@ class Navbar extends Component {
- {
{ this.setState({ anchorElLang: event.target }) }}
- style={{ margin: "0 30px 0 auto" }}
- size="large"
- sx={{ display: { xs: 'none', md: 'block' } }}
- >
-
- }
-