diff --git a/frontend/src/app/NEW-course-library-page/page.tsx b/frontend/src/app/NEW-course-library-page/page.tsx new file mode 100644 index 000000000..ec4c8eaf1 --- /dev/null +++ b/frontend/src/app/NEW-course-library-page/page.tsx @@ -0,0 +1,35 @@ +// "use client"; +import Image from "next/image"; +import LandingPageContent from "@/components/LandingPageContent/LandingPageContent"; +import navbar from "@/assets/navbar.svg"; +import Sponsorships from "@/components/SponsorshipsSection/Sponsorships"; +import { Metadata } from "next"; +import { ItemList, WithContext } from "schema-dts"; +import { get } from "@/utils/request"; +import { Course, Courses } from "@/types/api"; +import SearchBar from "@/components/SearchBar/SearchBar"; + +export default async function CourseLibraryPage() { + const { courses: initialCourses } = (await get( + "/courses?offset=0", + )) as Courses; + + + return ( +
+ {/* TOP OF PAGE */} + {/* Title here */} +
+

+ Search Your Courses +

+
+ + {/* Course cards */} +
+ +
+ {/* BOTTOM OF PAGE */} +
+ ); +} diff --git a/frontend/src/app/NEW-landing-page/Features.tsx b/frontend/src/app/NEW-landing-page/Features.tsx new file mode 100644 index 000000000..23d12c93e --- /dev/null +++ b/frontend/src/app/NEW-landing-page/Features.tsx @@ -0,0 +1,7 @@ +export default function Features() { + return ( +
+

Featuress

+
+ ); +} \ No newline at end of file diff --git a/frontend/src/app/NEW-landing-page/Header.tsx b/frontend/src/app/NEW-landing-page/Header.tsx new file mode 100644 index 000000000..e1590acde --- /dev/null +++ b/frontend/src/app/NEW-landing-page/Header.tsx @@ -0,0 +1,7 @@ +export default function Header() { + return ( +
+

Header!

+
+ ); +} \ No newline at end of file diff --git a/frontend/src/app/NEW-landing-page/Sponsors.tsx b/frontend/src/app/NEW-landing-page/Sponsors.tsx new file mode 100644 index 000000000..734ed01d6 --- /dev/null +++ b/frontend/src/app/NEW-landing-page/Sponsors.tsx @@ -0,0 +1,7 @@ +export default function Sponsors() { + return ( +
+

Sponsors...

+
+ ); +} \ No newline at end of file diff --git a/frontend/src/app/NEW-landing-page/page.tsx b/frontend/src/app/NEW-landing-page/page.tsx new file mode 100644 index 000000000..b3fcb602c --- /dev/null +++ b/frontend/src/app/NEW-landing-page/page.tsx @@ -0,0 +1,86 @@ +import Image from "next/image"; +import LandingPageContent from "@/components/LandingPageContent/LandingPageContent"; +import navbar from "@/assets/navbar.svg"; +import OldSponsorships from "@/components/SponsorshipsSection/Sponsorships"; +import { Metadata } from "next"; +import { ItemList, WithContext } from "schema-dts"; +import { get } from "@/utils/request"; +import { Course, Courses } from "@/types/api"; +import NewSponsorships from "@/components/SponsorshipsSection/NewSponsorships"; + +// Metadata to assist SEO - provies metadata for HTML head section +export async function generateMetadata(): Promise { + return { + title: `Home | Unilectives - UNSW Course Reviews`, + description: `UNSW course reviews, ratings, and study tips. Unilectives is your one-stop shop for making informed course choices at UNSW.`, + }; +} + +export default async function LandingPage() { + // GET request for all courses + const { courses: initialCourses } = (await get( + "/courses?offset=0", + )) as Courses; + + // Generate metadata to help with SEO (inject via script in return) + const metaLD: WithContext = { + "@context": "https://schema.org", + "@type": "ItemList", + itemListElement: initialCourses.map((course: Course, index: number) => ({ + "@type": "ListItem", + position: index + 1, + item: { + "@type": "Course", + url: `//www.handbook.unsw.edu.au/undergraduate/courses/${new Date().getFullYear()}/${ + course.courseCode + }`, + name: course.title, + description: course.description, + provider: { + "@type": "CollegeOrUniversity", + name: "University of New South Wales", + sameAs: "https://www.unsw.edu.au/", + }, + aggregateRating: { + "@type": "AggregateRating", + ratingCount: course.reviewCount, + ratingValue: course.reviewCount === 0 ? 0 : course.overallRating, + bestRating: 5, + }, + offers: [ + { + "@type": "Offer", + category: "Paid", + }, + ], + hasCourseInstance: course.terms.map((term: number) => ({ + "@type": "CourseInstance", + courseMode: "Blended", + courseSchedule: { + "@type": "Schedule", + repeatCount: term === 0 ? 5 : 10, + repeatFrequency: "Weekly", + }, + })), + }, + })), + }; + + return ( +
+ {/* SCRIPT FOR SEO - do not touch*/} + + -
+
{children}
- + ); } diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index fb459b892..a14a5165b 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1,7 +1,7 @@ import Image from "next/image"; import LandingPageContent from "@/components/LandingPageContent/LandingPageContent"; import navbar from "@/assets/navbar.svg"; -import Sponsorships from "@/components/SponsorshipsSection/Sponsorships" +import Sponsorships from "@/components/SponsorshipsSection/Sponsorships"; import { Metadata } from "next"; import { ItemList, WithContext } from "schema-dts"; import { get } from "@/utils/request"; @@ -16,7 +16,7 @@ export async function generateMetadata(): Promise { export default async function Home() { const { courses: initialCourses } = (await get( - "/courses?offset=0" + "/courses?offset=0", )) as Courses; const metaLD: WithContext = { @@ -27,8 +27,9 @@ export default async function Home() { position: index + 1, item: { "@type": "Course", - url: `//www.handbook.unsw.edu.au/undergraduate/courses/${new Date().getFullYear()}/${course.courseCode - }`, + url: `//www.handbook.unsw.edu.au/undergraduate/courses/${new Date().getFullYear()}/${ + course.courseCode + }`, name: course.title, description: course.description, provider: { @@ -42,10 +43,12 @@ export default async function Home() { ratingValue: course.reviewCount === 0 ? 0 : course.overallRating, bestRating: 5, }, - offers: [{ - "@type": "Offer", - category: "Paid" - }], + offers: [ + { + "@type": "Offer", + category: "Paid", + }, + ], hasCourseInstance: course.terms.map((term: number) => ({ "@type": "CourseInstance", courseMode: "Blended", @@ -53,51 +56,72 @@ export default async function Home() { "@type": "Schedule", repeatCount: term === 0 ? 5 : 10, repeatFrequency: "Weekly", - } - })) - } + }, + })), + }, })), }; return ( -
+
{/* Landing page graphic */} landing page graphic + +
+ FOR DEVELOPMENT: To NEW landing page +
+
+ +
+ FOR DEVELOPMENT: To NEW course library page +
+
+ {/* Hero Section */}