cms.c2sgmbh/src/blocks/TeamBlock.ts
Martin Porwoll 261a126f08 feat: add Team collection and block
- Add Team collection with comprehensive member profiles
- Support for role, department, bio, contact info, social links
- Qualifications, specializations, and language skills
- Optional link to User account for author attribution
- Add TeamBlock with multiple layouts (grid, list, slider, compact, detailed)
- Filter by department, featured, or manual selection
- Multi-tenant enabled via plugin configuration
- Update documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 07:15:59 +00:00

266 lines
6.5 KiB
TypeScript

import type { Block } from 'payload'
/**
* Team Block
*
* Zeigt Team-Mitglieder aus der Team Collection.
* Unterstützt verschiedene Layouts und Filteroptionen.
*/
export const TeamBlock: Block = {
slug: 'team-block',
labels: {
singular: 'Team',
plural: 'Team',
},
fields: [
{
name: 'title',
type: 'text',
defaultValue: 'Unser Team',
label: 'Überschrift',
localized: true,
},
{
name: 'subtitle',
type: 'text',
label: 'Untertitel',
localized: true,
},
{
name: 'introduction',
type: 'richText',
label: 'Einleitungstext',
localized: true,
admin: {
description: 'Optionaler Text vor der Team-Anzeige',
},
},
// Auswahl-Modus
{
name: 'displayMode',
type: 'select',
defaultValue: 'all',
label: 'Auswahl',
options: [
{ label: 'Alle aktiven Mitglieder', value: 'all' },
{ label: 'Nur hervorgehobene', value: 'featured' },
{ label: 'Nach Abteilung', value: 'department' },
{ label: 'Handverlesene Auswahl', value: 'selected' },
],
},
{
name: 'department',
type: 'text',
label: 'Abteilung filtern',
admin: {
condition: (data, siblingData) => siblingData?.displayMode === 'department',
description: 'Zeigt nur Mitglieder dieser Abteilung',
},
},
{
name: 'selectedMembers',
type: 'relationship',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
relationTo: 'team' as any,
hasMany: true,
label: 'Team-Mitglieder auswählen',
admin: {
condition: (data, siblingData) => siblingData?.displayMode === 'selected',
},
},
{
name: 'limit',
type: 'number',
defaultValue: 12,
min: 1,
max: 50,
label: 'Maximale Anzahl',
admin: {
condition: (data, siblingData) =>
siblingData?.displayMode === 'all' || siblingData?.displayMode === 'department',
},
},
// Layout
{
name: 'layout',
type: 'select',
defaultValue: 'grid',
label: 'Layout',
options: [
{ label: 'Grid (Karten)', value: 'grid' },
{ label: 'Liste', value: 'list' },
{ label: 'Slider/Karussell', value: 'slider' },
{ label: 'Kompakt (nur Foto + Name)', value: 'compact' },
{ label: 'Detailliert (mit Bio)', value: 'detailed' },
],
},
{
name: 'columns',
type: 'select',
defaultValue: '3',
label: 'Spalten',
options: [
{ label: '2 Spalten', value: '2' },
{ label: '3 Spalten', value: '3' },
{ label: '4 Spalten', value: '4' },
],
admin: {
condition: (data, siblingData) =>
siblingData?.layout === 'grid' || siblingData?.layout === 'compact',
},
},
// Anzeigeoptionen
{
name: 'showRole',
type: 'checkbox',
defaultValue: true,
label: 'Position/Rolle anzeigen',
},
{
name: 'showDepartment',
type: 'checkbox',
defaultValue: false,
label: 'Abteilung anzeigen',
},
{
name: 'showBio',
type: 'checkbox',
defaultValue: true,
label: 'Biografie anzeigen',
admin: {
condition: (data, siblingData) =>
siblingData?.layout !== 'compact',
},
},
{
name: 'showContact',
type: 'checkbox',
defaultValue: false,
label: 'Kontaktdaten anzeigen',
admin: {
description: 'Nur wenn beim Mitglied "Kontaktdaten öffentlich anzeigen" aktiviert ist',
},
},
{
name: 'showSocialLinks',
type: 'checkbox',
defaultValue: true,
label: 'Social Media Links anzeigen',
},
{
name: 'showQualifications',
type: 'checkbox',
defaultValue: false,
label: 'Qualifikationen anzeigen',
admin: {
condition: (data, siblingData) =>
siblingData?.layout === 'detailed' || siblingData?.layout === 'list',
},
},
{
name: 'showSpecializations',
type: 'checkbox',
defaultValue: false,
label: 'Fachgebiete anzeigen',
},
{
name: 'showLanguages',
type: 'checkbox',
defaultValue: false,
label: 'Sprachkenntnisse anzeigen',
},
// Gruppierung
{
name: 'groupByDepartment',
type: 'checkbox',
defaultValue: false,
label: 'Nach Abteilung gruppieren',
admin: {
condition: (data, siblingData) =>
siblingData?.displayMode !== 'department' && siblingData?.layout !== 'slider',
},
},
// Slider-Optionen
{
name: 'autoplay',
type: 'checkbox',
defaultValue: true,
label: 'Automatisch wechseln',
admin: {
condition: (data, siblingData) => siblingData?.layout === 'slider',
},
},
{
name: 'autoplaySpeed',
type: 'number',
defaultValue: 5000,
min: 2000,
max: 15000,
label: 'Wechselintervall (ms)',
admin: {
condition: (data, siblingData) =>
siblingData?.layout === 'slider' && siblingData?.autoplay,
},
},
// Detail-Ansicht
{
name: 'enableDetailView',
type: 'checkbox',
defaultValue: false,
label: 'Detail-Ansicht aktivieren',
admin: {
description: 'Klick auf Mitglied öffnet Modal/Lightbox mit allen Details',
},
},
// Styling
{
name: 'imageStyle',
type: 'select',
defaultValue: 'rounded',
label: 'Foto-Stil',
options: [
{ label: 'Rund', value: 'circle' },
{ label: 'Abgerundet', value: 'rounded' },
{ label: 'Eckig', value: 'square' },
],
},
{
name: 'backgroundColor',
type: 'select',
defaultValue: 'white',
label: 'Hintergrund',
options: [
{ label: 'Weiß', value: 'white' },
{ label: 'Hell (Grau)', value: 'light' },
{ label: 'Dunkel', value: 'dark' },
{ label: 'Akzentfarbe', value: 'accent' },
],
},
// CTA
{
name: 'showCTA',
type: 'checkbox',
defaultValue: false,
label: 'CTA-Button anzeigen',
},
{
name: 'ctaText',
type: 'text',
defaultValue: 'Jetzt bewerben',
label: 'CTA Text',
localized: true,
admin: {
condition: (data, siblingData) => siblingData?.showCTA,
},
},
{
name: 'ctaLink',
type: 'text',
defaultValue: '/karriere',
label: 'CTA Link',
admin: {
condition: (data, siblingData) => siblingData?.showCTA,
},
},
],
}