PR feedback
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
4828069800
commit
7ceffc3ba0
|
@ -104,7 +104,13 @@ export async function getUpcomingEvents(): Promise<Event[]> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getProps(year: string, term: string): Promise<Props> {
|
export async function getEventsPageProps({
|
||||||
|
year,
|
||||||
|
term,
|
||||||
|
}: {
|
||||||
|
year: string;
|
||||||
|
term: string;
|
||||||
|
}): Promise<Props> {
|
||||||
const eventNames = await getEventsByTerm(year, term);
|
const eventNames = await getEventsByTerm(year, term);
|
||||||
|
|
||||||
const events: Event[] = (
|
const events: Event[] = (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { Link } from "@/components/Link";
|
||||||
import { MiniEventCard } from "@/components/MiniEventCard";
|
import { MiniEventCard } from "@/components/MiniEventCard";
|
||||||
import {
|
import {
|
||||||
Event,
|
Event,
|
||||||
getProps,
|
getEventsPageProps,
|
||||||
getEventYears,
|
getEventYears,
|
||||||
getEventTermsByYear,
|
getEventTermsByYear,
|
||||||
} from "@/lib/events";
|
} from "@/lib/events";
|
||||||
|
@ -61,7 +61,7 @@ export default function Term(props: Props) {
|
||||||
key={link.year + link.term}
|
key={link.year + link.term}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<Link href="/events/archives">Archives</Link>
|
<Link href="/events/archive">Archive</Link>
|
||||||
</div>
|
</div>
|
||||||
{hasFutureEvents && (
|
{hasFutureEvents && (
|
||||||
<>
|
<>
|
||||||
|
@ -88,6 +88,14 @@ export default function Term(props: Props) {
|
||||||
</span>
|
</span>
|
||||||
</h2>
|
</h2>
|
||||||
)}
|
)}
|
||||||
|
{!hasFutureEvents && !hasPastEvents && (
|
||||||
|
<>
|
||||||
|
<h2>Events</h2>
|
||||||
|
There are no upcoming or past events for the{" "}
|
||||||
|
{`${capitalize(props.term)} ${props.year}`} term. Please check back
|
||||||
|
later!
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<div className={styles.miniEventCards}>
|
<div className={styles.miniEventCards}>
|
||||||
{props.pastEvents.map(({ content, metadata }) => (
|
{props.pastEvents.map(({ content, metadata }) => (
|
||||||
<MiniEventCard
|
<MiniEventCard
|
||||||
|
@ -125,9 +133,7 @@ export const getStaticProps: GetStaticProps<Props, Params> = async (
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
const { year, term } = context.params!;
|
return { props: await getEventsPageProps(context.params!) };
|
||||||
|
|
||||||
return { props: await getProps(year, term) };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getStaticPaths: GetStaticPaths<Params> = async () => {
|
export const getStaticPaths: GetStaticPaths<Params> = async () => {
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { GetStaticProps } from "next";
|
import { GetStaticProps } from "next";
|
||||||
|
|
||||||
import { getCurrentTerm, getProps } from "@/lib/events";
|
import { getCurrentTerm, getEventsPageProps } from "@/lib/events";
|
||||||
|
|
||||||
import Term, { Props } from "./[year]/[term]/index";
|
import Term, { Props } from "./[year]/[term]/index";
|
||||||
|
|
||||||
export default Term;
|
export default Term;
|
||||||
|
|
||||||
export const getStaticProps: GetStaticProps<Props> = async () => {
|
export const getStaticProps: GetStaticProps<Props> = async () => {
|
||||||
const curTerm = getCurrentTerm();
|
return { props: await getEventsPageProps(getCurrentTerm()) };
|
||||||
return { props: await getProps(curTerm.year, curTerm.term) };
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue