Skip to content

Commit

Permalink
Run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Ascent817 committed Dec 11, 2023
1 parent 8ae7415 commit bfe3d97
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 27 deletions.
8 changes: 5 additions & 3 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ ion-icon {
color: var(--primary);
}

.navigation ul li a .icon, .navigation ul li button .icon {
.navigation ul li a .icon,
.navigation ul li button .icon {
align-items: center;
display: flex;
height: 65.5px;
Expand All @@ -137,7 +138,8 @@ ion-icon {
text-align: center;
}

.navigation ul li a .icon ion-icon, .navigation ul li button .icon ion-icon {
.navigation ul li a .icon ion-icon,
.navigation ul li button .icon ion-icon {
font-size: 1.75rem;
}

Expand Down Expand Up @@ -281,7 +283,7 @@ ion-icon {

.Course:target {
box-shadow: rgba(141, 22, 38, 0.5) 0px 6px 24px 0px,
rgba(203, 32, 55, 0.75) 0px 0px 0px 2px;
rgba(203, 32, 55, 0.75) 0px 0px 0px 2px;
transition: all 0.5s ease 0s;
}

Expand Down
5 changes: 2 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ interface AppProps {
authLevel: number;
}

const App: FC<AppProps> = ({user, classItems, authLevel }): JSX.Element => {

const App: FC<AppProps> = ({ user, classItems, authLevel }): JSX.Element => {
// Hacky workaround because something with React probably interferes with the default browser behavior
// Also, reactivates the highlight on the course element
useEffect(() => {
const jumpId = window.location.hash;
window.location.hash = '';
window.location.hash = jumpId;
}, []);

const handleContactModalOpen = useCallback(() => {
const contactModal = document.getElementById(
'contact-modal'
Expand Down
42 changes: 26 additions & 16 deletions src/components/Course.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,19 @@ export const Course: FC<CourseProps> = ({
const isVenture = course.tags?.filter((tag) => tag === 'Venture').length;

const Style = {
gridRow: `span ${course.courses?.match(/[A-Z][A-Z][A-Z][0-9][0-9][0-9]/gm)?.length ?? 1}`,
gridRow: `span ${
course.courses?.match(/[A-Z][A-Z][A-Z][0-9][0-9][0-9]/gm)?.length ?? 1
}`,
backgroundColor: isVenture ? 'var(--primary-light)' : '',
};

return (
<div suppressContentEditableWarning className="Course" id={jumpId} style={Style}>
<div
suppressContentEditableWarning
className="Course"
id={jumpId}
style={Style}
>
<h1 className="course-title">{course.coursename}</h1>
<br />
<p
Expand Down Expand Up @@ -266,20 +273,23 @@ export const Course: FC<CourseProps> = ({
<b contentEditable={false}>Courses: </b>
{course.courses}
</p>
{course.courses.match(/[A-Z][A-Z][A-Z][0-9][0-9][0-9]/gm)?.filter((id) => courseIDtoCourse(id)).map((id) => {
return (
<>
<br />
<Course
key={id}
authLevel={authLevel}
course={courseIDtoCourse(id)}
jumpId={id}
courseIDtoCourse={courseIDtoCourse}
/>
</>
);
})}
{course.courses
.match(/[A-Z][A-Z][A-Z][0-9][0-9][0-9]/gm)
?.filter((id) => courseIDtoCourse(id))
.map((id) => {
return (
<>
<br />
<Course
key={id}
authLevel={authLevel}
course={courseIDtoCourse(id)}
jumpId={id}
courseIDtoCourse={courseIDtoCourse}
/>
</>
);
})}
<br />
</>
)}
Expand Down
19 changes: 14 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ const renderDOM = (courseItems: JSX.Element[], userData = user): void => {
numColumns = 1;
}

let flexParents = Array(numColumns).fill(0).map((_, i) => <div key={i} className="flex-parent">{courseItems.filter((_, j) => j % numColumns === i)}</div>);
let flexParents = Array(numColumns)
.fill(0)
.map((_, i) => (
<div key={i} className="flex-parent">
{courseItems.filter((_, j) => j % numColumns === i)}
</div>
));

ReactDOM.render(
<React.StrictMode>
Expand Down Expand Up @@ -101,9 +107,11 @@ const initializeCourseViewer = (): void => {

const courseIDtoNameMap = new Map<string, string>();
for (const courseName in courseData) {
courseData[courseName].courseid.match(/[A-Z][A-Z][A-Z][0-9][0-9][0-9]/)?.forEach((id) => {
courseIDtoNameMap.set(id, courseName);
});
courseData[courseName].courseid
.match(/[A-Z][A-Z][A-Z][0-9][0-9][0-9]/)
?.forEach((id) => {
courseIDtoNameMap.set(id, courseName);
});
}

console.log(courseIDtoNameMap);
Expand Down Expand Up @@ -250,7 +258,8 @@ export const filterCourses = (): void => {
courseIDtoNameMap.set(courseData[courseName].courseid, courseName);
}

const courseIDtoCourse = (courseID: string): CourseType => courseData[courseIDtoNameMap.get(courseID) ?? ''] ?? '';
const courseIDtoCourse = (courseID: string): CourseType =>
courseData[courseIDtoNameMap.get(courseID) ?? ''] ?? '';

const key = search?.value.toLowerCase().replaceAll(' ', '-');
const renderedElements = renderedItems
Expand Down

0 comments on commit bfe3d97

Please sign in to comment.