Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleaning and editing #6

Merged
merged 11 commits into from
Jul 3, 2022
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# devflix-video-streaming-app
DevFlix is a video streaming app built in ReactJS and NodeJS & Express as a part of the Software Engineering program by ALX AFRICA & Holberton School.
# Devflix

Pericles001 marked this conversation as resolved.
Show resolved Hide resolved
## Description

DevFlix is a video streaming app built in ReactJS and NodeJS & Express as a part of the Software Engineering program by ALX AFRICA & Holberton School.

## Key Features

## Technologies

Pericles001 marked this conversation as resolved.
Show resolved Hide resolved
- Client-Side:

- HTML5
- CSS3
- JavaScript
- ReactJS

- Server-Side:

- JavaScript
- Node.js
- Express

## How to use

## How to contribute

## Authors

## Acknowledgments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

68 changes: 26 additions & 42 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -1,45 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="DevFlix is a video streaming app built in ReactJS and NodeJS & Express as a part of the Software Engineering program by ALX AFRICA & Holberton School."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200"
rel="stylesheet"
/>
<link
href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css"
rel="stylesheet"
/>
<title>Devflix</title>
</head>

<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet" />
<title>React App</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Pericles001 marked this conversation as resolved.
Show resolved Hide resolved
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</html>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
abdoachhoubi marked this conversation as resolved.
Show resolved Hide resolved
</body>
</html>
4 changes: 2 additions & 2 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "Devflix",
"name": "Devflix - Video Streaming App",
"icons": [
{
"src": "favicon.ico",
Expand Down
43 changes: 19 additions & 24 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
import React, { useState, useEffect } from 'react';

import Login from './components/LoginPage';
import Register from './components/RegisterPage';
import Home from './components/HomePage';
import TempPlayer from './components/TempPlayer';
import firebase from './services/firebase';
import { Login, Register, Home, TempPlayer } from './components';
Pericles001 marked this conversation as resolved.
Show resolved Hide resolved
import firebase from './services/firebase';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import { Routes, Route } from 'react-router-dom';

function App() {
function App () {

document.documentElement.classList.remove("nav-open");
React.useEffect(() => {
document.body.classList.add("index");
return function cleanup() {
document.body.classList.remove("index");
document.documentElement.classList.remove( "nav-open" );
React.useEffect( () => {
document.body.classList.add( "index" );
return function cleanup () {
document.body.classList.remove( "index" );
};
});
} );

const [user, setUser] = useState(null);
const [ user, setUser ] = useState( null );

useEffect(() => {
firebase.auth().onAuthStateChanged(user => {
setUser(user);
})
}, [])

console.log(user)
useEffect( () => {
firebase.auth().onAuthStateChanged( user => {
setUser( user );
} )
}, [] );

return (
<div className="app">
<Routes>
<Route path="/" element={ user ? <Home user={user} /> : <Login /> } />
<Route path="login" element={ user ? <Home user={user} /> : <Login /> } />
<Route path="register" element={ user ? <Home user={user} /> : <Register /> } />
<Route path="/player/:id" element={ user ? <TempPlayer /> : <Login />}></Route>
<Route path="/" element={ user ? <Home user={ user } /> : <Login /> } />
<Route path="login" element={ user ? <Home user={ user } /> : <Login /> } />
<Route path="register" element={ user ? <Home user={ user } /> : <Register /> } />
<Route path="/player/:id" element={ user ? <TempPlayer /> : <Login /> }></Route>
</Routes>
</div>
);
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as Login } from "./LoginPage";
export { default as Register } from "./RegisterPage";
export { default as Home } from "./HomePage";
export { default as TempPlayer } from "./TempPlayer";
16 changes: 7 additions & 9 deletions client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import ReactDOM from 'react-dom/client';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from 'react-router-dom';
import App from './App';
import './index.css';

const root = ReactDOM.createRoot( document.getElementById( "root" ) );
Pericles001 marked this conversation as resolved.
Show resolved Hide resolved

ReactDOM.render(
root.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();