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

london-10-shadi-fakhri-full-stack-project #375

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
8d1b941
initial codes
Shadi38 Aug 16, 2023
cca8a08
adding fetch
Shadi38 Aug 18, 2023
bc7504e
finishing level 1
Shadi38 Aug 23, 2023
6507e92
adding a delet button
Shadi38 Aug 23, 2023
3cd878e
adding css
Shadi38 Aug 24, 2023
ece4b32
fixing showing video issues
Shadi38 Aug 25, 2023
4a7747c
finishing level 200
Shadi38 Aug 26, 2023
7cd143a
fixing thumps up and down function
Shadi38 Sep 5, 2023
6ad81bf
some changes
Shadi38 Sep 12, 2023
99cadd1
finishing add api changes
Shadi38 Sep 12, 2023
38d9074
finishing delete api
Shadi38 Sep 13, 2023
c6885a2
adding express
Shadi38 Sep 13, 2023
020b78a
adding express in package.json in src
Shadi38 Sep 14, 2023
a06dfa5
changing in css
Shadi38 Sep 14, 2023
9276c41
deleting the node_moduls
Shadi38 Sep 14, 2023
1f2ee20
some changes
Shadi38 Sep 14, 2023
278cf42
changes in css
Shadi38 Sep 14, 2023
15a019a
adding buttons desc and ase
Shadi38 Sep 15, 2023
e2f89a7
css changing
Shadi38 Sep 15, 2023
81cd4c6
converting two ase and desc functions toone function that is orderCl…
Shadi38 Sep 21, 2023
f832b4e
fix put api
Shadi38 Sep 21, 2023
96cd636
deleting fetch from function orderClickHandler
Shadi38 Sep 21, 2023
541a8ab
writing query for order by asc and desc
Shadi38 Sep 22, 2023
828d24e
changing response in videos api
Shadi38 Sep 22, 2023
b1fc225
putting the information about database in .env
Shadi38 Sep 22, 2023
f591e33
changes
Shadi38 Sep 22, 2023
eb7d1d5
changing ssl to true
Shadi38 Sep 27, 2023
fd9057b
changing .env
Shadi38 Sep 27, 2023
6e1a73b
deleting db that was commented
Shadi38 Sep 28, 2023
8f2d6e1
some change in database
Shadi38 Nov 3, 2023
2ccc8e1
change in ssl
Shadi38 Nov 3, 2023
4cb01cf
change in ssl
Shadi38 Nov 4, 2023
464c5d1
change in ssl
Shadi38 Nov 4, 2023
cc478c4
creating build
Shadi38 Jan 23, 2024
6fce3a3
changing the env file
Shadi38 Jan 24, 2024
5626978
changing the env file
Shadi38 Jan 25, 2024
23081c9
changing the env file
Shadi38 Jan 25, 2024
003b2e0
db was changed to set for aws
Shadi38 Jan 25, 2024
5cae357
ssl changed
Shadi38 Jan 25, 2024
ce620e7
comment the db
Shadi38 Jan 25, 2024
15ee3a8
changed configeration
Shadi38 Jan 25, 2024
0e68f45
changing the url
Shadi38 Jan 27, 2024
659af4a
creating the yml file
Shadi38 Jan 27, 2024
0090b3e
update build
Shadi38 Jan 29, 2024
8d4f192
updating build
Shadi38 Jan 29, 2024
9807a58
writing jobs in front-end.yml
Shadi38 Jan 29, 2024
4503776
changing some lines in front-end.yml
Shadi38 Jan 29, 2024
113d492
changing some lines in front-end.yml
Shadi38 Jan 29, 2024
cc922f3
writhing github action code for front end
Shadi38 Jan 31, 2024
dab25af
Update front-end.yml
Shadi38 Jan 31, 2024
320fbbf
Update front-end.yml
Shadi38 Jan 31, 2024
29aa960
hanged names of secret codes
Shadi38 Jan 31, 2024
394af84
Update server.yml
Shadi38 Feb 1, 2024
61d674c
fixed the error in server.yml
Shadi38 Feb 1, 2024
68823dd
changing yml file for server
Shadi38 Feb 13, 2024
3d9076d
changing EC2_SSH_KEY in yml file
Shadi38 Feb 13, 2024
668f76b
changing EC2_SSH_KEY in yml file
Shadi38 Feb 13, 2024
22436ab
changed 600 to 400 key.pem in yml file
Shadi38 Feb 13, 2024
173cad3
changed the port for deploying on AWS
Shadi38 Feb 13, 2024
5cc14c2
changed the key.pem
Shadi38 Feb 13, 2024
f79c327
changed server.yml
Shadi38 Feb 13, 2024
c9a411c
changed server.yml
Shadi38 Feb 13, 2024
a575aa1
changed in AWS_PRIVATE_KEY
Shadi38 Feb 13, 2024
0094db8
changed key.pem in server.yml
Shadi38 Feb 13, 2024
c66197a
changed AWS_PRIVATE_KEY in server.yml
Shadi38 Feb 13, 2024
031210e
changed runs-on: self-hosted
Shadi38 Feb 13, 2024
9da4a65
changed runs-on: ubuntu-latest
Shadi38 Feb 13, 2024
cd7ef29
changed
Shadi38 Feb 13, 2024
4978c46
Update README.md
Shadi38 Feb 19, 2024
7b6a5d0
added teraform
Shadi38 Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

