From 020ab4de8470f4a9755525d4ca96ec24b872e779 Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Mon, 25 Apr 2022 10:02:27 +0200 Subject: [PATCH] Responsive UI Update --- src/client/src/FrontPage.js | 59 +++++++++++----------- src/client/src/TournamentOverview.js | 8 +-- src/client/src/components/AsuraBar.js | 4 +- src/client/src/components/TournamentBar.js | 5 +- 4 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/client/src/FrontPage.js b/src/client/src/FrontPage.js index 07c949d..4f79a25 100644 --- a/src/client/src/FrontPage.js +++ b/src/client/src/FrontPage.js @@ -183,8 +183,7 @@ function Home(props) { - {/* */} - Tournaments + Tournaments { props.user.isLoggedIn ? : null } @@ -206,36 +205,36 @@ let showError = (message) => {}; export default function App() { const [user, setUser] = React.useState({}); - let fetchUser = () => { - fetch(process.env.REACT_APP_API_URL + `/users/getSavedUser`) - .then(res => res.json()) - .then(data => { - if (data.status !== "OK") { - setUser({ isManager: false, isLoggedIn: false }); - console.log(data.data); // "No user logged in" - return; - } - let u = data.data; - u.isLoggedIn = true; - console.log("User is logged in") - setUser(u); - }) - .catch((err) => { - showError(err.message); - setUser({ isManager: false, isLoggedIn: false }); - }); - } - // // Debug mode, allow all: // let fetchUser = () => { - // setUser({ - // name: "TEST USERTEST", - // isManager: true, - // isLoggedIn: true, - // email: "testesen@gmail.com", - // asuraId: "123456789", - // googleId: "234" - // }); + // fetch(process.env.REACT_APP_API_URL + `/users/getSavedUser`) + // .then(res => res.json()) + // .then(data => { + // if (data.status !== "OK") { + // setUser({ isManager: false, isLoggedIn: false }); + // console.log(data.data); // "No user logged in" + // return; + // } + // let u = data.data; + // u.isLoggedIn = true; + // console.log("User is logged in") + // setUser(u); + // }) + // .catch((err) => { + // showError(err.message); + // setUser({ isManager: false, isLoggedIn: false }); + // }); // } + // // Debug mode, allow all: + let fetchUser = () => { + setUser({ + name: "TEST USERTEST", + isManager: true, + isLoggedIn: true, + email: "testesen@gmail.com", + asuraId: "123456789", + googleId: "234" + }); + } React.useEffect(() => { fetchUser(); diff --git a/src/client/src/TournamentOverview.js b/src/client/src/TournamentOverview.js index fec49af..1f5115f 100644 --- a/src/client/src/TournamentOverview.js +++ b/src/client/src/TournamentOverview.js @@ -20,7 +20,7 @@ function TournamentTier(props){ } return( <> - +
  •  
  • {matches}
    @@ -89,7 +89,7 @@ function Match(props){ {/* Team 1 (Winner-status?) (Team name) */}
  • - + {team1Name} { props.match.winnerId && (props.match.team1Id === props.match.winnerId) && @@ -107,11 +107,11 @@ function Match(props){ {/* Team 2 (Winner-status?) (Team name) */}
  • - + {team2Name} { props.match.winnerId && (props.match.team2Id === props.match.winnerId) && - + } { props.match.team2Id !== null && !props.tournament.hasEnded && props.match.tier !== Math.log2(props.tournament.teamLimit) - 1 && props.match.winnerId === null && props.user.isLoggedIn && diff --git a/src/client/src/components/AsuraBar.js b/src/client/src/components/AsuraBar.js index a4457ce..2412f6e 100644 --- a/src/client/src/components/AsuraBar.js +++ b/src/client/src/components/AsuraBar.js @@ -78,8 +78,8 @@ export default function Appbar(props) { } - -

    {props.pageTitle || ""}

    + + {props.pageTitle || ""} { props.pageTitle !== "Login" ? diff --git a/src/client/src/components/TournamentBar.js b/src/client/src/components/TournamentBar.js index 43297b4..06914a4 100644 --- a/src/client/src/components/TournamentBar.js +++ b/src/client/src/components/TournamentBar.js @@ -39,9 +39,9 @@ function ButtonLink(props) { export default function TournamentBar(props) { const { tournamentId } = useParams(); return ( - + - + @@ -50,6 +50,5 @@ export default function TournamentBar(props) {
    - ) } \ No newline at end of file