Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
clearing up contributor page
Browse files Browse the repository at this point in the history
  • Loading branch information
katiegoines committed Jul 24, 2024
1 parent 8bacf0a commit bf32b7e
Show file tree
Hide file tree
Showing 151 changed files with 69 additions and 23 deletions.
Binary file added src/assets/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/favicon.ico
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmberDisplay_W_Bd.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmberDisplay_W_He.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmberDisplay_W_Lt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmberDisplay_W_Md.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmberDisplay_W_Rg.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_Bd.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_BdIt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_He.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_HeIt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_Lt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_LtIt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_Rg.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_RgIt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_SBd.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_SBdIt.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_Th.woff2
Binary file not shown.
Binary file added src/assets/fonts/AmazonEmber_W_ThIt.woff2
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/cover_images/swift-course.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/membership_website/7-key.png
Binary file added src/assets/images/mock_course_images/content.png
Binary file added src/assets/images/mock_course_images/delete.png
Binary file added src/assets/images/profile_images/aspittel.jpeg
Binary file added src/assets/images/profile_images/chnwamba.jpeg
Binary file added src/assets/images/profile_images/kyle.jpg
Binary file added src/assets/images/swift_course/launch-studio.png
Binary file added src/assets/learn-preview.jpg
2 changes: 2 additions & 0 deletions src/assets/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow:
3 changes: 3 additions & 0 deletions src/assets/scripts/aws-ux-shortbread-v1-0-14.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/assets/vercel.svg
2 changes: 1 addition & 1 deletion src/components/CardLayout/CardLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function CardLayout({
borderRadius="8px"
padding="0px 0px 0px 0px"
overflow="hidden"
src={course?.image}
src={course?.image.substring(6)}
alt={course?.imageAltText || ""}
></Image>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function ContributorLargeCustom(props) {
style={{
borderRadius: "50%",
}}
src={contributor?.profilePic}
src={contributor?.profilePic.substring(6)}
alt={`Profile picture`}
{...getOverrideProps(overrides, "Ellipse 15")}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function ContributorVerticalCustom(props) {
style={{
borderRadius: "50%",
}}
src={contributor?.profilePic}
src={contributor?.profilePic.substring(6)}
alt={`Profile picture`}
{...getOverrideProps(overrides, "Ellipse 15")}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default function ContributorHorizontal(props) {
style={{
borderRadius: "50%",
}}
src={contributor?.profilePic}
src={contributor?.profilePic.substring(6)}
alt={`Profile picture`}
{...getOverrideProps(overrides, "Ellipse 15")}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/HeroCourse/HeroCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function HeroCourse({ course, tags }: HeroCourseProps) {
width={{ base: "100%", large: "", xl: "100%" }}
height={{ base: "100%", large: "", xl: "100%" }}
objectFit={{ base: "cover", large: "contain", xl: "cover" }}
src={course.image}
src={course?.image.substring(6)}
alt={course.imageAltText || ""}
borderRadius="8px"
overflow="hidden"
Expand Down
39 changes: 31 additions & 8 deletions src/lib/getData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,32 @@ export async function getFeaturedCourseData(

export async function getCourseTags(
context: GetStaticPropsContext & Context,
courseId: string
courseId: string,
): Promise<Tag[]> {
const { DataStore } = withSSRContext(context);

const courseTags: CourseTag[] = await DataStore.query(CourseTag);
const filteredCourseTags = courseTags.filter(
async (e) => (await (e.course)).published && (await (e.course)).id === courseId
);
const filteredCourseTags = [];

for (const courseTag of courseTags) {
const course = await courseTag.course;

if (course.published && course.id === courseId) {
filteredCourseTags.push(courseTag)
}
}

const tagsList = [];

for (const filteredCourseTag of filteredCourseTags) {
const tag = await filteredCourseTag.tag;
const course = await filteredCourseTag.course;
const id = await filteredCourseTag.id;

tagsList.push({id, tag, course});
}

return filteredCourseTags.map((e) => e.tag);
return tagsList.map((e) => e.tag);
}

export async function getCardLayoutData(
Expand All @@ -62,7 +78,6 @@ export async function getCardLayoutData(

let courseTags: CourseTag[] = await DataStore.query(CourseTag);


// Go through and group up the tags to their respective courses
const groupedCourseTags: Record<string, CardLayoutData> = {};
for (const courseTag of courseTags) {
Expand Down Expand Up @@ -130,7 +145,6 @@ export async function getCourseAndLessonData(

return { course: courseResult, lessons: lessonsSorted };
}

return null;
}

Expand All @@ -141,8 +155,17 @@ export async function getCourseContributors(
const { DataStore } = withSSRContext(context);

const contributorCourses = await DataStore.query(ContributorCourse);
const resolvedCourses = [];

for (const contributorCourse of contributorCourses) {
const id = await contributorCourse.id;
const contributor = await contributorCourse.contributor;

const course = await contributorCourse.course;
resolvedCourses.push({id, contributor:contributor, course: course});
}

return contributorCourses
return resolvedCourses
.filter(filterFn)
.map((e: ContributorCourse) => e.contributor);
}
Expand Down
30 changes: 22 additions & 8 deletions src/pages/about/[contributor].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { withSSRContext } from "aws-amplify";
import { serializeModel, deserializeModel } from "@aws-amplify/datastore/ssr";
import { useRouter } from "next/router";
import { useCallback } from "react";
import { Contributor, ContributorCourse } from "../../models";
import { Contributor, ContributorCourse, LazyCourse } from "../../models";
import { CardLayoutCollection } from "../../components/CardLayoutCollection";
import { SocialMediaButton } from "../../components/SocialMediaButton";
import { capitalizeEnum } from "../../utils/capitalizeEnum";
Expand Down Expand Up @@ -216,7 +216,7 @@ export default function ContributorPage(data: {
style={{
borderRadius: "50%",
}}
src={contributor?.profilePic || ""}
src={contributor?.profilePic.substring(6) || ""}
alt={`Profile pic of ${contributor.firstName}`}
/>
</Flex>
Expand Down Expand Up @@ -385,15 +385,29 @@ export async function getStaticProps(
const contributorCoursesRelationships: ContributorCourse[] =
await DataStore.query(ContributorCourse);

const filteredCourses = contributorCoursesRelationships
.filter((e) => e.contributor.username === username)
.map((e) => e.course);
const resolvedContributorCourseRelationships = [];

for (const contributorCoursesRelationship of contributorCoursesRelationships) {
const contributor = await contributorCoursesRelationship.contributor;
const id = contributorCoursesRelationship.id;
const course = await contributorCoursesRelationship.course;

resolvedContributorCourseRelationships.push({id, course, contributor});
}

const filteredCourses = resolvedContributorCourseRelationships
.filter((e) => {
return e.contributor.username === username
})

const cardLayoutData = await getCardLayoutData(context);

const filteredCardLayoutData = cardLayoutData.filter((cardLayout) =>
filteredCourses.find((e) => e.id === cardLayout.course.id)
);
const filteredCardLayoutData = cardLayoutData.filter((cardLayout) => {
const filter = filteredCourses.find((e) => {
return e.course.id === cardLayout.course.id;
})
return filter;
});

const otherContributors = await DataStore.query(Contributor, (c: any) =>
c.username.ne(username)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/courses/[courseurltitle]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default function CoursePage(data: {
overflow="hidden"
width="100%"
maxHeight="350px"
src={course.image || ""}
src={course?.image.substring(6) || ""}
alt={course.imageAltText || ""}
borderRadius="8px"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/ui-components/CardLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function CardLayout(props) {
transform="rotate(0deg)"
borderRadius="8px"
padding="0px 0px 0px 0px"
src={course?.image}
src={course?.image.substring(6)}
alt={course?.imageAltText}
{...getOverrideProps(
overrides,
Expand Down

0 comments on commit bf32b7e

Please sign in to comment.