Skip to content

Commit

Permalink
feat: approved paper details update thing
Browse files Browse the repository at this point in the history
  • Loading branch information
harshkhandeparkar committed Sep 25, 2024
1 parent bceda3d commit 28f14e0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/AdminDashboard/QPCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function QPCard({ qPaper, onEdit, onDelete }: IQPCardProps) {
}

return (
<div className="qp-card">
<div className={`qp-card ${qPaper.approve_status ? 'approved' : ''}`}>
<div className="qp-data">
<div className="course-name">
{`${qPaper.course_code} - ${qPaper.course_name}`}
Expand Down
15 changes: 14 additions & 1 deletion frontend/src/pages/AdminDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,23 @@ function AdminDashboard() {
filelink: new URL(qp.filelink).pathname, // TODO: PLEASE DO THIS IN THE BAKCEND AHHHH ITS CALLED FILELINK NOT FILEPATH DED
year: qp.year.toString()
}, auth.jwt);
console.log(response);

if (response.status === "success") {
toast.success(response.data.message);

setUnapprovedPapers((papers) => {
const newPapers = [...papers];

const selectedIndex = newPapers.indexOf(selectedQPaper!);
if (selectedIndex !== -1) {
newPapers[selectedIndex] = {
...qp,
approve_status: true
}
}

return newPapers;
})
} else {
toast.error(`Approve error: ${response.message} (${response.status_code})`);
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/styles/admin_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
.qp-card:nth-child(odd) {
background-color: $surface-1;
}

.qp-card.approved {
background-color: rgba($approved-color-darker, 0.16);
}
}
}
}

0 comments on commit 28f14e0

Please sign in to comment.