diff --git a/src/App.jsx b/src/App.jsx index a49c114..63d14b6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,9 +5,11 @@ import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import LoginPage from './pages/LoginPage/LoginPage'; import DashboardPage from './pages/DashboardPage/DashboardPage'; +import ServerDetails from './pages/ServerDetails/ServerDetails'; import { auth } from './service/firebase'; import styles from './App.module.scss'; import Loading from './pages/Loading/loading'; +import NotFound from './pages/NotFound/NotFound'; const App = () => { const [user, setUser] = useState(null); @@ -40,7 +42,9 @@ const App = () => { : } /> : } /> + : } /> {/* Ajout de cette ligne */} } /> + } /> {/* route 404 */} diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index dd4b286..1334ec5 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -1,13 +1,15 @@ +// src/components/serverCard/serverCard.jsx import React from 'react'; +import { Link } from 'react-router-dom'; import styles from './serverCard.module.scss'; -import paper from '../../assets/frameworks/paper_mc.png' -import spigot from '../../assets/frameworks/spigot.png' -import bukkit from '../../assets/frameworks/bukkit.png' -import vanilla from '../../assets/frameworks/vanilla.png' -import delete_button from '../../assets/frameworks/delete.png' +import paper from '../../assets/frameworks/paper_mc.png'; +import spigot from '../../assets/frameworks/spigot.png'; +import bukkit from '../../assets/frameworks/bukkit.png'; +import vanilla from '../../assets/frameworks/vanilla.png'; +import delete_button from '../../assets/frameworks/delete.png'; -const ServerCard = ({status, version, link, name, framework, onRunClick, onStopClick, onDeleteClick }) => { +const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, onDeleteClick }) => { const getFrameworkSource = () => { switch (framework) { @@ -20,7 +22,7 @@ const ServerCard = ({status, version, link, name, framework, onRunClick, onStopC default: return vanilla; } - } + }; const handleRun = async () => { try { @@ -47,11 +49,11 @@ const ServerCard = ({status, version, link, name, framework, onRunClick, onStopC }; return ( - +
{name}
- {`${name} + {`${name}
@@ -64,8 +66,8 @@ const ServerCard = ({status, version, link, name, framework, onRunClick, onStopC
Version: {version}
- -
+ + ); }; diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss index 34c4d52..55814e0 100644 --- a/src/components/serverCard/serverCard.module.scss +++ b/src/components/serverCard/serverCard.module.scss @@ -10,8 +10,11 @@ background-color: var(--card-bg-color); color: var(--text-color); margin-bottom: 1.5rem; + cursor: pointer; } + + .status { display: flex; align-items: center; diff --git a/src/pages/NotFound/NotFound.jsx b/src/pages/NotFound/NotFound.jsx new file mode 100644 index 0000000..ba92075 --- /dev/null +++ b/src/pages/NotFound/NotFound.jsx @@ -0,0 +1,18 @@ +// src/pages/NotFoundPage/NotFoundPage.jsx +import React from 'react'; +import Navbar from '../../components/navbar/Navbar'; +import styles from './NotFound.module.scss'; + +const NotFoundPage = () => { + return ( +
+ +
+

Page inconnue

+

La page que vous recherchez n'existe pas.

+
+
+ ); +}; + +export default NotFoundPage; diff --git a/src/pages/NotFound/NotFound.module.scss b/src/pages/NotFound/NotFound.module.scss new file mode 100644 index 0000000..f446cfd --- /dev/null +++ b/src/pages/NotFound/NotFound.module.scss @@ -0,0 +1,35 @@ +// src/pages/NotFound/NotFound.module.scss +.notFoundContainer { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + text-align: center; + color:white; + } + + .message { + margin-top: 50px; + } + + .message h1 { + font-size: 3rem; + margin-bottom: 20px; + } + + .message p { + font-size: 1.5rem; + margin-bottom: 20px; + } + + .message a { + font-size: 1.2rem; + color: #007bff; + text-decoration: none; + } + + .message a:hover { + text-decoration: underline; + } + \ No newline at end of file diff --git a/src/pages/ServerDetails/ServerDetails.jsx b/src/pages/ServerDetails/ServerDetails.jsx new file mode 100644 index 0000000..2592dcb --- /dev/null +++ b/src/pages/ServerDetails/ServerDetails.jsx @@ -0,0 +1,50 @@ +// src/pages/ServerDetails/ServerDetails.jsx +import React, { useEffect, useState } from 'react'; +import { useParams } from 'react-router-dom'; +import Navbar from '../../components/navbar/Navbar'; +import styles from './ServerDetails.module.scss'; +import serviiApi from "../../service/api.tsx"; +import Loading from '../Loading/loading'; + +const ServerDetails = ({ user }) => { + const { serverName } = useParams(); + const [server, setServer] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const loadServer = async () => { + try { + const ApiResponse = await serviiApi.fetchServer(serverName); + setServer(ApiResponse.message); + } catch (error) { + console.error('Error fetching server data:', error); + } finally { + setLoading(false); + } + }; + loadServer(); + }, [serverName]); + + if (loading) { + return ; + } + + return ( +
+ + {server ? ( +
+

{server.name}

+

Status: {server.running ? 'Running' : 'Stopped'}

+

Version: {server.version}

+

Framework: {server.framework}

+ {/* Ajoutez d'autres détails ici */} +
+ ) : ( +
Server not found
+ )} +
+ ); +}; + +export default ServerDetails; diff --git a/src/pages/ServerDetails/ServerDetails.module.scss b/src/pages/ServerDetails/ServerDetails.module.scss new file mode 100644 index 0000000..e69de29