Compare commits

..

2 commits

Author SHA1 Message Date
Benno Tielen
ed273454a3 feature: contact persons
Some checks are pending
Deploy / deploy (push) Waiting to run
2026-03-20 00:01:36 +01:00
Benno Tielen
3f8269aa4a feature: collapsible text 2026-03-19 23:30:31 +01:00
15 changed files with 54533 additions and 38 deletions

View file

@ -25,6 +25,13 @@ export const ContactPerson: CollectionConfig = {
de: "Name"
}
},
{
name: 'role',
type: 'text',
label: {
de: 'Funktion',
},
},
{
name: 'email',
type: 'email',

View file

@ -19,6 +19,7 @@ import { MassTimesBlock } from '@/collections/blocks/MassTimes'
import { CollapsibleImageWithTextBlock } from '@/collections/blocks/CollapsibleImageWithText'
import { EventsBlock } from '@/collections/blocks/Events'
import { PublicationAndNewsletterBlock } from '@/collections/blocks/PublicationAndNewsletter'
import { ContactPersonBlock } from '@/collections/blocks/ContactPersonBlock'
import { isPublishedPublic } from '@/collections/access/public'
export const Pages: CollectionConfig = {
@ -94,8 +95,10 @@ export const Pages: CollectionConfig = {
MainTextBlock,
HorizontalRuleBlock,
BlogSliderBlock,
CollapsibleImageWithTextBlock,
MassTimesBlock,
EventsBlock,
ContactPersonBlock,
],
},
],

View file

@ -10,6 +10,7 @@ export const CollapsibleImageWithTextBlock: Block = {
de: 'Aufklappbare Bildtexte',
},
},
dbName: 'collaps',
fields: [
{
name: 'title',
@ -45,29 +46,18 @@ export const CollapsibleImageWithTextBlock: Block = {
},
},
{
name: 'backgroundColor',
name: 'colorStyle',
type: 'select',
label: {
de: 'Hintergrundfarbe',
de: 'Farbstil',
},
options: [
{ label: 'Keine', value: 'none' },
{ label: 'Standard', value: 'default' },
{ label: 'Soft', value: 'soft' },
{ label: 'Off-White', value: 'off-white' },
],
defaultValue: 'none',
},
{
name: 'schema',
type: 'select',
label: {
de: 'Farbschema',
},
options: [
{ label: 'Base', value: 'base' },
{ label: 'Kontrast', value: 'contrast' },
],
defaultValue: 'base',
defaultValue: 'default',
},
],
}

View file

@ -0,0 +1,24 @@
import { Block } from 'payload'
export const ContactPersonBlock: Block = {
slug: 'contactPersonBlock',
labels: {
singular: {
de: 'Ansprechperson',
},
plural: {
de: 'Ansprechpersonen',
},
},
fields: [
{
name: 'contact',
type: 'relationship',
relationTo: 'contactPerson',
required: true,
label: {
de: 'Ansprechperson',
},
},
],
}

View file

@ -0,0 +1,58 @@
import styles from './styles.module.scss'
import { ContactPerson } from '@/payload-types'
import Image, { StaticImageData } from 'next/image'
type ContactPersonCardProps = {
contact: null | string | undefined | ContactPerson
photo?: StaticImageData
}
export const ContactPersonCard = ({
contact,
photo,
}: ContactPersonCardProps) => {
if (
contact === null ||
contact === undefined ||
typeof contact === 'string'
) {
return null
}
return (
<div className={styles.card}>
<div>
{photo && (
<Image
className={styles.photo}
src={photo}
alt={contact.name}
width={200}
height={200}
unoptimized={true}
/>
)}
</div>
<div>
{contact.role && (
<h3 className={styles.role}>{contact.role}</h3>
)}
<div className={styles.info}>
<span className={styles.name}>{contact.name}</span>
{contact.email && (
<a href={`mailto:${contact.email}`} className={styles.link}>
{contact.email}
</a>
)}
{contact.telephone && (
<a href={`tel:${contact.telephone}`} className={styles.link}>
{contact.telephone}
</a>
)}
</div>
</div>
</div>
)
}

View file

