-
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.
changes to profile and explore sections, big push
- Loading branch information
Showing
31 changed files
with
712 additions
and
320 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,21 @@ | ||
import React, { useState } from 'react' | ||
import ExploreBottomNavBar from './ExploreBottomNavBar/ExploreBottomNavBar' | ||
import Filters from './Filters/Filters' | ||
import SearchBar from './SearchBar/SearchBar' | ||
import ExploreVideos from './ExploreVideos/ExploreVideos' | ||
|
||
function Explore() { | ||
const [tab, setTab] = useState('trending') | ||
const [sortBy, changeSortBy] = useState('desc') | ||
console.log({ tab }) | ||
return ( | ||
<div> | ||
<SearchBar changeTab={setTab} tab={tab} /> | ||
<Filters changeSortBy={changeSortBy} /> | ||
<ExploreVideos category={tab} sortBy={sortBy} /> | ||
<ExploreBottomNavBar /> | ||
</div> | ||
) | ||
} | ||
|
||
export default Explore |
1 change: 1 addition & 0 deletions
1
olympi-client/src/components/Explore/ExploreBottomNavBar/ExploreBottomNavBar.css
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,4 +1,5 @@ | ||
.ExploreBottomNavBarContainer{ | ||
z-index: 1; | ||
display: flex; | ||
height: 70px; | ||
background-color: #fafafa; | ||
|
39 changes: 16 additions & 23 deletions
39
olympi-client/src/components/Explore/ExploreBottomNavBar/ExploreBottomNavBar.js
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
93 changes: 62 additions & 31 deletions
93
olympi-client/src/components/Explore/ExploreVideos/ExploreVideos.js
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,42 +1,73 @@ | ||
import React from "react"; | ||
import MoreIcon from "@material-ui/icons/More"; | ||
import moment from 'moment'; | ||
import React, { useEffect, useState } from "react"; | ||
import "./ExploreVideos.css"; | ||
import axios from "axios" | ||
|
||
function ExploreVideos({ category, sortBy }) { | ||
const [videos, setVideos] = useState(null) | ||
const loadVideos = async () => { | ||
const { data } = await axios.get(`http://localhost:5000/videos/explore`, { | ||
params: { | ||
category, | ||
sortBy | ||
} | ||
} | ||
) | ||
setVideos(data); | ||
} | ||
useEffect(() => { | ||
loadVideos() | ||
}, [category, sortBy]); | ||
|
||
const updateVotes = (video) => { | ||
axios.post(`http://localhost:5000/videos/${video._id}/upvote`, { | ||
votes: video.votes ? video.votes + 1 : 1, | ||
}) | ||
.then(({ data }) => { | ||
const updatedVideos = videos.map((video) => { | ||
if (video._id === data._id) { | ||
return data | ||
} | ||
return video | ||
} | ||
) | ||
setVideos(updatedVideos) | ||
}) | ||
.catch((e) => console.log("error", e)) | ||
} | ||
|
||
function ExploreVideos() { | ||
return ( | ||
<div className="ExploreVideosContainer"> | ||
<div className="VideoSpace"> | ||
<div className="VideoTitle">username 10 May 2021</div> | ||
<img src="https://via.placeholder.com/250" alt=""></img> | ||
<div className="VidOptions"> | ||
<div> | ||
<img src="/assets/icons/upvotefull.svg" alt=""></img>2.3k | ||
</div> | ||
<MoreIcon /> | ||
</div> | ||
|
||
<div className="VideoTitle">username 10 May 2021</div> | ||
<img src="https://via.placeholder.com/250" alt=""></img> | ||
<div className="VidOptions"> | ||
<div> | ||
<img src="/assets/icons/upvotefull.svg" alt=""></img>2.3k | ||
</div> | ||
<MoreIcon /> | ||
</div> | ||
{ | ||
console.log("videos", videos) | ||
|
||
<div className="VideoTitle">username 10 May 2021</div> | ||
<img src="https://via.placeholder.com/250" alt=""></img> | ||
<div className="VidOptions"> | ||
<div> | ||
<img src="/assets/icons/upvotefull.svg" alt=""></img>2.3k | ||
} | ||
<div className="VideoSpace"> | ||
{videos && videos.map((video, index) => { | ||
const { creator_id: creator } = video | ||
return ( | ||
<div key={index}> | ||
<div className="VideoTitle">{creator.username} {moment(video.createdAt).format('LLL')}</div> | ||
<video width="320" height="240" controls> | ||
<source src={video.videoUrl} type="video/mp4" /> | ||
<source src={video.videoUrl} type="video/ogg" /> | ||
Your browser does not support the video tag. | ||
</video> | ||
<div className="VidOptions"> | ||
<div onClick={() => updateVotes(video)}> | ||
<img src="/assets/icons/upvotefull.svg" alt="upvote" />{video.votes ? video.votes : 0} | ||
</div> | ||
<MoreIcon /> | ||
</div> | ||
</div> | ||
<MoreIcon /> | ||
</div> | ||
</div> | ||
) | ||
})} | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
); | ||
} | ||
|
||
export default ExploreVideos; | ||
export default ExploreVideos; |
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.