-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(proaws): events as products (#177)
* feat: adds event CRUD * feat: an "edit product" button clicking the event i the product from the list links to a bad place * feat: clicking an event in a product resource list will open that event edit page * chore: debug clearing * changeset added * meh
- Loading branch information
Showing
62 changed files
with
1,266 additions
and
243 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@coursebuilder/adapter-drizzle": patch | ||
"@coursebuilder/commerce-next": patch | ||
"@coursebuilder/core": patch | ||
"@coursebuilder/next": patch | ||
"@coursebuilder/ui": patch | ||
--- | ||
|
||
adding events as products to proaws |
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
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
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
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
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
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
61 changes: 61 additions & 0 deletions
61
apps/pro-aws/src/app/(content)/events/[slug]/_components/event-details.tsx
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,61 @@ | ||
import * as React from 'react' | ||
import { Event } from '@/lib/events' | ||
import { formatInTimeZone } from 'date-fns-tz' | ||
|
||
export const EventDetails: React.FC<{ | ||
event: Event | ||
}> = ({ event }) => { | ||
const { startsAt, endsAt, timezone } = event.fields | ||
const PT = 'America/Los_Angeles' | ||
const eventDate = | ||
startsAt && `${formatInTimeZone(new Date(startsAt), PT, 'MMMM d, yyyy')}` | ||
|
||
const eventTime = | ||
startsAt && | ||
endsAt && | ||
`${formatInTimeZone(new Date(startsAt), PT, 'h:mm a')} — ${formatInTimeZone( | ||
new Date(endsAt), | ||
PT, | ||
'h:mm a', | ||
)}` | ||
|
||
interface GroupedEvents { | ||
[title: string]: { | ||
dates: string[] | ||
time: string | ||
} | ||
} | ||
|
||
return ( | ||
<div className="mt-5 flex flex-col border-t pt-5"> | ||
<h2 className="px-5 pb-4 text-xl font-semibold">Event Details</h2> | ||
|
||
<div className="flex flex-col text-base font-semibold opacity-90"> | ||
<div className="flex items-center gap-2 px-5 py-2"> | ||
{/*<CalendarIcon className="h-5 w-5 flex-shrink-0 text-gray-600 dark:text-blue-300" />{' '}*/} | ||
{eventDate} | ||
</div> | ||
<div className="flex items-baseline gap-2 px-5 py-2"> | ||
{/*<ClockIcon className="relative h-5 w-5 flex-shrink-0 translate-y-1 text-gray-600 dark:text-blue-300" />{' '}*/} | ||
<div> | ||
{eventTime} (Pacific time){' '} | ||
{timezone && ( | ||
<a | ||
href={timezone} | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
className="font-normal underline" | ||
> | ||
timezones | ||
</a> | ||
)} | ||
</div> | ||
</div> | ||
<div className="flex items-center gap-2 px-5 py-2"> | ||
{/*<LocationMarkerIcon className="h-5 w-5 text-gray-600 dark:text-blue-300" />{' '}*/} | ||
Zoom (online remote) | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/pro-aws/src/app/(content)/events/[slug]/_components/event-page-props.ts
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,21 @@ | ||
import { Event } from '@/lib/events' | ||
import { PricingData } from '@/lib/pricing-query' | ||
import { MDXRemoteSerializeResult } from 'next-mdx-remote' | ||
|
||
import { CommerceProps } from '@coursebuilder/commerce-next/utils/commerce-props' | ||
import { Product, Purchase } from '@coursebuilder/core/schemas' | ||
|
||
export type EventPageProps = { | ||
event: Event | ||
quantityAvailable: number | ||
totalQuantity: number | ||
purchaseCount: number | ||
product?: Product | ||
mdx?: MDXRemoteSerializeResult | ||
hasPurchasedCurrentProduct?: boolean | ||
availableBonuses: any[] | ||
existingPurchase?: (Purchase & { product?: Product | null }) | null | ||
purchases?: Purchase[] | ||
userId?: string | ||
pricingDataLoader: Promise<PricingData> | ||
} & CommerceProps |
Oops, something went wrong.