@ -0,0 +1,40 @@
@use 'template' as *;
.card {
display: flex;
flex-direction: row;
align-items: center;
gap: 50px;
}
.photo {
width: 200px;
height: 200px;
object-fit: cover;
border-radius: 50%;
}
.role {
font-size: 25px;
color: $base-color;
margin: 0;
}
.info {
display: flex;
flex-direction: column;
gap: 4px;
}
.name {
font-weight: bold;
}
.link {
text-decoration: none;
color: inherit;
&:hover {
text-decoration: underline;
}
}

View file

@ -15,6 +15,8 @@ import { MainText } from '@/components/MainText/MainText'
import { HR } from '@/components/HorizontalRule/HorizontalRule'
import { CollapsibleImageWithText } from '@/compositions/CollapsibleImageWithText/CollapsibleImageWithText'
import { PublicationAndNewsletter } from '@/compositions/PublicationAndNewsletter/PublicationAndNewsletter'
import { ContactPersonCard } from '@/components/ContactPersonCard/ContactPersonCard'
import { getPhoto } from '@/utils/dto/gallery'
import { BlogSliderBlock } from '@/compositions/Blocks/BlogSliderBlock'
import { MassTimesBlock } from '@/compositions/Blocks/MassTimesBlock'
import { EventsBlock } from '@/compositions/Blocks/EventsBlock'
@ -193,29 +195,33 @@ export function Blocks({ content }: BlocksProps) {
)
}
// if (item.blockType === 'collapsibleImageWithText') {
// const imageUrl = typeof item.image === 'object' && item.image?.url
// ? item.image.url
// : ''
// const bg = item.backgroundColor === 'none'
// ? undefined
// : item.backgroundColor as 'soft' | 'off-white' | undefined
// return (
// <CollapsibleImageWithText
// key={item.id}
// title={item.title}
// text={item.text}
// image={imageUrl}
// backgroundColor={bg}
// schema={item.schema as 'base' | 'contrast' | undefined}
// content={
// item.content
// ? <HTMLText width={'1/2'} data={item.content} />
// : <></>
// }
// />
// )
// }
if (item.blockType === 'collapsibleImageWithText') {
const imageUrl = typeof item.image === 'object' && item.image?.url
? item.image.url
: ''
const colorStyle = item.colorStyle || 'default'
const bg = colorStyle === 'soft' || colorStyle === 'off-white'
? colorStyle as 'soft' | 'off-white'
: undefined
const schema = colorStyle === 'contrast'
? 'contrast' as const
: 'base' as const
return (
<CollapsibleImageWithText
key={item.id}
title={item.title}
text={item.text}
image={imageUrl}
backgroundColor={bg}
schema={schema}
content={
item.content
? <HTMLText width={'3/4'} data={item.content} />
: <></>
}
/>
)
}
if (item.blockType === 'events') {
return (
@ -227,6 +233,22 @@ export function Blocks({ content }: BlocksProps) {
)
}
if (item.blockType === 'contactPersonBlock') {
const contact = typeof item.contact === 'object'
? item.contact
: undefined
const photo = contact
? getPhoto('thumbnail', contact.photo)
: undefined
return (
<Section key={item.id} padding={'small'}>
<Container>
<ContactPersonCard contact={contact} photo={photo} />
</Container>
</Section>
)
}
// if (item.blockType === 'publicationAndNewsletter') {
// return <PublicationAndNewsletter key={item.id} />
// }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,62 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
CREATE TYPE "public"."enum_collaps_color_style" AS ENUM('default', 'soft', 'off-white', 'contrast');
CREATE TYPE "public"."enum__collaps_v_color_style" AS ENUM('default', 'soft', 'off-white', 'contrast');
CREATE TABLE "collaps" (
"_order" integer NOT NULL,
"_parent_id" uuid NOT NULL,
"_path" text NOT NULL,
"id" varchar PRIMARY KEY NOT NULL,
"title" varchar,
"text" varchar,
"image_id" uuid,
"content" jsonb,
"color_style" "enum_collaps_color_style" DEFAULT 'default',
"block_name" varchar
);
CREATE TABLE "_collaps_v" (
"_order" integer NOT NULL,
"_parent_id" uuid NOT NULL,
"_path" text NOT NULL,
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" varchar,
"text" varchar,
"image_id" uuid,
"content" jsonb,
"color_style" "enum__collaps_v_color_style" DEFAULT 'default',
"_uuid" varchar,
"block_name" varchar
);
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-22T21:58:39.666Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T21:58:39.963Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T20:58:40.019Z';
ALTER TABLE "collaps" ADD CONSTRAINT "collaps_image_id_media_id_fk" FOREIGN KEY ("image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "collaps" ADD CONSTRAINT "collaps_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."pages"("id") ON DELETE cascade ON UPDATE no action;
ALTER TABLE "_collaps_v" ADD CONSTRAINT "_collaps_v_image_id_media_id_fk" FOREIGN KEY ("image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "_collaps_v" ADD CONSTRAINT "_collaps_v_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_pages_v"("id") ON DELETE cascade ON UPDATE no action;
CREATE INDEX "collaps_order_idx" ON "collaps" USING btree ("_order");
CREATE INDEX "collaps_parent_id_idx" ON "collaps" USING btree ("_parent_id");
CREATE INDEX "collaps_path_idx" ON "collaps" USING btree ("_path");
CREATE INDEX "collaps_image_idx" ON "collaps" USING btree ("image_id");
CREATE INDEX "_collaps_v_order_idx" ON "_collaps_v" USING btree ("_order");
CREATE INDEX "_collaps_v_parent_id_idx" ON "_collaps_v" USING btree ("_parent_id");
CREATE INDEX "_collaps_v_path_idx" ON "_collaps_v" USING btree ("_path");
CREATE INDEX "_collaps_v_image_idx" ON "_collaps_v" USING btree ("image_id");`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "collaps" DISABLE ROW LEVEL SECURITY;
ALTER TABLE "_collaps_v" DISABLE ROW LEVEL SECURITY;
DROP TABLE "collaps" CASCADE;
DROP TABLE "_collaps_v" CASCADE;
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-15T11:02:35.690Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-15T11:02:35.969Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-10T10:02:36.027Z';
DROP TYPE "public"."enum_collaps_color_style";
DROP TYPE "public"."enum__collaps_v_color_style";`)
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,50 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
CREATE TABLE "pages_blocks_contact_person_block" (
"_order" integer NOT NULL,
"_parent_id" uuid NOT NULL,
"_path" text NOT NULL,
"id" varchar PRIMARY KEY NOT NULL,
"contact_id" uuid,
"block_name" varchar
);
CREATE TABLE "_pages_v_blocks_contact_person_block" (
"_order" integer NOT NULL,
"_parent_id" uuid NOT NULL,
"_path" text NOT NULL,
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"contact_id" uuid,
"_uuid" varchar,
"block_name" varchar
);
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:38:03.504Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:38:03.783Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T21:38:03.836Z';
ALTER TABLE "pages_blocks_contact_person_block" ADD CONSTRAINT "pages_blocks_contact_person_block_contact_id_contact_person_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."contact_person"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "pages_blocks_contact_person_block" ADD CONSTRAINT "pages_blocks_contact_person_block_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."pages"("id") ON DELETE cascade ON UPDATE no action;
ALTER TABLE "_pages_v_blocks_contact_person_block" ADD CONSTRAINT "_pages_v_blocks_contact_person_block_contact_id_contact_person_id_fk" FOREIGN KEY ("contact_id") REFERENCES "public"."contact_person"("id") ON DELETE set null ON UPDATE no action;
ALTER TABLE "_pages_v_blocks_contact_person_block" ADD CONSTRAINT "_pages_v_blocks_contact_person_block_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_pages_v"("id") ON DELETE cascade ON UPDATE no action;
CREATE INDEX "pages_blocks_contact_person_block_order_idx" ON "pages_blocks_contact_person_block" USING btree ("_order");
CREATE INDEX "pages_blocks_contact_person_block_parent_id_idx" ON "pages_blocks_contact_person_block" USING btree ("_parent_id");
CREATE INDEX "pages_blocks_contact_person_block_path_idx" ON "pages_blocks_contact_person_block" USING btree ("_path");
CREATE INDEX "pages_blocks_contact_person_block_contact_idx" ON "pages_blocks_contact_person_block" USING btree ("contact_id");
CREATE INDEX "_pages_v_blocks_contact_person_block_order_idx" ON "_pages_v_blocks_contact_person_block" USING btree ("_order");
CREATE INDEX "_pages_v_blocks_contact_person_block_parent_id_idx" ON "_pages_v_blocks_contact_person_block" USING btree ("_parent_id");
CREATE INDEX "_pages_v_blocks_contact_person_block_path_idx" ON "_pages_v_blocks_contact_person_block" USING btree ("_path");
CREATE INDEX "_pages_v_blocks_contact_person_block_contact_idx" ON "_pages_v_blocks_contact_person_block" USING btree ("contact_id");`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "pages_blocks_contact_person_block" DISABLE ROW LEVEL SECURITY;
ALTER TABLE "_pages_v_blocks_contact_person_block" DISABLE ROW LEVEL SECURITY;
DROP TABLE "pages_blocks_contact_person_block" CASCADE;
DROP TABLE "_pages_v_blocks_contact_person_block" CASCADE;
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-22T21:58:39.666Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T21:58:39.963Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T20:58:40.019Z';`)
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:44:18.451Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:44:18.743Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T21:44:18.801Z';
ALTER TABLE "contact_person" ADD COLUMN "role" varchar;`)
}
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
await db.execute(sql`
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:38:03.504Z';
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-03-22T22:38:03.783Z';
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-04-18T21:38:03.836Z';
ALTER TABLE "contact_person" DROP COLUMN "role";`)
}

View file

@ -21,6 +21,9 @@ import * as migration_20260310_105814 from './20260310_105814';
import * as migration_20260310_143800 from './20260310_143800';
import * as migration_20260311_105947_drop_features from './20260311_105947_drop_features';
import * as migration_20260311_110236_live_preview from './20260311_110236_live_preview';
import * as migration_20260319_215840_collaps_item from './20260319_215840_collaps_item';
import * as migration_20260319_223804_contactperson_block from './20260319_223804_contactperson_block';
import * as migration_20260319_224419 from './20260319_224419';
export const migrations = [
{
@ -138,4 +141,19 @@ export const migrations = [
down: migration_20260311_110236_live_preview.down,
name: '20260311_110236_live_preview',
},
{
up: migration_20260319_215840_collaps_item.up,
down: migration_20260319_215840_collaps_item.down,
name: '20260319_215840_collaps_item',
},
{
up: migration_20260319_223804_contactperson_block.up,
down: migration_20260319_223804_contactperson_block.down,
name: '20260319_223804_contactperson_block',
},
{
up: migration_20260319_224419.up,
down: migration_20260319_224419.down,
name: '20260319_224419'
},
];

View file

@ -645,6 +645,7 @@ export interface ContactPerson {
id: string;
photo?: (string | null) | Media;
name: string;
role?: string | null;
email?: string | null;
telephone?: string | null;
updatedAt: string;
@ -847,6 +848,30 @@ export interface Page {
blockName?: string | null;
blockType: 'blogSlider';
}
| {
title: string;
text: string;
image: string | Media;
content: {
root: {
type: string;
children: {
type: any;
version: number;
[k: string]: unknown;
}[];
direction: ('ltr' | 'rtl') | null;
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
indent: number;
version: number;
};
[k: string]: unknown;
};
colorStyle?: ('default' | 'soft' | 'off-white' | 'contrast') | null;
id?: string | null;
blockName?: string | null;
blockType: 'collapsibleImageWithText';
}
| {
title?: string | null;
subtitle?: string | null;
@ -861,6 +886,12 @@ export interface Page {
blockName?: string | null;
blockType: 'events';
}
| {
contact: string | ContactPerson;
id?: string | null;
blockName?: string | null;
blockType: 'contactPersonBlock';
}
)[]
| null;
updatedAt: string;
@ -1329,6 +1360,7 @@ export interface ClassifiedsSelect<T extends boolean = true> {
export interface ContactPersonSelect<T extends boolean = true> {
photo?: T;
name?: T;
role?: T;
email?: T;
telephone?: T;
updatedAt?: T;
@ -1564,6 +1596,17 @@ export interface PagesSelect<T extends boolean = true> {
id?: T;
blockName?: T;
};
collapsibleImageWithText?:
| T
| {
title?: T;
text?: T;
image?: T;
content?: T;
colorStyle?: T;
id?: T;
blockName?: T;
};
massTimes?:
| T
| {
@ -1580,6 +1623,13 @@ export interface PagesSelect<T extends boolean = true> {
id?: T;
blockName?: T;
};
contactPersonBlock?:
| T
| {
contact?: T;
id?: T;
blockName?: T;
};
};
updatedAt?: T;
createdAt?: T;