Skip to content

Commit

Permalink
feat(Home): add Verified/Unverified Instructor label (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: Ethan Turner <[email protected]>
  • Loading branch information
jakeaturner and ethanaturner authored Mar 28, 2023
1 parent af6dce8 commit 38dc5be
Show file tree
Hide file tree
Showing 15 changed files with 1,471 additions and 1,132 deletions.
57 changes: 57 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
},
"devDependencies": {
"@types/date-and-time": "^0.13.0",
"@types/dompurify": "^3.0.0",
"@types/js-cookie": "^3.0.3",
"@types/marked": "^4.0.8",
"@types/node": "^18.14.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
Expand Down
102 changes: 0 additions & 102 deletions client/src/components/projects/ProjectCard/index.jsx

This file was deleted.

106 changes: 106 additions & 0 deletions client/src/components/projects/ProjectCard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React, { useEffect } from "react";
import { Link } from "react-router-dom";
import PropTypes from "prop-types";
import { Card, Popup, Icon, Button } from "semantic-ui-react";
import { format, parseISO } from "date-fns";
import { truncateString } from "../../util/HelperFunctions";
import ProjectProgressBar from "../ProjectProgressBar";
import "./ProjectCard.css";
import { Project } from "../../../types";

type ProjectCardProps = {
project: Project;
showPinButton?: boolean;
onPin?: (projectID: string) => void;
};
/**
* A UI component representing a Project and displaying its basic information and status.
*/
const ProjectCard = ({
project,
showPinButton = false,
onPin = () => {},
...props
}: ProjectCardProps) => {
let updateDate;
let updateTime;

if (project.updatedAt) {
const parsedDate = parseISO(project.updatedAt);
updateDate = format(parsedDate, "MM/dd/yy");
updateTime = format(parsedDate, "h:mm aa");
}

/**
* Activates the provided callback (if valid) when the user clicks the "Pin" button.
*/
const handlePinClick = () => {
if (typeof onPin === "function") {
onPin(project.projectID);
}
};

return (
<Card raised {...props}>
<div className="flex-col-div project-card-content">
<div className="flex-row-div">
<div className="flex-col-div project-card-title-column">
<Link
className="project-card-title"
to={`/projects/${project.projectID}`}
>
{truncateString(project.title, 100)}
</Link>
<span className="muted-text project-card-lastupdate">
Last updated {updateDate} at {updateTime}
</span>
</div>
<div className="flex-col-div">
{showPinButton && (
<Popup
content={<span>Add to your Pinned Projects</span>}
trigger={
<Button
color="blue"
onClick={handlePinClick}
icon
circular
size="small"
>
<Icon name="pin" />
</Button>
}
position="top center"
/>
)}
</div>
</div>
<div className="flex-row-div">
<div className="project-card-progress-container">
<ProjectProgressBar
progress={project.currentProgress || 0}
type="progress"
showPercent={false}
/>
</div>
<div className="project-card-progress-container">
<ProjectProgressBar
progress={project.peerProgress || 0}
type="peer"
showPercent={false}
/>
</div>
<div className="project-card-progress-container">
<ProjectProgressBar
progress={project.a11yProgress || 0}
type="a11y"
showPercent={false}
/>
</div>
</div>
</div>
</Card>
);
};

export default ProjectCard;
4 changes: 4 additions & 0 deletions client/src/screens/conductor/Home/Home.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
margin: 0 0 0 0.5em !important;
}

.home-unverified-label {
cursor: pointer;
}

/* Announcements */

.announcement:hover {
Expand Down
Loading

0 comments on commit 38dc5be

Please sign in to comment.