Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Krish2208 committed Sep 6, 2022
1 parent d086041 commit 7ab3a19
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
38 changes: 23 additions & 15 deletions frontend/src/Components/Dailyprob.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ function Dailyprob() {
const location = useLocation();
const dailyprob = location.state.dailyproblem;
const [posts, setPosts] = React.useState(dailyprob);
// React.useEffect(() => {
// axios.post("https://p-club-iiti-cp.herokuapp.com/getdailyproblems").then((res) => {
// if (res.status === 200) {
// setPosts(res.data.dailyproblems);
// }
// });
// }, []);
// React.useEffect(() => {
// axios.post("https://p-club-iiti-cp.herokuapp.com/getdailyproblems").then((res) => {
// if (res.status === 200) {
// setPosts(res.data.dailyproblems);
// }
// });
// }, []);
return (
<div>
<div className="container contpast">
<h3 className="upcomingContestHead mt-4" align="center">Today's Problems</h3>
<h3 className="upcomingContestHead mt-4" align="center">
Today's Problems
</h3>
<div className="card carddp container mt-4">
{posts.map((post, id) => {
const date = new Date(post.date);
Expand All @@ -32,25 +34,31 @@ function Dailyprob() {
<div className="dp" key={id}>
{id != 0 ? <hr /> : <></>}
<h3>Daily {post.name}</h3>
<a href="{post.link}"><button className="btnviewp">Solve Problem</button></a>
<a href={post.link} target={"_blank"}>
<button className="btnviewp">Solve Problem</button>
</a>
<p>{moment(date).format("DD-MM-YYYY")}</p>
</div>
);
);
} else {
return <></>;
}
})}
</div>
<h3 className="upcomingContestHead" align="center">Past Problems</h3>
<h3 className="upcomingContestHead" align="center">
Past Problems
</h3>
<div className="card carddp container mt-4">
{posts.map((post, id) => {
const date = new Date(post.date);
if (today.toDateString() !== date.toDateString()) {
if (today.toDateString() !== date.toDateString() && date < today) {
return (
<div className="dp" key={id}>
{id != 0 ? <hr /> : <></>}
<h3>Daily {post.name}</h3>
<a href="{post.link}"><button className="btnviewp">Solve Problem</button></a>
<a href={post.link} target={"_blank"}>
<button className="btnviewp">Solve Problem</button>
</a>
<p>{moment(date).fromNow()}</p>
</div>
);
Expand All @@ -59,8 +67,8 @@ function Dailyprob() {
}
})}
</div>
</div>
<div className="loginend"></div>
</div>
<div className="loginend"></div>
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function Navbar() {
</li>
{token ? (
<>
{/* <li className="nav-item">
<li className="nav-item">
<Link className="nav-link" to="/contests">Contests <span className="sr-only">(current)</span></Link>
</li> */}
</li>
<li className="nav-item">
<Link className="nav-link" to="/timeline">Schedule <span className="sr-only">(current)</span></Link>
</li>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Components/Yourprofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function Yourprofile() {
)}
</div>
</div>
{/* <hr style={{ color: "white" }} />
<hr style={{ color: "white" }} />
<div className="card">
<h2 className="stm upcomingContestHead" style={{fontWeight:"bold"}}>Daily Problem</h2>
<div className="card carddp container">
Expand Down Expand Up @@ -365,7 +365,7 @@ function Yourprofile() {
<></>
)}
</div>
</div> */}
</div>
</div>
<Footer />
</div>
Expand Down

0 comments on commit 7ab3a19

Please sign in to comment.