diff --git a/src/pages/profiles/[faculty].astro b/src/pages/profiles/[faculty].astro index 3b99f1e..52de6cd 100644 --- a/src/pages/profiles/[faculty].astro +++ b/src/pages/profiles/[faculty].astro @@ -1,30 +1,77 @@ --- -import { type CollectionEntry, getCollection } from 'astro:content'; +import { type CollectionEntry, getCollection } from "astro:content"; +import ProfileCard from "../../layout/AlumniCardLayout.astro"; +import TwoColLayout from "../../layout/TwoColLayout.astro"; // This is a dynamic route that generates a page for every Markdown file in src/content/ // Read more about dynamic routes and this `getStaticPaths` function in the Astro docs: // https://docs.astro.build/en/core-concepts/routing/#dynamic-routes export async function getStaticPaths() { - const profiles = await getCollection('profiles'); + const profiles = await getCollection("profiles"); // todo: move the faculty list to global constants - const faculties = ['it', 'elx', 'cmp', 'se', 'civil']; - - return faculties.map(faculty => ({ - params: { - faculty - }, - props: { - profiles: profiles.filter((profile) => profile.data.program.toLowerCase() === faculty) - } - })); + const faculties = ["it", "elx", "cmp", "se", "civil"]; + + return faculties.map((faculty) => ({ + params: { + faculty, + }, + props: { + profiles: profiles.filter( + (profile) => profile.data.program.toLowerCase() === faculty, + ), + }, + })); } + const { faculty } = Astro.params; const { profiles } = Astro.props; --- -Showing from {faculty} + +
+

+ Profiles from {faculty.toUpperCase()} Department +

-{profiles.map((profile) => ( -
  • {profile.data.name}
  • -))} \ No newline at end of file + { + profiles.length === 0 ? ( +
    +

    No profiles to show.

    +

    + Do you want to add your or someone else's profile here? +

    + + Add Now + +
    + ) : ( +
    +
    + {profiles.map((profile) => ( + + ))} +
    +

    + Don’t see the profile you were looking for? + + Add Here + +

    +
    + ) + } +
    +
    diff --git a/src/pages/profiles/[year].astro b/src/pages/profiles/[year].astro index 3dafa45..f3852b6 100644 --- a/src/pages/profiles/[year].astro +++ b/src/pages/profiles/[year].astro @@ -1,30 +1,78 @@ --- -import { type CollectionEntry, getCollection } from 'astro:content'; +import { type CollectionEntry, getCollection } from "astro:content"; +import ProfileCard from "../../layout/AlumniCardLayout.astro"; +import TwoColLayout from "../../layout/TwoColLayout.astro"; // This is a dynamic route that generates a page for every Markdown file in src/content/ // Read more about dynamic routes and this `getStaticPaths` function in the Astro docs: // https://docs.astro.build/en/core-concepts/routing/#dynamic-routes export async function getStaticPaths() { const startYear = 2000; - const currentYear = (new Date()).getFullYear(); - const yearsRange = Array.from({ length: currentYear - startYear + 1 }, (_, i) => startYear + i); - const profiles = await getCollection('profiles'); + const currentYear = new Date().getFullYear(); + const yearsRange = Array.from( + { length: currentYear - startYear + 1 }, + (_, i) => startYear + i, + ); + const profiles = await getCollection("profiles"); - return yearsRange.map(year => ({ - params: { - year - }, - props: { - profiles: profiles.filter((profile) => profile.data.batch === year.toString()) - } - })); + return yearsRange.map((year) => ({ + params: { + year, + }, + props: { + profiles: profiles.filter( + (profile) => profile.data.batch === year.toString(), + ), + }, + })); } + const { year } = Astro.params; const { profiles } = Astro.props; --- -Showing from {year} + +
    +

    Profiles from {year} Batch

    -{profiles.map((profile) => ( -
  • {profile.data.name}
  • -))} \ No newline at end of file + { + profiles.length === 0 ? ( +
    +

    No profiles to show.

    +

    + Do you want to add your or someone else's profile here? +

    + + Add Now + +
    + ) : ( +
    +
    + {profiles.map((profile) => ( + + ))} +
    +

    + Don’t see the profile you were looking for? + + Add Here + +

    +
    + ) + } +
    +