node_modules
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1,880 changes: 1,614 additions & 266 deletions client/package-lock.json

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.6",
"@mui/material": "^5.14.6",
"@mui/styled-engine-sc": "^5.14.6",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.1.10",
"bootstrap": "^5.1.3",
"bootstrap": "^5.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.15.0",
"react-scripts": "^5.0.0",
"styled-components": "^5.3.11",
"express": "^4.18.2",
"web-vitals": "^1.1.2"
},
"scripts": {
Expand Down
129 changes: 129 additions & 0 deletions client/src/App.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,132 @@
.App {
text-align: center;
width: 100%;
height: 100vh;
background-color: #55BCC9;
}

.nav{
display: flex;
justify-content: space-around;
align-items: center;
background-color: #97CAEF;
height: 40px;
margin-top: 10px;
}
.orderBtn{
display: flex;
background-color: transparent;
margin: 5px;
font-weight: bold;

}
.orderBtn p{
background-color: transparent;
color: #FC4445;
}
.orderBtn button{
background-color: transparent;
border-radius: 5px;
border-style: none;
color:black;
height: 20px;
text-align: center;
font-weight: bold;
}
.orderBtn button:active {
color: aliceblue;
}
.main{
width: 800px;
}
div{
background-color: #55BCC9;
}
p{
background-color: #55BCC9;
color: black;
}
button{
background-color: #FC4445;
border-radius: 5px;
border-style: none;
color:aliceblue ;
}
iframe{
border-radius: 5px;
height: 100%;
}

.formDiv {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100vh;
height: 30vh;
}


.input-group {
display: flex;
justify-content: center;
margin: 10px;
background-color: #3FEEE6;
}

#url.lineInput{
margin-left: 10px;
background-color:#3FEEE6;
border: none;
border-bottom: 1px solid #FC4445;
outline: none;
padding: 5px;
}
#title.lineInput{
margin-left: 10px;
background-color:#3FEEE6 ;
border: none;
border-bottom: 1px solid #FC4445;
outline: none;
padding: 5px;

}

.input-group label {
margin-bottom: 5px;
color: #FC4445;
font-weight: bold ;

}
.addCancelBtn{
display: flex;
justify-content: space-between;
}
.addCancelBtn button{
margin: 20px;
}
.showVideo{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-left: 10px;
margin-right: 10px;
}
.btnShowVideo{
margin: 10px;
border-radius: 5px;
}
.mainShowVideos{
display: grid;
width: 100 vh;
grid-template-columns: repeat(3,1fr);
grid-template-rows: auto;
gap: 20px;
margin-left: auto;
margin-right: auto;
}
.thumbBtn{
background-color: transparent;
border: none;
}
90 changes: 85 additions & 5 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,92 @@
import React, {useState } from "react";
import { BrowserRouter as Router, Route, Routes, Link } from "react-router-dom";

import "./App.css";
import Videos from "./Videos.js";

function App() {

const [showVideos, setShowVideos] = useState(false);
const [loadData, setLoadData] = useState([]);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a more clear name than loadData you can think of for this state that describes what data is stored in this array?

Generally all apps deal with "data", so being specific can make things a lot more clear :)

Copy link
Author

Choose a reason for hiding this comment

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

Hi Daniel
thanks for your pieces of advice. I will try to do all of them.
here i changed loadData to loadVideo.


async function aseClickHandler(e) {
e.preventDefault();
try {
const response = await fetch(
"https://web-server-5nme.onrender.com/videos"
);
if (!response.ok) {
throw new Error("something went wrong");
}
const data = await response.json();
//asending acording to the rating
data.sort((a, b) => a.rating - b.rating);
return setLoadData(data);
} catch (error) {
console.error("Error fetching data:", error);
}
}

async function descClickHandler(e) {
Copy link
Member

Choose a reason for hiding this comment

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

This code looks a lot like the code in aseClickHandler - can you work out how to share code between them, rather than copying it?

Copy link
Author

Choose a reason for hiding this comment

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

you are right I fixed it.

e.preventDefault();
try {
const response = await fetch("https://web-server-5nme.onrender.com/videos");
Copy link
Member

Choose a reason for hiding this comment

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

Once you've loaded the data once, you probably don't actually need to load it again just to change the sort order - can you make this re-sort without fetching again?

Copy link
Author

Choose a reason for hiding this comment

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

I deleted fetch from the function.

if (!response.ok) {
throw new Error("something went wrong");
}
const data = await response.json();
//asending acording to the rating
data.sort((a, b) => b.rating - a.rating);
return setLoadData(data);
} catch (error) {
console.error("Error fetching data:", error);
}
}

return (
<div className="App">
<header className="App-header">
<h1>Video Recommendation</h1>
</header>
</div>
<Router>
<div className="App">
<header className="appHeader">
<h1 style={{ background: "#97CAEF", color: "black" }}>
Video Recommendation
</h1>
</header>
<nav className="nav">
<div className="orderBtn">
<p>order by rate : </p>
<button onClick={aseClickHandler}>ase</button>
<button onClick={descClickHandler}>desc</button>
</div>
<div style={{ backgroundColor: "#55BCC9" }}></div>
<Link
to="/videos"
style={{
color: "#FC4445",
marginLeft: 20,
textDecoration: "none",
fontWeight: "bold",
}}
onClick={() => setShowVideos(true)}
>
Videos
</Link>
</nav>
<Routes>
{" "}
<Route
path="/videos"
element={
<Videos
show={showVideos}
setShow={setShowVideos}
loadData={loadData}
setLoadData={setLoadData}
/>
}
/>
</Routes>
</div>
</Router>
);
}

Expand Down
Loading