Skip to content

Commit c8da818

Browse files
committed
Refactoring
1 parent f58b950 commit c8da818

File tree

16 files changed

+22054
-41
lines changed

16 files changed

+22054
-41
lines changed

package-lock.json

Lines changed: 21980 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"react": "^17.0.2",
1717
"react-bootstrap": "^1.5.2",
1818
"react-dom": "^17.0.2",
19+
"react-helmet": "^6.1.0",
1920
"react-icons": "^4.2.0",
2021
"react-infinite-scroll-component": "^6.0.0",
2122
"react-lazy-load-image-component": "^1.5.1",

src/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import axios from "axios";
33
const request = axios.create({
44
baseURL: "https://youtube.googleapis.com/youtube/v3/",
55
params: {
6-
key: process.env.REACT_APP_YT_API_KEY,
6+
key: "AIzaSyBAvopHSYNnReInKoAwj71iOJ4uJED3NAg",
77
},
88
});
99

src/components/categoriesBar/_categoriesbar.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
white-space: nowrap;
2020
border: 1.5px solid $text-color;
2121
border-radius: 999px;
22+
cursor: pointer;
2223

2324
&:hover {
2425
background-color: #374a59;

src/components/comments/Comments.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const Comments = ({ videoId, totalComments }) => {
1616
}, [videoId, dispatch]);
1717

1818
const { loading, comments } = useSelector((state) => state.commentsList);
19+
const { photoUrl } = useSelector((state) => state.auth?.user);
1920

2021
const _comments = comments?.map(
2122
(comment) => comment.snippet.topLevelComment.snippet
@@ -35,7 +36,7 @@ const Comments = ({ videoId, totalComments }) => {
3536
<p>{totalComments} Comments</p>
3637
<div className="comments__form d-flex w-100 my-2">
3738
<img
38-
src="https://cdn.icon-icons.com/icons2/1736/PNG/512/4043260-avatar-male-man-portrait_113269.png"
39+
src={photoUrl}
3940
alt="avatar"
4041
className="rounded-circle mr-3"
4142
/>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from "react";
2+
import { Helmet } from "react-helmet";
3+
4+
const CustomHelmet = ({
5+
title = "Youtube Clone - SV",
6+
description = "A project with Youtube API and React JS",
7+
}) => {
8+
return (
9+
<Helmet>
10+
<title>{title}</title>
11+
<meta name='description' content={description} />
12+
<meta property='og:locale' content='en_US' />
13+
<meta property='og:type' content='website' />
14+
<meta property='og:title' content={title} />
15+
<meta property='og:description' content={description} />
16+
</Helmet>
17+
);
18+
};
19+
20+
export default CustomHelmet;

src/components/header/Header.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { FaBars } from "react-icons/fa";
55
import { AiOutlineSearch } from "react-icons/ai";
66
import { MdNotifications, MdApps } from "react-icons/md";
77
import { useHistory } from "react-router";
8+
import { useSelector } from "react-redux";
9+
import { Link } from "react-router-dom";
810

911
const Header = ({ handleToggleSidebar }) => {
1012
const [input, setInput] = useState("");
@@ -14,21 +16,25 @@ const Header = ({ handleToggleSidebar }) => {
1416
const handleSubmit = (e) => {
1517
e.preventDefault();
1618

17-
history.push(`/search/${input}`)
19+
history.push(`/search/${input}`);
1820
};
1921

22+
const { photoUrl } = useSelector((state) => state.auth?.user);
23+
2024
return (
2125
<div className="header">
2226
<FaBars
2327
className="header__menu"
2428
size={26}
2529
onClick={() => handleToggleSidebar()}
2630
/>
27-
<img
28-
src="http://pngimg.com/uploads/youtube/youtube_PNG2.png"
29-
alt="Youtube Logo"
30-
className="header__logo"
31-
/>
31+
<Link to="/">
32+
<img
33+
src="http://pngimg.com/uploads/youtube/youtube_PNG2.png"
34+
alt="Youtube Logo"
35+
className="header__logo"
36+
/>
37+
</Link>
3238
<form onSubmit={handleSubmit}>
3339
<input
3440
type="text"
@@ -44,10 +50,7 @@ const Header = ({ handleToggleSidebar }) => {
4450
<div className="header__icons">
4551
<MdNotifications size={28} />
4652
<MdApps size={28} />
47-
<img
48-
src="https://cdn.icon-icons.com/icons2/1736/PNG/512/4043260-avatar-male-man-portrait_113269.png"
49-
alt="avatar"
50-
/>
53+
<img src={photoUrl} alt="avatar" />
5154
</div>
5255
</div>
5356
);

src/components/sidebar/Sidebar.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ const Sidebar = ({ sidebar, handleToggleSidebar }) => {
2626
className={sidebar ? "sidebar open" : "sidebar"}
2727
onClick={() => handleToggleSidebar(false)}
2828
>
29-
<li>
30-
<MdHome size={23} />
31-
<span>Home</span>
32-
</li>
29+
<Link to="/">
30+
<li>
31+
<MdHome size={23} />
32+
<span>Home</span>
33+
</li>
34+
</Link>
3335

3436
<Link to="/feed/subscriptions">
3537
<li>
@@ -54,7 +56,7 @@ const Sidebar = ({ sidebar, handleToggleSidebar }) => {
5456
</li>
5557
<li>
5658
<MdSentimentDissatisfied size={23} />
57-
<span>Bhen 10</span>
59+
<span>Report Issue</span>
5860
</li>
5961

6062
<hr />

src/components/sidebar/_sidebar.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
top: 10vh;
1616
left: 0;
1717

18+
a {
19+
color: $text-color;
20+
&:hover {
21+
color: $text-color;
22+
text-decoration: none;
23+
}
24+
}
25+
1826
li {
1927
display: flex;
2028
align-items: center;

src/components/videoHorizontal/_videoHorizontal.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
&__left {
88
position: relative;
99
text-align: center;
10+
padding-left: 0 !important;
1011
}
1112

1213
&__thumbmnail {

0 commit comments

Comments
 (0)