Skip to content

Commit

Permalink
fix: fixes all linting warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
calisio committed Aug 7, 2024
1 parent c085026 commit 2805242
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 158 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ If you would like to contribute, please have a look at our [contribution guideli
- Clone the repository
- `cp .env.example .env && cp frontend/.env.example frontend/.env`
- run `make help` for complete instructions
- run `cd frontend && yarn prepare`

**For frontend development:**

Expand Down
108 changes: 51 additions & 57 deletions frontend/src/Components/CatalogCourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,65 +90,59 @@ export default function CatalogCourseCard({
return <GreyPill key={"outcome" + course.program_id}>{pillLabel}</GreyPill>;
});

return (
<>
{view == ViewType.List ? (
<a
className="card bg-base-teal body-small p-6 flex flex-row items-center"
href={course.external_url}
target="_blank"
>
<div className="flex flex-col justify-between gap-3">
<div className="flex flex-row gap-3 items-center">
<div onClick={(e) => updateFavorite(e)}>{bookmark}</div>
<h2>{course.program_name}</h2>
<p className="body">|</p>
<p className="body">{course.provider_name}</p>
{programPill}
{outcomePills}
</div>
<p className="body-small h-[1rem] line-clamp-2 overflow-hidden">
{course.description}
</p>
if (view == ViewType.List)
return (
<a
className="card bg-base-teal body-small p-6 flex flex-row items-center"
href={course.external_url}
target="_blank"
>
<div className="flex flex-col justify-between gap-3">
<div className="flex flex-row gap-3 items-center">
<div onClick={(e) => updateFavorite(e)}>{bookmark}</div>
<h2>{course.program_name}</h2>
<p className="body">|</p>
<p className="body">{course.provider_name}</p>
{programPill}
{outcomePills}
</div>
</a>
) : (
<div className="card card-compact bg-base-teal overflow-hidden relative">
<div
className="absolute top-2 right-2"
onClick={(e) => updateFavorite(e)}
>
{bookmark}
<p className="body-small h-[1rem] line-clamp-2 overflow-hidden">
{course.description}
</p>
</div>
</a>
);
return (
<div className="card card-compact bg-base-teal overflow-hidden relative">
<div
className="absolute top-2 right-2"
onClick={(e) => updateFavorite(e)}
>
{bookmark}
</div>
<a href={course.external_url} target="_blank" rel="noopener noreferrer">
<figure className="h-[124px]">
{coverImage !== "" ? (
<img
src={coverImage}
// TO DO: add in alt text here
alt=""
className="object-contain"
/>
) : (
<div className="bg-teal-1 h-full w-full"></div>
)}
</figure>
<div className="card-body gap-0.5">
{/* this should be the school or program that offers the course */}
<p className="text-xs">{course.provider_name}</p>
<h3 className="card-title text-sm">{course.program_name}</h3>
<p className="body-small line-clamp-2">{course.description}</p>
<div className="flex flex-wrap py-1 mt-2 space-y-2">
{programPill} {outcomePills}
</div>
<a
href={course.external_url}
target="_blank"
rel="noopener noreferrer"
>
<figure className="h-[124px]">
{coverImage !== "" ? (
<img
src={coverImage}
// TO DO: add in alt text here
alt=""
className="object-contain"
/>
) : (
<div className="bg-teal-1 h-full w-full"></div>
)}
</figure>
<div className="card-body gap-0.5">
{/* this should be the school or program that offers the course */}
<p className="text-xs">{course.provider_name}</p>
<h3 className="card-title text-sm">{course.program_name}</h3>
<p className="body-small line-clamp-2">{course.description}</p>
<div className="flex flex-wrap py-1 mt-2 space-y-2">
{programPill} {outcomePills}
</div>
</div>
</a>
</div>
)}
</>
</a>
</div>
);
}
162 changes: 80 additions & 82 deletions frontend/src/Components/EnrolledCourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,95 +43,93 @@ export default function EnrolledCourseCard({
});
}

