feature: rsvp link
This commit is contained in:
parent
e606ba1204
commit
f9f23430c5
7 changed files with 6446 additions and 5 deletions
|
|
@ -21,7 +21,8 @@ export default async function Page({ params }: { params: Promise<{id: string}>})
|
|||
contact: true,
|
||||
flyer: true,
|
||||
photo: true,
|
||||
group: true
|
||||
group: true,
|
||||
rsvpLink: true
|
||||
},
|
||||
},
|
||||
{ addQueryPrefix: true },
|
||||
|
|
@ -48,6 +49,7 @@ export default async function Page({ params }: { params: Promise<{id: string}>})
|
|||
shortDescription={event.shortDescription}
|
||||
group={group}
|
||||
contact={event.contact || undefined}
|
||||
rsvpLink={event.rsvpLink || undefined}
|
||||
flyer={typeof event.flyer === 'object' ? event.flyer || undefined : undefined}
|
||||
photo={photo}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -122,6 +122,14 @@ export const Events: CollectionConfig = {
|
|||
de: 'Umschreibung',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'rsvpLink',
|
||||
type: 'text',
|
||||
required: false,
|
||||
label: {
|
||||
de: "Anmeldelink"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'flyer',
|
||||
type: 'upload',
|
||||
|
|
|
|||
6400
src/migrations/20250202_104742.json
Normal file
6400
src/migrations/20250202_104742.json
Normal file
File diff suppressed because it is too large
Load diff
15
src/migrations/20250202_104742.ts
Normal file
15
src/migrations/20250202_104742.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||
|
||||
export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
|
||||
await payload.db.drizzle.execute(sql`
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2025-02-09T10:47:41.631Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2025-02-09T10:47:41.722Z';
|
||||
ALTER TABLE "event" ADD COLUMN "rsvp_link" varchar;`)
|
||||
}
|
||||
|
||||
export async function down({ payload, req }: MigrateDownArgs): Promise<void> {
|
||||
await payload.db.drizzle.execute(sql`
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2025-02-02T14:51:44.981Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2025-02-02T14:51:45.077Z';
|
||||
ALTER TABLE "event" DROP COLUMN IF EXISTS "rsvp_link";`)
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import * as migration_20241205_121237 from './20241205_121237';
|
|||
import * as migration_20241217_135114_contact_person_photo from './20241217_135114_contact_person_photo';
|
||||
import * as migration_20250128_100809_pope_prayer_intentions from './20250128_100809_pope_prayer_intentions';
|
||||
import * as migration_20250128_145145_liturgical_calendar from './20250128_145145_liturgical_calendar';
|
||||
import * as migration_20250202_104742 from './20250202_104742';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -22,6 +23,11 @@ export const migrations = [
|
|||
{
|
||||
up: migration_20250128_145145_liturgical_calendar.up,
|
||||
down: migration_20250128_145145_liturgical_calendar.down,
|
||||
name: '20250128_145145_liturgical_calendar'
|
||||
name: '20250128_145145_liturgical_calendar',
|
||||
},
|
||||
{
|
||||
up: migration_20250202_104742.up,
|
||||
down: migration_20250202_104742.down,
|
||||
name: '20250202_104742'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ type EventProps = {
|
|||
contact?: string | ContactPerson,
|
||||
group?: string,
|
||||
flyer?: Document,
|
||||
photo?: StaticImageData
|
||||
photo?: StaticImageData,
|
||||
rsvpLink?: string
|
||||
}
|
||||
|
||||
export function EventPage(
|
||||
|
|
@ -44,7 +45,8 @@ export function EventPage(
|
|||
contact,
|
||||
flyer,
|
||||
group,
|
||||
photo
|
||||
photo,
|
||||
rsvpLink
|
||||
}: EventProps
|
||||
) {
|
||||
const published = useDate(createdAt)
|
||||
|
|
@ -119,9 +121,15 @@ export function EventPage(
|
|||
<div className={styles.description}>
|
||||
<TextDiv text={description} />
|
||||
|
||||
{ (typeof flyer === "object" || group) &&
|
||||
{ (typeof flyer === "object" || group || rsvpLink) &&
|
||||
<Section padding={"small"}>
|
||||
<div className={styles.buttons}>
|
||||
{ rsvpLink &&
|
||||
<Button size={"md"} href={rsvpLink} target={"_blank"} schema={"contrast"}>
|
||||
Anmelden
|
||||
</Button>
|
||||
}
|
||||
|
||||
{ typeof flyer === "object" && flyer.url &&
|
||||
<Button size={"md"} href={flyer.url}>Flyer herunterladen</Button>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -375,6 +375,7 @@ export interface Event {
|
|||
contact?: (string | null) | ContactPerson;
|
||||
shortDescription: string;
|
||||
description: string;
|
||||
rsvpLink?: string | null;
|
||||
flyer?: (string | null) | Document;
|
||||
cancelled: boolean;
|
||||
isRecurring: boolean;
|
||||
|
|
@ -860,6 +861,7 @@ export interface EventSelect<T extends boolean = true> {
|
|||
contact?: T;
|
||||
shortDescription?: T;
|
||||
description?: T;
|
||||
rsvpLink?: T;
|
||||
flyer?: T;
|
||||
cancelled?: T;
|
||||
isRecurring?: T;
|
||||
|
|
|
|||
Loading…
Reference in a new issue