diff --git a/package-lock.json b/package-lock.json index 5b7e14b..33c1e1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "@types/node": "^20.14.9", "firebase": "^10.12.2", "jest": "^29.7.0", + "prop-types": "^15.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.24.0", @@ -9632,6 +9633,7 @@ "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", diff --git a/package.json b/package.json index 62ebf2f..6fb6652 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@types/node": "^20.14.9", "firebase": "^10.12.2", "jest": "^29.7.0", + "prop-types": "^15.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.24.0", diff --git a/src/App.jsx b/src/App.jsx index 6aa4a59..8fa45b6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom'; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; diff --git a/src/components/CreateServer/CreateServer.jsx b/src/components/CreateServer/CreateServer.jsx index 2bdd9a6..9b7341b 100644 --- a/src/components/CreateServer/CreateServer.jsx +++ b/src/components/CreateServer/CreateServer.jsx @@ -1,7 +1,8 @@ -import React, { useState, useEffect } from 'react'; +import { useState, useEffect } from 'react'; import styles from './CreateServer.module.scss'; import { getUserSubdomain } from "../../service/firebase"; import serviiApi from "../../service/api.tsx"; +import PropTypes from "prop-types"; const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noServers }) => { const [subdomain, setSubdomain] = useState(null); @@ -113,4 +114,19 @@ const CreateServer = ({ user, onCreateServer, onSubdomainUpdate, onCancel, noSer ); }; +CreateServer.propTypes = { + user: PropTypes.oneOfType([ + PropTypes.shape({ + uid: PropTypes.string.isRequired, + displayName: PropTypes.string, + email: PropTypes.string, + photoURL: PropTypes.string, + }), + ]), + onCreateServer: PropTypes.func.isRequired, + onSubdomainUpdate: PropTypes.func.isRequired, + onCancel: PropTypes.func.isRequired, + noServers: PropTypes.any +}; + export default CreateServer; diff --git a/src/components/navbar/Navbar.jsx b/src/components/navbar/Navbar.jsx index 257bfe1..784b5aa 100644 --- a/src/components/navbar/Navbar.jsx +++ b/src/components/navbar/Navbar.jsx @@ -1,8 +1,9 @@ -import React, { useState, useEffect, useRef } from 'react'; +import { useState, useEffect, useRef } from 'react'; import { auth } from '../../service/firebase'; import styles from './Navbar.module.scss'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faUser, faCog, faSignOutAlt } from '@fortawesome/free-solid-svg-icons'; +import PropTypes from "prop-types"; const Navbar = ({ user }) => { const [dropdownOpen, setDropdownOpen] = useState(false); @@ -66,4 +67,15 @@ const Navbar = ({ user }) => { ); }; +Navbar.propTypes = { + user: PropTypes.oneOfType([ + PropTypes.shape({ + uid: PropTypes.string.isRequired, + displayName: PropTypes.string, + email: PropTypes.string, + photoURL: PropTypes.string, + }), + ]), +}; + export default Navbar; diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index 0560674..a5e0d66 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Link } from 'react-router-dom'; import styles from './serverCard.module.scss'; @@ -7,6 +6,7 @@ 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 PropTypes from "prop-types"; const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, onDeleteClick }) => { @@ -73,4 +73,16 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, ); }; +ServerCard.propTypes = { + key: PropTypes.string, + status: PropTypes.bool, + version: PropTypes.string, + name: PropTypes.string, + framework: PropTypes.string, + onRunClick: PropTypes.func.isRequired, + onStopClick: PropTypes.func.isRequired, + onDeleteClick: PropTypes.func.isRequired, + subdomain: PropTypes.string, +}; + export default ServerCard; diff --git a/src/pages/DashboardPage/DashboardPage.jsx b/src/pages/DashboardPage/DashboardPage.jsx index b055eb3..cb5a64b 100644 --- a/src/pages/DashboardPage/DashboardPage.jsx +++ b/src/pages/DashboardPage/DashboardPage.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import ServerCard from '../../components/serverCard/serverCard'; import Navbar from '../../components/navbar/Navbar'; import styles from './DashboardPage.module.scss'; @@ -6,6 +6,7 @@ import Loading from '../Loading/loading'; import CreateServer from '../../components/CreateServer/CreateServer'; import { getUserSubdomain } from "../../service/firebase"; import serviiApi from "../../service/api.tsx"; +import PropTypes from "prop-types"; const DashboardPage = ({ user }) => { const [servers, setServers] = useState([]); @@ -154,4 +155,14 @@ const DashboardPage = ({ user }) => { ); }; +DashboardPage.propTypes = { + user: PropTypes.oneOfType([ + PropTypes.shape({ + uid: PropTypes.string.isRequired, + displayName: PropTypes.string, + email: PropTypes.string, + }), + ]), +}; + export default DashboardPage; diff --git a/src/pages/LoginPage/LoginPage.jsx b/src/pages/LoginPage/LoginPage.jsx index d2fe24f..46a7a9d 100644 --- a/src/pages/LoginPage/LoginPage.jsx +++ b/src/pages/LoginPage/LoginPage.jsx @@ -1,5 +1,4 @@ // src/pages/LoginPage/LoginPage.js -import React from 'react'; import { useNavigate } from 'react-router-dom'; import { auth, googleProvider, signInWithPopup } from '../../service/firebase'; import styles from './LoginPage.module.scss'; diff --git a/src/pages/NotFoundPage/NotFoundPage.jsx b/src/pages/NotFoundPage/NotFoundPage.jsx index e73ba41..d9985c9 100644 --- a/src/pages/NotFoundPage/NotFoundPage.jsx +++ b/src/pages/NotFoundPage/NotFoundPage.jsx @@ -1,5 +1,4 @@ // src/pages/NotFoundPage/NotFoundPage.jsx -import React from 'react'; import Navbar from '../../components/navbar/Navbar'; import styles from './NotFoundPage.module.scss'; diff --git a/src/pages/ServerDetails/ServerDetails.jsx b/src/pages/ServerDetails/ServerDetails.jsx index 09ec68c..01d6592 100644 --- a/src/pages/ServerDetails/ServerDetails.jsx +++ b/src/pages/ServerDetails/ServerDetails.jsx @@ -1,9 +1,11 @@ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import { useParams, useNavigate } 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'; +import PropTypes from "prop-types"; + const ServerDetails = ({ user }) => { const { serverName } = useParams(); @@ -148,4 +150,13 @@ const ServerDetails = ({ user }) => { ); }; +ServerDetails.propTypes = { + user: PropTypes.oneOfType([ + PropTypes.shape({ + uid: PropTypes.string.isRequired, + displayName: PropTypes.string, + email: PropTypes.string, + }), + ]), +}; export default ServerDetails;