├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── app ├── App.css ├── App.js └── App.test.js ├── assets └── img │ ├── back_img.png │ └── back_img_gradient.png ├── components ├── common │ └── inputbox │ │ ├── index.jsx │ │ └── style.css └── layout │ ├── footer │ ├── index.jsx │ └── style.css │ ├── header │ ├── index.jsx │ └── style.css │ ├── index.jsx │ └── style.css ├── config └── index.js ├── index.js ├── pages ├── about │ ├── index.jsx │ └── style.css ├── community │ ├── index.jsx │ └── style.css ├── get_involved │ ├── index.jsx │ └── style.css ├── home │ ├── index.jsx │ └── style.css ├── login │ ├── index.jsx │ └── style.css ├── plant_offset │ ├── index.jsx │ └── style.css ├── profile │ ├── index.jsx │ └── style.css ├── projects │ ├── index.jsx │ └── style.css └── register │ ├── index.jsx │ └── style.css ├── reportWebVitals.js └── setupTests.js /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create Gang Green Heroes 2 | 3 | This project was bootstrapped with [Create Gang Green Heroes](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create Gang Green Heroes documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gang_green_heroes", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "react": "^18.2.0", 10 | "react-bootstrap": "^2.7.0", 11 | "react-dom": "^18.2.0", 12 | "react-facebook-login": "^4.1.1", 13 | "react-icons": "^4.7.1", 14 | "react-router-dom": "^6.6.1", 15 | "react-scripts": "5.0.1", 16 | "react-toastify": "^9.1.1", 17 | "web-vitals": "^2.1.4" 18 | }, 19 | "scripts": { 20 | "start": "react-scripts start", 21 | "build": "react-scripts build", 22 | "test": "react-scripts test", 23 | "eject": "react-scripts eject" 24 | }, 25 | "eslintConfig": { 26 | "extends": [ 27 | "react-app", 28 | "react-app/jest" 29 | ] 30 | }, 31 | "browserslist": { 32 | "production": [ 33 | ">0.2%", 34 | "not dead", 35 | "not op_mini all" 36 | ], 37 | "development": [ 38 | "last 1 chrome version", 39 | "last 1 firefox version", 40 | "last 1 safari version" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 25 | Gang Green Heroes 26 | 27 | 28 | 29 | 30 |
31 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Gang Green Heroes", 3 | "name": "Create Gang Green Heroes Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/app/App.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.cdnfonts.com/css/futura-std-4'); 2 | 3 | body { 4 | margin: 0; 5 | padding: 0; 6 | color: #FFFFFF; 7 | background-color: #242424; 8 | background-image: url('../assets/img/back_img_gradient.png'); 9 | background-repeat: no-repeat; 10 | background-size: cover; 11 | align-items: center; 12 | font-family: 'Futura Std'; 13 | } 14 | 15 | a { 16 | text-decoration: none; 17 | color: #FFFFFF; 18 | } 19 | 20 | a:hover { 21 | color: #D07920; 22 | } 23 | 24 | .main-body-container { 25 | flex: 1; 26 | margin: 20px 10px; 27 | } 28 | 29 | .wrapper-center { 30 | text-align: center; 31 | } 32 | 33 | .wrapper-align-center { 34 | align-items: center; 35 | } 36 | 37 | .wrapper-just-content-center { 38 | justify-content: center; 39 | } 40 | 41 | .common-button { 42 | font-size: 14px; 43 | padding: 10px 30px; 44 | background-color: #242424D0; 45 | color: #ffffff; 46 | border: 1px solid #ffffff; 47 | border-radius: 50rem; 48 | cursor: pointer; 49 | display: flex; 50 | } 51 | 52 | .common-button:hover { 53 | box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.5); 54 | -webkit-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.8); 55 | -moz-box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.8); 56 | opacity: 0.8; 57 | } 58 | 59 | .common-button:active { 60 | border-color: #D07920; 61 | } -------------------------------------------------------------------------------- /src/app/App.js: -------------------------------------------------------------------------------- 1 | import { BrowserRouter, Routes, Route } from "react-router-dom"; 2 | import './App.css'; 3 | 4 | import Layout from "../components/layout"; 5 | import Home from "../pages/home"; 6 | import Login from "../pages/login"; 7 | import Register from "../pages/register"; 8 | import PlantOffset from "../pages/plant_offset"; 9 | import Projects from "../pages/projects"; 10 | import GetInvolved from "../pages/get_involved"; 11 | import About from "../pages/about"; 12 | import Community from "../pages/community"; 13 | import Profile from "../pages/profile"; 14 | 15 | export default function App() { 16 | return ( 17 | 18 | 19 | }> 20 | } /> 21 | {/* {localStorage.getItem("token") && (} />)} */} 22 | } /> 23 | } /> 24 | } /> 25 | } /> 26 | } /> 27 | } /> 28 | } /> 29 | } /> 30 | 31 | 32 | 33 | ); 34 | } -------------------------------------------------------------------------------- /src/app/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/assets/img/back_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/assets/img/back_img.png -------------------------------------------------------------------------------- /src/assets/img/back_img_gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/assets/img/back_img_gradient.png -------------------------------------------------------------------------------- /src/components/common/inputbox/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const InputBox = ({ type, placeholder, style, handleChange, handleKeypress, value }) => { 5 | return ( 6 | handleChange(e)} onKeyDown={(e) => handleKeypress(e)} value={value} /> 7 | ) 8 | } 9 | 10 | export default InputBox; -------------------------------------------------------------------------------- /src/components/common/inputbox/style.css: -------------------------------------------------------------------------------- 1 | input { 2 | background-color: #242424; 3 | caret-color: #FFFFFF; 4 | border: 1px solid #FFFFFF; 5 | padding: 10px; 6 | color: #FFFFFF; 7 | border-radius: 5px; 8 | } 9 | 10 | input:focus { 11 | outline: none; 12 | border-color: #D07920; 13 | } -------------------------------------------------------------------------------- /src/components/layout/footer/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const Footer = () => { 5 | return ( 6 |
7 | Copyright © 2023 Gang Green Heroes 8 |
9 | ) 10 | } 11 | 12 | export default Footer; -------------------------------------------------------------------------------- /src/components/layout/footer/style.css: -------------------------------------------------------------------------------- 1 | .footer-container { 2 | font-family: 'Futura Std'; 3 | font-style: normal; 4 | font-weight: 400; 5 | font-size: 15px; 6 | line-height: 18px; 7 | width: 75%; 8 | padding: 20px calc(12.5%); 9 | background-color: #1e1e1ef5; 10 | } -------------------------------------------------------------------------------- /src/components/layout/header/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from "react"; 2 | import { BiUserCircle, BiUser } from 'react-icons/bi'; 3 | import { RiLogoutBoxRLine } from 'react-icons/ri'; 4 | import { Link, useNavigate, useLocation } from 'react-router-dom'; 5 | import './style.css'; 6 | 7 | const Header = () => { 8 | const [scrollPosition, setScrollPosition] = useState(0); 9 | const navigate = useNavigate(); 10 | const location = useLocation(); 11 | const handleScroll = () => { 12 | const position = window.pageYOffset; 13 | setScrollPosition(position); 14 | }; 15 | useEffect(() => { 16 | window.addEventListener('scroll', handleScroll, { passive: true }); 17 | 18 | return () => { 19 | window.removeEventListener('scroll', handleScroll); 20 | }; 21 | }, []); 22 | const handleLogout = () => { 23 | localStorage.clear(); 24 | navigate("/login"); 25 | } 26 | return ( 27 |
75 ? `drop-box-active` : ``}`}> 28 |
29 |

Gang Green Heroes

30 |
31 |
32 | Plant & Offset 33 | Projects 34 | Get Involved 35 | About 36 | Community 37 | {localStorage.getItem("token") ? 38 |
39 | 40 |
    41 |
  • 42 | My Profile 43 |
  • 44 |
  • handleLogout()}> 45 | Logout 46 |
  • 47 |
48 |
49 | : 50 | Login/Register} 51 |
52 |
53 | ) 54 | } 55 | 56 | export default Header; -------------------------------------------------------------------------------- /src/components/layout/header/style.css: -------------------------------------------------------------------------------- 1 | .header-container { 2 | display: flex; 3 | flex-direction: row; 4 | justify-content: space-between; 5 | align-items: center; 6 | text-align: center; 7 | width: 75%; 8 | padding: 30px calc(12.5%); 9 | position: fixed; 10 | transition: all 0.3s ease-in-out; 11 | z-index: 9999; 12 | } 13 | 14 | .header-container.drop-box-active { 15 | padding: 20px calc(12.5%); 16 | background-color: #1e1e1ef5; 17 | box-shadow: 10px 11px 40px 0px rgba(0,0,0,0.5); 18 | -webkit-box-shadow: 10px 11px 40px 0px rgba(0,0,0,0.5); 19 | -moz-box-shadow: 10px 11px 40px 0px rgba(0,0,0,0.5); 20 | transition: all 0.3s ease-in-out; 21 | } 22 | 23 | .logo-wrapper { 24 | cursor: pointer; 25 | } 26 | 27 | .logo-title { 28 | font-size: 32px; 29 | margin: 0; 30 | } 31 | 32 | .logo-title:hover { 33 | color: #FFFFFF; 34 | } 35 | 36 | .menu-wrapper { 37 | display: flex; 38 | gap: 30px; 39 | font-family: 'Futura Std'; 40 | font-style: normal; 41 | font-weight: 400; 42 | font-size: 15px; 43 | line-height: 18px; 44 | align-items: center; 45 | } 46 | 47 | .menu-wrapper a.active { 48 | color: #D07920; 49 | } 50 | 51 | .user-info-section { 52 | font-size: 24px; 53 | cursor: pointer; 54 | padding: 5px; 55 | } 56 | 57 | .dropdown-wrapper { 58 | position: relative; 59 | } 60 | 61 | .dropdown-body-container { 62 | position: absolute; 63 | top: 10px; 64 | background-color: #D07920; 65 | list-style-type: none; 66 | padding: 0; 67 | display: none; 68 | flex-direction: column; 69 | text-align: left; 70 | } 71 | 72 | .dropdown-body-container li { 73 | font-size: 15px; 74 | border-bottom: 1px solid #1e1e1ef5; 75 | padding: 10px 30px; 76 | min-width: 100px; 77 | align-items: center; 78 | } 79 | 80 | .dropdown-body-container li a svg, 81 | .dropdown-body-container li svg { 82 | margin-right: 10px; 83 | } 84 | 85 | .dropdown-body-container li:last-child { 86 | border: none; 87 | } 88 | 89 | .user-info-section:hover .dropdown-body-container { 90 | display: flex; 91 | } 92 | 93 | .dropdown-body-container:hover { 94 | display: flex; 95 | } 96 | 97 | .dropdown-body-container li:hover { 98 | color: #1e1e1ef5; 99 | } 100 | 101 | .dropdown-body-container li a:hover { 102 | color: #1e1e1ef5; 103 | } -------------------------------------------------------------------------------- /src/components/layout/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Outlet } from "react-router-dom"; 3 | import './style.css'; 4 | 5 | import Header from "./header"; 6 | import Footer from "./footer"; 7 | 8 | const Layout = () => { 9 | return ( 10 |
11 |
12 |
13 | 14 |
15 |
16 |
17 | ) 18 | } 19 | 20 | export default Layout; -------------------------------------------------------------------------------- /src/components/layout/style.css: -------------------------------------------------------------------------------- 1 | .root-container { 2 | display: flex; 3 | flex-direction: column; 4 | height: 100vh; 5 | } 6 | 7 | .layout-container { 8 | width: 75%; 9 | margin: 0 auto; 10 | padding-top: 95px; 11 | flex: 1; 12 | display: flex; 13 | flex-direction: column; 14 | } -------------------------------------------------------------------------------- /src/config/index.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | server_url: 'http://localhost:9000' 3 | } 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './app/App'; 4 | import reportWebVitals from './reportWebVitals'; 5 | 6 | const root = ReactDOM.createRoot(document.getElementById('root')); 7 | root.render( 8 | 9 | 10 | 11 | ); 12 | 13 | // If you want to start measuring performance in your app, pass a function 14 | // to log results (for example: reportWebVitals(console.log)) 15 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 16 | reportWebVitals(); 17 | -------------------------------------------------------------------------------- /src/pages/about/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const About = () => { 5 | return ( 6 |
7 | Here is About page.
8 |
9 | ) 10 | } 11 | 12 | export default About; -------------------------------------------------------------------------------- /src/pages/about/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/pages/about/style.css -------------------------------------------------------------------------------- /src/pages/community/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const Community = () => { 5 | return ( 6 |
7 | Here is Community page.
8 |
9 | ) 10 | } 11 | 12 | export default Community; -------------------------------------------------------------------------------- /src/pages/community/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/pages/community/style.css -------------------------------------------------------------------------------- /src/pages/get_involved/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const GetInvolved = () => { 5 | return ( 6 |
7 | Here is Get Involved page.
8 |
9 | ) 10 | } 11 | 12 | export default GetInvolved; -------------------------------------------------------------------------------- /src/pages/get_involved/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/pages/get_involved/style.css -------------------------------------------------------------------------------- /src/pages/home/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from "react"; 2 | import './style.css'; 3 | 4 | import { ToastContainer, toast } from 'react-toastify'; 5 | import 'react-toastify/dist/ReactToastify.css'; 6 | 7 | const Home = () => { 8 | useEffect(() => { 9 | if (localStorage.getItem("token") && localStorage.getItem("notify")) { 10 | toast.success(localStorage.getItem("notify")); 11 | localStorage.removeItem("notify"); 12 | } 13 | }, []); 14 | return ( 15 |
16 | Here is Home page.
17 | Here is Home page.
18 | Here is Home page.
19 | Here is Home page.
20 | 21 | 22 |
23 | ) 24 | } 25 | 26 | export default Home; -------------------------------------------------------------------------------- /src/pages/home/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/pages/home/style.css -------------------------------------------------------------------------------- /src/pages/login/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import FacebookLogin from 'react-facebook-login'; 3 | import { Link, useNavigate } from "react-router-dom"; 4 | import { BsFacebook } from 'react-icons/bs'; 5 | import { ToastContainer, toast } from 'react-toastify'; 6 | import 'react-toastify/dist/ReactToastify.css'; 7 | 8 | import './style.css'; 9 | 10 | import config from "../../config"; 11 | import InputBox from "../../components/common/inputbox"; 12 | 13 | 14 | const Login = () => { 15 | const [email, setEmail] = useState(''); 16 | const [password, setPassword] = useState(''); 17 | const navigate = useNavigate(); 18 | const responseFacebook = (response) => { 19 | console.log(response); 20 | } 21 | const componentClicked = () => { 22 | console.log("clicked"); 23 | } 24 | const handleEmail = (e) => { 25 | setEmail(e.target.value); 26 | } 27 | const handlePassword = (e) => { 28 | setPassword(e.target.value); 29 | } 30 | const handleKeypressEnter = (e) => { 31 | if (e.keyCode === 13) { 32 | handleLogin(); 33 | } 34 | } 35 | const handleLogin = () => { 36 | if (!validateForm()) { 37 | toast.error("Input the fields!"); 38 | return; 39 | } 40 | if (validateFormData() !== "success") { 41 | toast.error(validateFormData()); 42 | return; 43 | } 44 | const requestOptions = { 45 | method: 'POST', 46 | headers: { 'Content-Type': 'application/json' }, 47 | body: JSON.stringify({ email: email, password: password }) 48 | }; 49 | let requestUrl = `${config.server_url}/api/users/login`; 50 | fetch(requestUrl, requestOptions) 51 | .then(res => res.json()) 52 | .then( 53 | (result) => { 54 | if (result.token) { 55 | localStorage.setItem("token", JSON.stringify(result.token)); 56 | localStorage.setItem("notify", result.msg); 57 | navigate("/"); 58 | } else { 59 | toast.error(result.msg); 60 | } 61 | }, 62 | (error) => { 63 | console.log(error); 64 | } 65 | ) 66 | } 67 | const validateForm = () => { 68 | if (email === '' || password === '') { 69 | return false; 70 | } else { 71 | return true; 72 | } 73 | } 74 | const validateFormData = () => { 75 | if (email.indexOf('@') < 0 || email.indexOf('.') < 0 || email.trim().indexOf(' ') > 0) { 76 | return "Enter correct email!"; 77 | } 78 | return "success"; 79 | } 80 | return ( 81 |
82 |
83 |

Log in to Gang Green Heroes

84 | } /> 92 |
Or
93 | 94 | 95 |

Did you forget your password?

96 | 97 |
98 |

Not yet registered? Sign up!

99 | 100 |
101 | ) 102 | } 103 | 104 | export default Login; -------------------------------------------------------------------------------- /src/pages/login/style.css: -------------------------------------------------------------------------------- 1 | .signup-label { 2 | font-size: 20px; 3 | } 4 | 5 | .login-form-wrapper { 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: center; 9 | align-items: center; 10 | border: 1px solid #FFFFFF; 11 | border-radius: 10px; 12 | padding: 20px; 13 | margin: auto; 14 | margin-top: 50px; 15 | width: 500px; 16 | background: linear-gradient(180deg, rgba(36,36,36,1) 5%, rgba(18,18,18,1) 15%, transparent 100%); 17 | box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.5); 18 | -webkit-box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.8); 19 | -moz-box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.8); 20 | } 21 | 22 | .login-form-title { 23 | text-align: center; 24 | font-size: 32px; 25 | margin: 0; 26 | margin-bottom: 20px; 27 | } 28 | 29 | .kep-login-facebook { 30 | margin-top: 30px; 31 | } 32 | 33 | .btnFacebook { 34 | display: flex; 35 | gap: 30px; 36 | font-size: 16px; 37 | border: none; 38 | border-radius: 5px; 39 | color: #FFFFFF; 40 | background-color: #2d4373; 41 | padding: 12px 20px; 42 | margin-top: 30px; 43 | cursor: pointer; 44 | } 45 | 46 | .btnFacebook:hover { 47 | opacity: 0.8; 48 | } 49 | 50 | .sep-line { 51 | margin: 15px auto 20px; 52 | text-align: center; 53 | width: 60%; 54 | } 55 | 56 | .sep-line::before { 57 | background: #FFFFFF; 58 | content: ""; 59 | display: inline-block; 60 | height: 1px; 61 | width: calc(50% - 25px); 62 | } 63 | 64 | .sep-line::after { 65 | background: #FFFFFF; 66 | content: ""; 67 | display: inline-block; 68 | height: 1px; 69 | width: calc(50% - 25px); 70 | } 71 | 72 | .sep-line span { 73 | display: inline-block; 74 | font-size: 15px; 75 | height: 30px; 76 | padding: 5px 0 0; 77 | position: relative; 78 | vertical-align: top; 79 | width: 50px; 80 | z-index: 999; 81 | } 82 | 83 | .forget-password-label { 84 | font-size: 14px; 85 | padding-right: calc(50% - 130px); 86 | cursor: pointer; 87 | } 88 | 89 | .login-button { 90 | font-size: 16px; 91 | padding: 12px 20px; 92 | color: #FFFFFF; 93 | background-color: #D07920; 94 | border: none; 95 | border-radius: 5px; 96 | width: 60%; 97 | margin: 20px auto; 98 | cursor: pointer; 99 | } 100 | 101 | .login-button:hover { 102 | opacity: 0.8; 103 | } -------------------------------------------------------------------------------- /src/pages/plant_offset/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const PlantOffset = () => { 5 | return ( 6 |
7 | Here is Plant Offset page.
8 |
9 | ) 10 | } 11 | 12 | export default PlantOffset; -------------------------------------------------------------------------------- /src/pages/plant_offset/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/pages/plant_offset/style.css -------------------------------------------------------------------------------- /src/pages/profile/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { FaMale, FaFemale } from 'react-icons/fa'; 3 | import { BsPlusLg, BsTrash } from 'react-icons/bs'; 4 | import './style.css'; 5 | 6 | import InputBox from '../../components/common/inputbox'; 7 | 8 | const Profile = () => { 9 | const [registerMethod, setRegisterMethod] = useState('citizen'); 10 | const [gender, setGender] = useState('male'); 11 | const [countWalletAddress, setCountWalletAddress] = useState(0); 12 | const inputboxStyle = { 13 | borderRadius: '50rem', 14 | width: '100%', 15 | backgroundColor: '#575757', 16 | border: 'none', 17 | paddingLeft: '20px', 18 | fontSize: '16px' 19 | } 20 | const handleRadio = (e) => { 21 | setRegisterMethod(e); 22 | } 23 | const handleGender = (e) => { 24 | setGender(e); 25 | } 26 | const handlePlusWalletAddress = () => { 27 | setCountWalletAddress(countWalletAddress + 1); 28 | } 29 | const handleMinusWalletAddress = () => { 30 | if (countWalletAddress > 0) { 31 | setCountWalletAddress(countWalletAddress - 1); 32 | } 33 | } 34 | return ( 35 |
36 |
37 |
38 | My profile 39 |
40 |
41 |
42 |
43 | Cagetory 44 |
45 |
46 | 50 | 54 |
55 |
56 |
57 |
58 | Email Address 59 |
60 |
61 | 62 |
63 |
64 |
65 |
66 | Gender 67 |
68 |
69 |
handleGender('male')}> 70 | 71 | Male 72 |
73 |
handleGender('female')}> 74 | 75 | Female 76 |
77 |
78 |
79 |
80 |
81 | Full Name 82 |
83 |
84 | 85 |
86 |
87 |
88 |
89 |
90 | Company Name 91 |
92 |
93 | 94 |
95 |
96 |
97 |
98 | Company Website 99 |
100 |
101 | 102 |
103 |
104 |
105 |
106 | 107 | 108 |
109 | { 110 | Array.from(Array(countWalletAddress), (e, i) => { 111 | return ( 112 |
113 |
114 | Wallet Address {i + 1} 115 |
116 |
117 | 118 |
119 |
120 | ) 121 | }) 122 | } 123 |
124 | 125 |
126 |
127 |
128 |
129 | ) 130 | } 131 | 132 | export default Profile; -------------------------------------------------------------------------------- /src/pages/profile/style.css: -------------------------------------------------------------------------------- 1 | .profile-container { 2 | display: flex; 3 | flex-direction: column; 4 | margin: 20px auto; 5 | width: 80%; 6 | border: 1px solid #ffffff; 7 | border-radius: 10px; 8 | box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.5); 9 | -webkit-box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.8); 10 | -moz-box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.8); 11 | } 12 | 13 | .profile-header-container { 14 | padding: 15px 30px; 15 | border-bottom: 1px solid #ffffff; 16 | border-top-left-radius: 10px; 17 | border-top-right-radius: 10px; 18 | font-size: 20px; 19 | background: linear-gradient(180deg, rgba(36,36,36,1) 5%, rgba(18,18,18,1) 15%, #242424D0 100%); 20 | } 21 | 22 | .profile-body-container { 23 | display: flex; 24 | flex-direction: column; 25 | background-color: #242424d0; 26 | border-bottom-left-radius: 10px; 27 | border-bottom-right-radius: 10px; 28 | } 29 | 30 | .profile-item-row { 31 | display: flex; 32 | padding: 20px; 33 | flex-direction: row; 34 | align-items: center; 35 | } 36 | 37 | .profile-item-category { 38 | border-bottom: 1px solid #FFFFFF3F; 39 | } 40 | 41 | .profile-item-label { 42 | flex: 40%; 43 | padding-left: calc(100%/10); 44 | } 45 | 46 | .profile-item-content { 47 | flex: 60%; 48 | padding-right: calc(100%/5); 49 | } 50 | 51 | .gender-row-container { 52 | display: flex; 53 | flex-direction: row; 54 | gap: calc(100%/5); 55 | } 56 | 57 | .gendder-item-container { 58 | font-size: 14px; 59 | padding: 10px 20px; 60 | border: 1px solid #ffffff; 61 | border-radius: 50rem; 62 | cursor: pointer; 63 | } 64 | 65 | .gendder-item-container svg{ 66 | margin-right: 5px; 67 | } 68 | 69 | .gendder-item-container.active { 70 | border-color: #D07920; 71 | } 72 | 73 | .category-method-container { 74 | display: flex; 75 | flex-direction: row; 76 | gap: calc(100%/10); 77 | } 78 | 79 | .company-section { 80 | display: none; 81 | } 82 | 83 | .company-section.active { 84 | display: block; 85 | } 86 | 87 | .profile-button-wrapper { 88 | display: flex; 89 | justify-content: center; 90 | align-items: center; 91 | padding: 20px; 92 | margin-bottom: 30px; 93 | } 94 | 95 | .profile-item-row .common-button svg { 96 | margin-left: 5px; 97 | } 98 | 99 | .profile-item-row.wrapper-just-content-center { 100 | gap: 30px; 101 | } -------------------------------------------------------------------------------- /src/pages/projects/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import './style.css'; 3 | 4 | const Projects = () => { 5 | return ( 6 |
7 | Here is Projects page.
8 |
9 | ) 10 | } 11 | 12 | export default Projects; -------------------------------------------------------------------------------- /src/pages/projects/style.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdev050/reactrouter/e99a7c70b3ebe3a2a0cd8255895877ba839689de/src/pages/projects/style.css -------------------------------------------------------------------------------- /src/pages/register/index.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { Link, useNavigate } from "react-router-dom"; 3 | import './style.css'; 4 | 5 | import FacebookLogin from 'react-facebook-login'; 6 | import { BsFacebook } from 'react-icons/bs'; 7 | import { ToastContainer, toast } from 'react-toastify'; 8 | import 'react-toastify/dist/ReactToastify.css'; 9 | import InputBox from "../../components/common/inputbox"; 10 | import config from "../../config"; 11 | 12 | const Register = () => { 13 | const [registerMethod, setRegisterMethod] = useState('citizen'); 14 | const [fullname, setFullname] = useState(''); 15 | const [email, setEmail] = useState(''); 16 | const [password, setPassword] = useState(''); 17 | const [companyName, setCompanyName] = useState(''); 18 | const [companyWebsite, setCompanyWebsite] = useState(''); 19 | const navigate = useNavigate(); 20 | const responseFacebook = (response) => { 21 | console.log(response); 22 | } 23 | const componentClicked = () => { 24 | console.log("clicked"); 25 | } 26 | const handleRadio = (e) => { 27 | setRegisterMethod(e); 28 | } 29 | const handleFullname = (e) => { 30 | setFullname(e.target.value); 31 | } 32 | const handleEmail = (e) => { 33 | setEmail(e.target.value); 34 | } 35 | const handlePassword = (e) => { 36 | setPassword(e.target.value); 37 | } 38 | const handleCompanyName = (e) => { 39 | setCompanyName(e.target.value); 40 | } 41 | const handleCompanyWebsite = (e) => { 42 | setCompanyWebsite(e.target.value); 43 | } 44 | const handleKeypressEnter = (e) => { 45 | if (e.keyCode === 13) { 46 | handleRegister(); 47 | } 48 | } 49 | const handleRegister = () => { 50 | if (!validateForm()) { 51 | toast.error("Input the fields!"); 52 | return; 53 | } 54 | if (validateFormData() !== "success") { 55 | toast.error(validateFormData()); 56 | return; 57 | } 58 | const requestOptions = { 59 | method: 'POST', 60 | headers: { 'Content-Type': 'application/json' }, 61 | body: JSON.stringify({ companyName: companyName, fullname: fullname, companyWebsite: companyWebsite, email: email, password: password, registerMethod: registerMethod }) 62 | }; 63 | let requestUrl = `${config.server_url}/api/users/register`; 64 | fetch(requestUrl, requestOptions) 65 | .then(res => res.json()) 66 | .then( 67 | (result) => { 68 | if (result.token) { 69 | localStorage.setItem("token", JSON.stringify(result.token)); 70 | localStorage.setItem("notify", result.msg); 71 | navigate("/"); 72 | } else { 73 | toast.error(result.msg); 74 | } 75 | }, 76 | (error) => { 77 | console.log(error); 78 | } 79 | ) 80 | } 81 | const validateForm = () => { 82 | if (registerMethod === 'citizen') { 83 | if (fullname === '' || email === '' || password === '') { 84 | return false; 85 | } else { 86 | return true; 87 | } 88 | } else { 89 | if (companyName === '' || email === '' || fullname === '' || companyWebsite === '' || password === '') { 90 | return false; 91 | } else { 92 | return true; 93 | } 94 | } 95 | } 96 | const validateFormData = () => { 97 | if (email.indexOf('@') < 0 || email.indexOf('.') < 0 || email.trim().indexOf(' ') > 0) { 98 | return "Enter correct email!"; 99 | } 100 | if (fullname.trim().indexOf(' ') < 0) { 101 | return "Enter your full name!"; 102 | } 103 | if (registerMethod === 'company' && companyWebsite.indexOf('http://') < 0 && companyWebsite.indexOf('https://') < 0) { 104 | return "Website url must include http:// or https://"; 105 | } 106 | return "success"; 107 | } 108 | return ( 109 |
110 |
111 |
112 |

Join Gang Green Heroes

113 | } /> 121 |
Or
122 |
123 | 127 | 131 |
132 |
133 | 134 | 135 | 136 |
137 |
138 | 139 | 140 | 141 | 142 | 143 |
144 | 145 |

Creating an account means you accept our
Terms of Use and our Privacy Policy

146 |
147 |

Already User? Login!

148 |
149 | 150 |
151 | ) 152 | } 153 | 154 | export default Register; -------------------------------------------------------------------------------- /src/pages/register/style.css: -------------------------------------------------------------------------------- 1 | .signup-label { 2 | font-size: 20px; 3 | } 4 | 5 | .register-form-wrapper { 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: center; 9 | align-items: center; 10 | border: 1px solid #FFFFFF; 11 | border-radius: 10px; 12 | padding: 20px; 13 | margin: auto; 14 | margin-top: 50px; 15 | width: 500px; 16 | background: linear-gradient(180deg, rgba(36,36,36,1) 5%, rgba(18,18,18,1) 15%, transparent 100%); 17 | box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.5); 18 | -webkit-box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.8); 19 | -moz-box-shadow: 0px 0px 65px 0px rgba(0,0,0,0.8); 20 | } 21 | 22 | .register-form-title { 23 | text-align: center; 24 | font-size: 32px; 25 | margin: 0; 26 | margin-bottom: 20px; 27 | } 28 | 29 | .kep-register-facebook { 30 | margin-top: 30px; 31 | } 32 | 33 | .btnFacebook { 34 | display: flex; 35 | gap: 30px; 36 | font-size: 16px; 37 | border: none; 38 | border-radius: 5px; 39 | color: #FFFFFF; 40 | background-color: #2d4373; 41 | padding: 12px 20px; 42 | margin-top: 30px; 43 | cursor: pointer; 44 | } 45 | 46 | .btnFacebook:hover { 47 | opacity: 0.8; 48 | } 49 | 50 | .sep-line { 51 | margin: 15px auto 20px; 52 | text-align: center; 53 | width: 60%; 54 | } 55 | 56 | .sep-line::before { 57 | background: #FFFFFF; 58 | content: ""; 59 | display: inline-block; 60 | height: 1px; 61 | width: calc(50% - 25px); 62 | } 63 | 64 | .sep-line::after { 65 | background: #FFFFFF; 66 | content: ""; 67 | display: inline-block; 68 | height: 1px; 69 | width: calc(50% - 25px); 70 | } 71 | 72 | .sep-line span { 73 | display: inline-block; 74 | font-size: 15px; 75 | height: 30px; 76 | padding: 5px 0 0; 77 | position: relative; 78 | vertical-align: top; 79 | width: 50px; 80 | z-index: 999; 81 | } 82 | 83 | .forget-password-label { 84 | font-size: 14px; 85 | padding-right: calc(50% - 130px); 86 | cursor: pointer; 87 | } 88 | 89 | .register-button { 90 | font-size: 16px; 91 | padding: 12px 20px; 92 | color: #FFFFFF; 93 | background-color: #D07920; 94 | border: none; 95 | border-radius: 5px; 96 | width: 60%; 97 | margin: 20px auto; 98 | cursor: pointer; 99 | } 100 | 101 | .register-button:hover { 102 | opacity: 0.8; 103 | } 104 | 105 | .policy-label { 106 | font-size: 13px; 107 | width: 60%; 108 | } 109 | 110 | .policy-label a { 111 | color: #D07920; 112 | } 113 | 114 | .register-method-section { 115 | margin: 20px auto; 116 | display: flex; 117 | flex-direction: column; 118 | align-items: flex-start; 119 | } 120 | 121 | .register-form-item { 122 | display: none; 123 | } 124 | 125 | .register-form-item.active { 126 | display: block; 127 | } 128 | 129 | .register-label { 130 | font-size: 20px; 131 | } 132 | 133 | .radio-container { 134 | display: block; 135 | position: relative; 136 | padding-left: 35px; 137 | margin-bottom: 12px; 138 | cursor: pointer; 139 | font-size: 16px; 140 | -webkit-user-select: none; 141 | -moz-user-select: none; 142 | -ms-user-select: none; 143 | user-select: none; 144 | } 145 | 146 | .radio-container input { 147 | position: absolute; 148 | opacity: 0; 149 | cursor: pointer; 150 | } 151 | 152 | .checkmark { 153 | position: absolute; 154 | top: 0; 155 | left: 0; 156 | height: 16px; 157 | width: 16px; 158 | background-color: #eee; 159 | border-radius: 50%; 160 | } 161 | 162 | .radio-container:hover input ~ .checkmark { 163 | background-color: #ccc; 164 | } 165 | 166 | .radio-container input:checked ~ .checkmark { 167 | background-color: #D07920; 168 | } 169 | 170 | .checkmark:after { 171 | content: ""; 172 | position: absolute; 173 | display: none; 174 | } 175 | 176 | .radio-container input:checked ~ .checkmark:after { 177 | display: block; 178 | } 179 | 180 | .radio-container .checkmark:after { 181 | top: 4px; 182 | left: 4px; 183 | width: 8px; 184 | height: 8px; 185 | border-radius: 50%; 186 | background: white; 187 | } -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------