Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding menu button to the results page and goBack buttons follow conventions #290

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions webapp/src/pages/Results.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
import React from "react";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Button, Flex, Box, Heading, Center } from "@chakra-ui/react";
import { useNavigate, useLocation } from "react-router-dom";
import UserStatistics from "../components/statistics/UserStatistics";
import LateralMenu from '../components/menu/LateralMenu';
import MenuButton from '../components/menu/MenuButton';

export default function Results() {
const { t } = useTranslation();
const { t, i18n } = useTranslation();
const location = useLocation();
const navigate = useNavigate();
const correctAnswers = location.state?.correctAnswers || 0;
const [isMenuOpen, setIsMenuOpen] = useState(false);

const changeLanguage = async (selectedLanguage) => {
await i18n.changeLanguage(selectedLanguage);
};

return (
<Center display="flex" flexDirection="column" w="100wh" h="100vh" justifyContent="center" alignItems="center" bgImage={'/background.svg'}>
<MenuButton onClick={() => setIsMenuOpen(true)} />
<LateralMenu isOpen={isMenuOpen} onClose={() => setIsMenuOpen(false)} changeLanguage={changeLanguage} isDashboard={false}/>

<Heading as="h2">{t("common.results")}</Heading>
<Box bg="white" p={4} borderRadius="md" boxShadow="md" mt={4} mb={4} w="fit-content" shadow="2xl" rounded="1rem">
<Heading textAlign={"center"} as="h3" color="green.400" fontSize="xl">{`Correct answers: ${correctAnswers}`}</Heading>
Expand Down