return (
<>
{view == ViewType.List ? (
<a
className="card bg-inner-background flex flex-row items-center justify-between body-small p-6"
href={url}
target="_blank"
rel="noopener noreferrer"
>
<div className="flex flex-row gap-3 items-center">
<div onClick={(e) => updateFavorite(e)}>
{!recent &&
(course.is_favorited ? (
<StarIcon className="h-5 text-primary-yellow"></StarIcon>
) : (
<StarIconOutline className="h-5 text-header-text"></StarIconOutline>
))}
</div>
<h2>{course.program_name}</h2>
<p className="body">|</p>
<p className="body">{course.provider_platform_name}</p>
</div>
{status == CourseStatus.Completed ? (
<div className="flex flex-row gap-2 body-small text-teal-3">
<CheckCircleIcon className="h-4" /> Course Completed
</div>
) : status == CourseStatus.Pending ? (
<div className="flex flex-row gap-2 body-small text-dark-yellow">
<ClockIcon className="h-4" /> Course Pending
</div>
) : (
<div className="w-1/3">
<ProgressBar percent={Math.floor(course.course_progress)} />
</div>
)}
</a>
) : (
<div
className={`card card-compact ${recent ? "bg-inner-background" : "bg-base-teal"} overflow-hidden relative`}
>
<div
className="absolute top-2 right-2"
onClick={(e) => updateFavorite(e)}
>
if (view == ViewType.List)
return (
<a
className="card bg-inner-background flex flex-row items-center justify-between body-small p-6"
href={url}
target="_blank"
rel="noopener noreferrer"
>
<div className="flex flex-row gap-3 items-center">
<div onClick={(e) => updateFavorite(e)}>
{!recent &&
(course.is_favorited ? (
<StarIcon className="h-5 text-primary-yellow"></StarIcon>
) : (
<StarIconOutline className="h-5 text-white"></StarIconOutline>
<StarIconOutline className="h-5 text-header-text"></StarIconOutline>
))}
</div>
<a href={url} target="_blank" rel="noopener noreferrer">
<figure className="h-[124px]">
{coverImage !== "" ? (
<img
src={coverImage}
// TO DO: add in alt text here
alt=""
className="object-cover w-full h-full"
/>
) : (
<div className="bg-teal-1 h-full w-full"></div>
)}
</figure>
<div className="card-body gap-0.5">
<p className="text-xs line-clamp-1">
{course.provider_platform_name}
</p>
<h3 className="card-title text-sm h-10 line-clamp-2">
{course.alt_name && course.alt_name + " - "}
{course.program_name}
</h3>
<div className="mt-3 justify-end">
{status == CourseStatus.Completed ? (
<div className="flex flex-row gap-2 body-small text-teal-3">
<CheckCircleIcon className="h-4" /> Course Completed
</div>
) : status == CourseStatus.Pending ? (
<div className="flex flex-row gap-2 body-small text-dark-yellow">
<ClockIcon className="h-4" /> Course Pending
</div>
) : (
<ProgressBar percent={Math.floor(course.course_progress)} />
)}
<h2>{course.program_name}</h2>
<p className="body">|</p>
<p className="body">{course.provider_platform_name}</p>
</div>
{status == CourseStatus.Completed ? (
<div className="flex flex-row gap-2 body-small text-teal-3">
<CheckCircleIcon className="h-4" /> Course Completed
</div>
) : status == CourseStatus.Pending ? (
<div className="flex flex-row gap-2 body-small text-dark-yellow">
<ClockIcon className="h-4" /> Course Pending
</div>
) : (
<div className="w-1/3">
<ProgressBar percent={Math.floor(course.course_progress)} />
</div>
)}
</a>
);
return (
<div
className={`card card-compact ${recent ? "bg-inner-background" : "bg-base-teal"} overflow-hidden relative`}
>
<div
className="absolute top-2 right-2"
onClick={(e) => updateFavorite(e)}
>
{!recent &&
(course.is_favorited ? (
<StarIcon className="h-5 text-primary-yellow"></StarIcon>
) : (
<StarIconOutline className="h-5 text-white"></StarIconOutline>
))}
</div>
<a href={url} target="_blank" rel="noopener noreferrer">
<figure className="h-[124px]">
{coverImage !== "" ? (
<img
src={coverImage}
// TO DO: add in alt text here
alt=""
className="object-cover w-full h-full"
/>
) : (
<div className="bg-teal-1 h-full w-full"></div>
)}
</figure>
<div className="card-body gap-0.5">
<p className="text-xs line-clamp-1">
{course.provider_platform_name}
</p>
<h3 className="card-title text-sm h-10 line-clamp-2">
{course.alt_name && course.alt_name + " - "}
{course.program_name}
</h3>
<div className="mt-3 justify-end">
{status == CourseStatus.Completed ? (
<div className="flex flex-row gap-2 body-small text-teal-3">
<CheckCircleIcon className="h-4" /> Course Completed
</div>
) : status == CourseStatus.Pending ? (
<div className="flex flex-row gap-2 body-small text-dark-yellow">
<ClockIcon className="h-4" /> Course Pending
</div>
</div>
</a>
) : (
<ProgressBar percent={Math.floor(course.course_progress)} />
)}
</div>
</div>
)}
</>
</a>
</div>
);
}
31 changes: 14 additions & 17 deletions frontend/src/Components/MilestonesBarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,22 @@ const MilestonesBarChart = ({ data }: { data: any }) => {
const maxYAxisLabel = (props) => {
const { x, y, payload } = props;
const name = payload.value;
return (
<>
{name.length > 10 ? (
<>
<text x={x} y={y + 1} textAnchor="end" fontSize={10} fill="#666">
{name.slice(0, 11)}
</text>
<text x={x} y={y + 15} textAnchor="end" fontSize={10} fill="#666">
{name.length > 20
? name.slice(11, 20) + "..."
: name.slice(11, 20)}
</text>
</>
) : (
if (name.length > 10) {
return (
<>
<text x={x} y={y + 1} textAnchor="end" fontSize={10} fill="#666">
{name}
{name.slice(0, 11)}
</text>
<text x={x} y={y + 15} textAnchor="end" fontSize={10} fill="#666">
{name.length > 20 ? name.slice(11, 20) + "..." : name.slice(11, 20)}
</text>
)}
</>
</>
);
}
return (
<text x={x} y={y + 1} textAnchor="end" fontSize={10} fill="#666">
{name}
</text>
);
};

Expand Down
1 change: 1 addition & 0 deletions frontend/src/Components/ResourcesSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ExternalLink = ({ children, url }: { children: any; url: string }) => {
className="flex gap-2 body-small text-body-text items-center"
href={url}
target="_blank"
rel="noreferrer"
>
<ArrowTopRightOnSquareIcon className="w-4" />
{children}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/WeeklyActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const WeekActivityChart = ({ data }: { data: any }) => {
var gridColor = theme == "light" ? "#ECECEC" : "#737373";
var backgroundColor = theme == "light" ? "#FFFFFF" : "#0F2926";

const result: RecentActivity[] = new Array(7);
const result: RecentActivity[] = Array.from({ length: 7 });
let currentDate = new Date();

for (let i = 6; i >= 0; i--) {
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/Pages/StudentDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export default function StudentDashboard() {
<ul className="space-y-3 mt-3">
{data.top_programs.map((name: string) => {
return (
<li className="body-small flex flex-row gap-2 content-center">
<li
className="body-small flex flex-row gap-2 content-center"
key={name}
>
<AcademicCapIcon className="w-4" />
<p className="line-clamp-1">{name}</p>
</li>
Expand Down

0 comments on commit 2805242

Please sign in to comment.