├── public ├── robots.txt ├── favicon.ico ├── manifest.json └── index.html ├── src ├── images │ ├── lounge.jpg │ └── homepage.jpg ├── setupTests.js ├── App.test.js ├── utility │ └── auth.js ├── components │ ├── Footer.jsx │ ├── Button.jsx │ ├── Input.jsx │ ├── TextBackground.jsx │ ├── WelcomeContainer.jsx │ ├── Message.jsx │ ├── Navbar.jsx │ └── Form.jsx ├── screens │ ├── Show.jsx │ ├── Welcome.jsx │ ├── Edit.jsx │ ├── Signin.jsx │ ├── TopicEdit.jsx │ ├── CreateTopic.jsx │ ├── Signup.jsx │ ├── TopicDetails.jsx │ └── Lounge.jsx ├── reportWebVitals.js ├── index.js ├── App.js └── App.css ├── .gitignore ├── README.md └── package.json /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LatoyaHead/The-Teachers-Lounge/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/images/lounge.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LatoyaHead/The-Teachers-Lounge/HEAD/src/images/lounge.jpg -------------------------------------------------------------------------------- /src/images/homepage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LatoyaHead/The-Teachers-Lounge/HEAD/src/images/homepage.jpg -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/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/utility/auth.js: -------------------------------------------------------------------------------- 1 | export const authenticated = (setIsAuth) => { //authenticating whether or not the user is logged in by checking token saved on localstorage 2 | const token = localStorage.getItem('token') 3 | if(token) { 4 | setIsAuth(true) 5 | return true 6 | } 7 | setIsAuth(false) 8 | return false 9 | } -------------------------------------------------------------------------------- /src/components/Footer.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Footer = () => { 4 | return ( 5 |
6 |
7 |

© 2022 Latoya All rights reserved.

8 |
9 |
10 | ) 11 | } 12 | 13 | export default Footer 14 | -------------------------------------------------------------------------------- /src/components/Button.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Button = ({text, backgroundColor, width, onClick}) => { 4 | return ( 5 |
6 | 8 |
9 | ) 10 | } 11 | 12 | export default Button -------------------------------------------------------------------------------- /src/screens/Show.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Show = ({lounge}) => { 4 | return ( 5 |
6 |

Lounge

7 |

{lounge.title}

8 |

{lounge.body}

9 | user avatar 10 |
{lounge.author}
11 |
12 | ) 13 | } 14 | 15 | 16 | export default Show -------------------------------------------------------------------------------- /src/components/Input.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Input = ({text, type, onChange, name, placeholder, defaultValue}) => { 4 | return ( 5 |
6 | 7 |
8 | ) 9 | } 10 | 11 | export default Input 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | .env -------------------------------------------------------------------------------- /src/components/TextBackground.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const TextBackground = ({children, title, style}) => { 4 | return ( 5 |
6 |
7 |
{title}
8 |
9 | {children} 10 |
11 |
12 |
13 | ) 14 | } 15 | 16 | export default TextBackground 17 | -------------------------------------------------------------------------------- /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/components/WelcomeContainer.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const WelcomeContainer = ({width, children}) => { 4 | return ( 5 |
6 |
7 |
8 |

The
Teacher's
Lounge

9 |
10 | {children} 11 |
12 |
13 | 14 | ) 15 | } 16 | 17 | export default WelcomeContainer 18 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App'; 4 | import reportWebVitals from './reportWebVitals'; 5 | 6 | const root = ReactDOM.createRoot(document.getElementById('root')); 7 | 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App 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 | } 26 | -------------------------------------------------------------------------------- /src/screens/Welcome.jsx: -------------------------------------------------------------------------------- 1 | import React, {useState, useEffect} from 'react' 2 | import WelcomeContainer from '../components/WelcomeContainer' 3 | import Signin from './Signin' 4 | import { useNavigate } from 'react-router-dom' 5 | import { authenticated } from '../utility/auth' 6 | 7 | const Welcome = () => { 8 | const [isAuth, setIsAuth] = useState(false) 9 | const navigate = useNavigate() 10 | 11 | 12 | useEffect(() => { 13 | if(authenticated(setIsAuth)) { 14 | navigate('/lounge') 15 | } 16 | }, [isAuth]) 17 | 18 | return ( 19 | 20 | 21 | 22 | ) 23 | 24 | } 25 | 26 | export default Welcome 27 | -------------------------------------------------------------------------------- /src/components/Message.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | 4 | const Message = ({message, avatar, user_id, myId, username}) => { 5 | console.log(username); 6 | return ( 7 |
8 |
9 |
10 |

{username}

11 | {/* avatar */} 12 |
13 |

{message}

14 |
15 |
16 | ) 17 | } 18 | 19 | export default Message -------------------------------------------------------------------------------- /src/screens/Edit.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Navbar from '../components/Navbar' 3 | import TextBackground from '../components/TextBackground' 4 | 5 | const Edit = ({LoungeModel}) => { 6 | return ( 7 |
8 |
9 | 10 |
11 | Title: 12 |
13 | Body: