diff --git a/frontend/public/404.html b/frontend/public/404.html index b9dd400fa..198ead43b 100644 --- a/frontend/public/404.html +++ b/frontend/public/404.html @@ -40,7 +40,7 @@ counter--; setTimeout(updateCounter, 1150); } else { - window.location.href = '/Transcendence/'; + window.location.href = '/'; } } diff --git a/frontend/src/App.js b/frontend/src/App.js index 9d6420651..f17fe8dd1 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -3,7 +3,6 @@ import { I18nextProvider, useTranslation } from "react-i18next"; import Translation from "./components/Translation"; import Home from "./pages/Home"; import Chat from "./pages/Chat"; -import Games from "./pages/Games/Games"; import About from "./pages/About"; import NotFound from "./components/404"; import Sidebar from "./components/hamburger_menu/Hamburger"; @@ -47,7 +46,6 @@ const PageWrapper = ({ children, image, showSidebar = true, redirectUri }) => { function App() { const { i18n } = useTranslation(); const basename = ""; - // process.env.NODE_ENV === "production" ? "/Transcendence" : ""; let REDIRECT_URI; if (process.env.NODE_ENV === "development") { @@ -107,14 +105,6 @@ function App() { } /> - - - - } - /> } /> - diff --git a/frontend/src/components/game/HowToPlay.js b/frontend/src/components/game/HowToPlay.js index 79d4f7e5a..b6a4b8514 100644 --- a/frontend/src/components/game/HowToPlay.js +++ b/frontend/src/components/game/HowToPlay.js @@ -50,6 +50,18 @@ const HowToPlay = ({ isOpen, setIsOpen, background, backgroundimage }) => { {t("If the blackhole swallows your planets, you lose.")}

+
+

{t("Tournament")}

+

+ {t("Play a Tournament against other players.")} +
+ {t("This mode is played in multiple rounds.")} +
+ {t("You need to provide the nicknames for the participants")} +
+ {t("Choose if they are real players or an AI.")} +

+

{t("Keybinds")}

diff --git a/frontend/src/components/hamburger_menu/HamburgerMenu.js b/frontend/src/components/hamburger_menu/HamburgerMenu.js index a5d21a3d6..061a4003b 100644 --- a/frontend/src/components/hamburger_menu/HamburgerMenu.js +++ b/frontend/src/components/hamburger_menu/HamburgerMenu.js @@ -34,7 +34,7 @@ const HamburgerMenu = ({ } text={t("Play or Watch Games")} - to="/games" + to="/choosepongmode" /> } diff --git a/frontend/src/components/sidebar/Sidebar_Monitor.js b/frontend/src/components/sidebar/Sidebar_Monitor.js index d21dc4b40..41d9c9f52 100644 --- a/frontend/src/components/sidebar/Sidebar_Monitor.js +++ b/frontend/src/components/sidebar/Sidebar_Monitor.js @@ -27,7 +27,7 @@ const SidebarContent = ({ t, changeLanguage, redirectUri }) => { } text={t("Play or Watch Games")} - to="/games" + to="/choosepongmode" /> } diff --git a/frontend/src/locales/de/translation.json b/frontend/src/locales/de/translation.json index 7717efe7f..5d7f16b7c 100644 --- a/frontend/src/locales/de/translation.json +++ b/frontend/src/locales/de/translation.json @@ -12,6 +12,10 @@ "The Project": "Das Projekt", "16 Major & 11 Minor modules": "16 Haupt- und 11 Nebenmodule", "Web": "Web", + "Play a Tournament against other players.": "Spielen Sie ein Turnier gegen andere Spieler.", + "This mode is played in multiple rounds.": "Dieser Modus wird in mehreren Runden gespielt.", + "You need to provide the nicknames for the participants": "Sie müssen die Nicknamen der Teilnehmer angeben.", + "Choose if they are real players or an AI.": "Wählen Sie aus, ob es sich um echte Spieler oder eine KI handelt.", "Use a framework as backend": "Verwenden Sie ein Framework als Backend", "Use a front-end framework or toolkit": "Verwenden Sie ein Front-End-Framework oder -Toolkit", "Use a database for the backend": "Verwenden Sie eine Datenbank für das Backend", diff --git a/frontend/src/locales/en/translation.json b/frontend/src/locales/en/translation.json index c8497ac6e..78ac8915d 100644 --- a/frontend/src/locales/en/translation.json +++ b/frontend/src/locales/en/translation.json @@ -1,6 +1,6 @@ { "Delete Account": "Delete Account", - "Are you sure you want to delete your account?" : "Are you sure you want to delete your account?", + "Are you sure you want to delete your account?": "Are you sure you want to delete your account?", "Submit": "Submit", "New Password ": "New Password ", "Confirm New Password ": "Confirm New Password ", @@ -8,9 +8,13 @@ "Settings": "Settings", "Passwords do not match": "Passwords do not match", "Tournament": "Tournament", - + "Private": "Private", "Expanding browser compatibility": "Expanding browser compatibility", + "Play a Tournament against other players.": "Play a Tournament against other players.", + "This mode is played in multiple rounds.": "This mode is played in multiple rounds.", + "You need to provide the nicknames for the participants": "You need to provide the nicknames for the participants", + "Choose if they are real players or an AI.": "Choose if they are real players or an AI.", "The Project": "The Project", "16 Major & 11 Minor modules": "16 Major & 11 Minor modules", @@ -69,10 +73,6 @@ "Can you navigate thru the asteroid fields?": "Can you navigate thru the asteroid fields?", "Contributors": "Contributors", - - - - "How to play": "How to play", "The classic game of Pong.": "The classic game of Pong.", "Hit the ball back and forth": "Hit the ball back and forth", diff --git a/frontend/src/locales/fr/translation.json b/frontend/src/locales/fr/translation.json index d7c7bf699..6453cbf4c 100644 --- a/frontend/src/locales/fr/translation.json +++ b/frontend/src/locales/fr/translation.json @@ -12,6 +12,10 @@ "The Project": "Le Projet", "16 Major & 11 Minor modules": "16 Modules Majeurs & 11 Modules Mineurs", "Web": "Web", + "Play a Tournament against other players.": "Jouez un tournoi contre d'autres joueurs.", + "This mode is played in multiple rounds.": "Ce mode se joue en plusieurs rounds.", + "You need to provide the nicknames for the participants": "Vous devez fournir les surnoms des participants.", + "Choose if they are real players or an AI.": "Choisissez s'ils sont de vrais joueurs ou une IA.", "Use a framework as backend": "Utiliser un framework en tant que backend", "Use a front-end framework or toolkit": "Utiliser un framework ou une boîte à outils en front-end", "Use a database for the backend": "Utiliser une base de données pour le backend", diff --git a/frontend/src/locales/hu/translation.json b/frontend/src/locales/hu/translation.json index b2a3466ef..f71a749db 100644 --- a/frontend/src/locales/hu/translation.json +++ b/frontend/src/locales/hu/translation.json @@ -12,6 +12,10 @@ "The Project": "A Projekt", "16 Major & 11 Minor modules": "16 fő és 11 kisebb modul", "Web": "Web", + "Play a Tournament against other players.": "Játsszon egy versenyt más játékosok ellen.", + "This mode is played in multiple rounds.": "Ez a mód több fordulóban játszható.", + "You need to provide the nicknames for the participants": "Meg kell adnia a résztvevők becenevét.", + "Choose if they are real players or an AI.": "Válasszon valódi játékos vagy mesterséges intelligencia ellenfelet.", "Use a framework as backend": "Használjon egy keretrendszert a háttérben", "Use a front-end framework or toolkit": "Használjon egy front-end keretrendszert vagy eszköztárat", "Use a database for the backend": "Használjon adatbázist a háttérben", diff --git a/frontend/src/locales/jp/translation.json b/frontend/src/locales/jp/translation.json index a3a17f5a3..33f699fee 100644 --- a/frontend/src/locales/jp/translation.json +++ b/frontend/src/locales/jp/translation.json @@ -12,6 +12,10 @@ "The Project": "プロジェクト", "16 Major & 11 Minor modules": "16のメジャーモジュールと11のマイナーモジュール", "Web": "ウェブ", + "Play a Tournament against other players.": "他のプレイヤーとトーナメントをプレイします。", + "This mode is played in multiple rounds.": "このモードは複数のラウンドでプレイされます。", + "You need to provide the nicknames for the participants": "参加者のニックネームを提供する必要があります。", + "Choose if they are real players or an AI.": "彼らが実際のプレイヤーかAIかを選択してください。", "Use a framework as backend": "バックエンドとしてフレームワークを使用する", "Use a front-end framework or toolkit": "フロントエンドのフレームワークやツールキットを使用する", "Use a database for the backend": "バックエンドにデータベースを使用する", diff --git a/frontend/src/pages/About.js b/frontend/src/pages/About.js index 1acde7162..f2538a7c8 100644 --- a/frontend/src/pages/About.js +++ b/frontend/src/pages/About.js @@ -9,8 +9,20 @@ import zsolt from "../images/about/zsolt.jpeg"; import jamshidbek from "../images/about/jamshidbek.jpg"; import karlis from "../images/about/karlis.png"; import laszlo from "../images/about/laszlo.png"; +import Cookies from "js-cookie"; function About() { + useEffect(() => { + setTimeout(() => { + const accessToken = Cookies.get("access"); + console.log(accessToken); + + if (!accessToken) { + window.location.href = "/404.html"; + } + }, 1000); + }, []); + const [selectedCard, setSelectedCard] = React.useState(null); const { t } = useTranslation(); const teamMembers = [ @@ -121,10 +133,10 @@ function About() { flex flex-col items-center justify-start transition-all duration-800 ease-in-out transform-gpu shadow-2xl ${ - selectedCard === index - ? "w-96 absolute top-1/2 transform -translate-y-1/2" - : "" - }`} + selectedCard === index + ? "w-96 absolute top-1/2 transform -translate-y-1/2" + : "" + }`} style={{ backgroundImage: `url(${backgroundImage})`, transition: "transform 0.0s ease-in-out", diff --git a/frontend/src/pages/Chat.js b/frontend/src/pages/Chat.js index bcd1d57dd..9e04eaaad 100644 --- a/frontend/src/pages/Chat.js +++ b/frontend/src/pages/Chat.js @@ -12,8 +12,20 @@ import { unblockUser, getBlockedUsers, } from "../components/API"; +import Cookies from "js-cookie"; function Chat({ redirectUri }) { + useEffect(() => { + setTimeout(() => { + const accessToken = Cookies.get("access"); + console.log(accessToken); + + if (!accessToken) { + window.location.href = "/404.html"; + } + }, 1000); + }, []); + const { t } = useTranslation(); const navigate = useNavigate(); const [currentChannel, setCurrentChannel] = useState("General"); diff --git a/frontend/src/pages/Games/Games.js b/frontend/src/pages/Games/Games.js deleted file mode 100644 index 8fba0e286..000000000 --- a/frontend/src/pages/Games/Games.js +++ /dev/null @@ -1,75 +0,0 @@ -import React from "react"; -import { Link } from "react-router-dom"; - -function Games() { - const tiles = [ - { - name: "PONG", - video: - "https://www.youtube.com/embed/dQw4w9WgXcQ?controls=0&showinfo=0&rel=0&autoplay=1&mute=1&loop=1&playlist=dQw4w9WgXcQ", - }, - { - name: "Emotional Damage", - video: - "https://www.youtube.com/embed/dQw4w9WgXcQ?controls=0&showinfo=0&rel=0&autoplay=1&mute=1&loop=1&playlist=dQw4w9WgXcQ", - }, - ]; - - return ( -
-
- {tiles.map((tile, index) => ( - -
- -
-
- {tile.name} -
- - ))} -
-
- ); -} - -export default Games; diff --git a/frontend/src/pages/Home.js b/frontend/src/pages/Home.js index 0b77a69b5..31b84786f 100644 --- a/frontend/src/pages/Home.js +++ b/frontend/src/pages/Home.js @@ -1,9 +1,10 @@ /* disable eslint */ -import React from "react"; +import React, { useEffect} from "react"; import WelcomeMessage from "../components/home/WelcomeMessage"; import Readme from "../components/home/Readme"; import Sidebar from "../components/hamburger_menu/Hamburger"; +import Cookies from "js-cookie"; function ScrollDownIndicator() { return ( @@ -16,6 +17,17 @@ function ScrollDownIndicator() { } function Home({ redirectUri }) { + useEffect(() => { + setTimeout(() => { + const accessToken = Cookies.get("access"); + console.log(accessToken); + + if (!accessToken) { + window.location.href = "/404.html"; + } + }, 1000); + }, []); + return ( <>
diff --git a/frontend/src/pages/Profile.js b/frontend/src/pages/Profile.js index 792b06e71..76a30cfa7 100644 --- a/frontend/src/pages/Profile.js +++ b/frontend/src/pages/Profile.js @@ -217,6 +217,17 @@ const defaultUserDetails = { }; function Profile({ redirectUri }) { + useEffect(() => { + setTimeout(() => { + const accessToken = Cookies.get("access"); + console.log(accessToken); + + if (!accessToken) { + window.location.href = "/404.html"; + } + }, 1000); + }, []); + const [userDetails, setUserDetails] = useState(null); const [imageUrl, setImageUrl] = useState(defaultUserDetails.profile_picture); const [username, setUsername] = useState( @@ -241,7 +252,7 @@ function Profile({ redirectUri }) { .replace("('", "") .replace("',)", "") .replace("v2/", "") - .replace("api", "profile"), + .replace("api", "profile"), }; });