-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
features: live chat and infinite scroll
- Loading branch information
Showing
37 changed files
with
1,067 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
API_KEY = | ||
REACT_APP_YOUTUBE_API = "https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular®ionCode=US&key=[YOUR_API_KEY]" | ||
REACT_APP_OFFSET_LIVE_CHAT = | ||
REACT_APP_YOUTUBE_VIDEOS_API = "https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&chart=mostPopular®ionCode=US&key=[YOUR_API_KEY]" | ||
REACT_APP_YOUTUBE_VIDEO_API = "https://youtube.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails%2Cstatistics&id=Ks-_Mh1QhMc&key=[YOUR_API_KEY]" | ||
REACT_APP_YOUTUBE_SEARCH_SUGGESTIONS_API = "http:https://suggestqueries.google.com/complete/search?client=firefox&ds=yt&q=Query" | ||
REACT_APP_YOUTUBE_CHANNEL_API = "https://youtube.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&id=UC_x5XG1OV2P6uZZ5FSM9Ttw&key=[YOUR_API_KEY]" | ||
REACT_APP_YOUTUBE_SEARCH_API = "https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&q=surfing&key=[YOUR_API_KEY]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import { getChannelData } from "../fetchData/getChannelData"; | ||
import NumberFormatter from "./NumberFormatter"; | ||
|
||
const Channel = ({ channelId }) => { | ||
const [channelData, setChannelData] = useState([]); | ||
useEffect(() => { | ||
getChannelData(channelId, setChannelData); | ||
// eslint-disable-next-line | ||
}, []); | ||
|
||
return ( | ||
<div className="flex gap-2 items-center"> | ||
<img | ||
className="w-12 h-12 rounded-full" | ||
src={channelData?.snippet?.thumbnails?.medium.url} | ||
alt="" | ||
/> | ||
|
||
<div className="flex flex-col"> | ||
<p className=" font-semibold ">{channelData?.snippet?.title}</p> | ||
<p className=" text-[14px] text-[#606060]"> | ||
<NumberFormatter number={channelData?.statistics?.subscriberCount} /> | ||
subscribers | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Channel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react"; | ||
|
||
const ChatMessages = ({ index, name, message }) => { | ||
return ( | ||
<div className=" flex px-3 py-1 hover:bg-gray-200"> | ||
<div className=" w-6"> | ||
<svg | ||
xmlns="http:https://www.w3.org/2000/svg" | ||
viewBox="0 0 24 24" | ||
fill="currentColor" | ||
className="w-6 h-6 cursor-pointer" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M18.685 19.097A9.723 9.723 0 0 0 21.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 0 0 3.065 7.097A9.716 9.716 0 0 0 12 21.75a9.716 9.716 0 0 0 6.685-2.653Zm-12.54-1.285A7.486 7.486 0 0 1 12 15a7.486 7.486 0 0 1 5.855 2.812A8.224 8.224 0 0 1 12 20.25a8.224 8.224 0 0 1-5.855-2.438ZM15.75 9a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
</div> | ||
<p className=" font-bold px-2">{name}</p> | ||
<p>{message}</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ChatMessages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
|
||
const Comment = ({ data }) => { | ||
const { username, comment } = data; | ||
return ( | ||
<div className="flex items-start p-2 bg-gray-200 rounded-xl mb-1"> | ||
<div className="m-2"> | ||
<svg | ||
xmlns="http:https://www.w3.org/2000/svg" | ||
viewBox="0 0 24 24" | ||
fill="currentColor" | ||
className="w-10 h-10" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M18.685 19.097A9.723 9.723 0 0 0 21.75 12c0-5.385-4.365-9.75-9.75-9.75S2.25 6.615 2.25 12a9.723 9.723 0 0 0 3.065 7.097A9.716 9.716 0 0 0 12 21.75a9.716 9.716 0 0 0 6.685-2.653Zm-12.54-1.285A7.486 7.486 0 0 1 12 15a7.486 7.486 0 0 1 5.855 2.812A8.224 8.224 0 0 1 12 20.25a8.224 8.224 0 0 1-5.855-2.438ZM15.75 9a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
</div> | ||
<div className=" py-2"> | ||
<p className=" text-sm font-medium">{username}</p> | ||
<p>{comment}</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Comment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import Comment from "./Comment"; | ||
|
||
const CommentsList = ({ comments }) => { | ||
return comments.map((comment) => ( | ||
<div key={comment.username}> | ||
<Comment data={comment} /> | ||
<div className="ml-5 border-l border-l-black pl-2"> | ||
<CommentsList comments={comment.replies} /> | ||
</div> | ||
</div> | ||
)); | ||
}; | ||
|
||
export default CommentsList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
|
||
const ErrorPage = ({ error }) => { | ||
return ( | ||
<div className="flex mt-20 justify-center items-center"> | ||
<div> | ||
<p className=" text-2xl sm:text-5xl font-bold mb-2"> | ||
{error.code} error | ||
</p> | ||
<p className=" text-lg sm:text-xl">{error.message}</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ErrorPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.