-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from brown-ccv/feat-workday-api
Feat: workday api within about page
- Loading branch information
Showing
15 changed files
with
699 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,37 @@ | ||
export default function About() { | ||
return <div>About</div> | ||
import { Opportunities } from "@/components/Opportunities" | ||
import { getWorkdayData } from "@/app/about/queries" | ||
import { UserPlusIcon } from "@heroicons/react/24/solid" | ||
import SectionHeader from "@/components/SectionHeader" | ||
import Spinner from "@/components/assets/Spinner" | ||
import Link from "next/link" | ||
import React, { Suspense } from "react" | ||
|
||
export default async function About() { | ||
try { | ||
const data = getWorkdayData() | ||
return ( | ||
<div> | ||
<SectionHeader | ||
href={"#opportunities"} | ||
title={"Opportunities"} | ||
icon={<UserPlusIcon className="h-7 w-7" />} | ||
/> | ||
<Suspense fallback={<Spinner />}> | ||
<Opportunities data={data} /> | ||
</Suspense> | ||
</div> | ||
) | ||
} catch (err: any) { | ||
console.error(err) | ||
return ( | ||
<div> | ||
<SectionHeader | ||
href={"#opportunities"} | ||
title={"Opportunities"} | ||
icon={<UserPlusIcon className="h-7 w-7" />} | ||
/> | ||
<p>{err.message}</p> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export async function getWorkdayData() { | ||
const myHeaders = new Headers() | ||
myHeaders.append("Content-Type", "application/json") | ||
myHeaders.append( | ||
"Cookie", | ||
"PLAY_SESSION=9365d69619d226b22f74256e51894a0476197a1f-instance=vps-prod-tvvtdnej.prod-vps.pr501.cust.pdx.wd; __cf_bm=zYtKNPBpg6veqmLc2qdk_TeHEGdGWIcSRG9tdtkQNbQ-1721323439-1.0.1.1-TApbCV1fQKTtEauZKvZ5XnXrZQJL7dcML6ixA3AycoiBMROa.iAzMq_K.5E7iaZfCj9.WhQQlmYfAxW8wdwZgQ; __cflb=02DiuHJZe28xXz6hQKLf1exjNbMDM5uxekNnt7kFV7LUC; _cfuvid=hqIGrDcFihah5EiFO0c_HEM4gIPwkeWCOxjMxNqjR20-1721323439159-0.0.1.1-604800000; wd-browser-id=fc0f0b1d-4547-488d-b353-99c751c61dae; wday_vps_cookie=1122671626.53810.0000" | ||
) | ||
|
||
const raw = JSON.stringify({ | ||
limit: 20, | ||
offset: 0, | ||
appliedFacets: {}, | ||
searchText: "180 George Street", | ||
}) | ||
|
||
const response = await fetch( | ||
"https://brown.wd5.myworkdayjobs.com/wday/cxs/brown/staff-careers-brown/jobs", | ||
{ | ||
method: "POST", | ||
headers: myHeaders, | ||
body: raw, | ||
} | ||
) | ||
const json = await response.json() | ||
return json | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,57 @@ | ||
import EventSection from "@/components/EventSection" | ||
import { getEventData } from "@/app/queries" | ||
import { getStringDate } from "@/components/calendar/utils" | ||
import SectionHeader from "@/components/SectionHeader" | ||
import React, { Suspense } from "react" | ||
import Spinner from "@/components/assets/Spinner" | ||
|
||
export default function Home() { | ||
return ( | ||
<main className="bg-white flex min-h-screen flex-col items-center justify-between p-0 lg:p-24"> | ||
<EventSection /> | ||
</main> | ||
) | ||
export default async function Home() { | ||
try { | ||
const currentDate = new Date() | ||
const today = getStringDate( | ||
currentDate.getMonth() + 1, | ||
currentDate.getDate(), | ||
currentDate.getFullYear() | ||
) | ||
const futureDates = getEventData(today) | ||
const pastDates = getEventData(`-2 months${today}`) | ||
|
||
return ( | ||
<div className="px-2 my-6 space-y-2"> | ||
<SectionHeader href={"#events"} title={"Events"} /> | ||
<Suspense fallback={<Spinner />}> | ||
<EventSection | ||
streamedDataPast={pastDates} | ||
streamedDataFuture={futureDates} | ||
currentDate={currentDate} | ||
today={today} | ||
/> | ||
</Suspense> | ||
<div className="flex justify-center"> | ||
<a | ||
className="bg-secondary-blue-500 text-white p-4 rounded" | ||
href="https://events.brown.edu/ccv/all" | ||
> | ||
VIEW ALL EVENTS | ||
</a> | ||
</div> | ||
</div> | ||
) | ||
} catch (err: any) { | ||
console.error(err) | ||
return ( | ||
<div className="px-2 my-6 space-y-2"> | ||
<SectionHeader href={"#events"} title={"Events"} /> | ||
<p>{err.message}</p> | ||
<div className="flex justify-center"> | ||
<a | ||
className="bg-secondary-blue-500 text-white p-4 rounded" | ||
href="https://events.brown.edu/ccv/all" | ||
> | ||
VIEW ALL EVENTS | ||
</a> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export async function getEventData(time) { | ||
const response = await fetch( | ||
`https://events.brown.edu/live/json/events/description_long/true/group/Center%20for%20Computation%20and%20Visualization%20%28CCV%29/start_date/${time}/` | ||
) | ||
const data = await response.json() | ||
return data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react" | ||
|
||
type CardProps = { | ||
className?: string | ||
} | ||
|
||
export function LinkCard({ | ||
className = "", | ||
children, | ||
}: React.PropsWithChildren<CardProps>) { | ||
return ( | ||
<section | ||
className={`"h-full p-6 flex flex-col gap-2 rounded-lg drop-shadow-md hover:drop-shadow-lg transition duration-500" ${className ? className : "bg-gray-50 border-white border-2"}`} | ||
/* https://design-system.w3.org/components/cards.html#block-link-cards */ data-component="card" | ||
> | ||
{children} | ||
</section> | ||
) | ||
} |
Oops, something went wrong.