shumiland-web/src/blocks/MapBlock.ts
Vadym Samoilenko 61e73033fe feat: Phase 2 complete — content model, blocks, collections, globals
- 11 Page Builder blocks: HeroBlock, TextBlock, FeaturesBlock,
  LocationCardBlock, PricingBlock, GalleryBlock, FormBlock (with label
  relation for lead tracking), CTABlock, CountdownBlock, BlogPreviewBlock,
  MapBlock
- Collections: Labels, Pages, LandingPages, Blog, Events, Leads (UTM +
  googleClientId + label relation), Orders, Tickets
- Globals: SiteSettings (GTM/GA4/Binotel/Umami), TicketsConfig, Navigation
- Added "type": "module" to package.json for Payload CLI ESM compatibility
- payload-types.ts generated (1874 lines)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 17:52:54 +01:00

120 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { Block } from 'payload'
export const MapBlock: Block = {
slug: 'mapBlock',
interfaceName: 'MapBlock',
labels: {
singular: 'Блок з картою',
plural: 'Блоки з картою',
},
fields: [
{
name: 'title',
type: 'text',
label: 'Заголовок',
admin: {
placeholder: 'Як нас знайти',
},
},
{
name: 'address',
type: 'textarea',
label: 'Адреса',
admin: {
rows: 2,
placeholder: 'с. Малютянка, Бучанський район, Київська область',
},
},
{
name: 'embedUrl',
type: 'text',
label: 'URL карти (Google Maps embed)',
admin: {
placeholder: 'https://www.google.com/maps/embed?pb=...',
description: 'Google Maps → Поділитися → Вставити карту → скопіювати src з iframe',
},
},
{
name: 'mapHeight',
type: 'select',
label: 'Висота карти',
defaultValue: 'medium',
options: [
{ label: 'Низька (300px)', value: 'small' },
{ label: 'Середня (450px)', value: 'medium' },
{ label: 'Висока (600px)', value: 'large' },
],
},
{
name: 'transportInfo',
type: 'array',
label: 'Як дістатись',
maxRows: 5,
fields: [
{
name: 'icon',
type: 'select',
label: 'Транспорт',
options: [
{ label: 'Автомобіль', value: 'car' },
{ label: 'Автобус', value: 'bus' },
{ label: 'Потяг', value: 'train' },
{ label: 'Таксі', value: 'taxi' },
{ label: 'Велосипед', value: 'bike' },
],
},
{
name: 'description',
type: 'textarea',
label: 'Опис маршруту',
required: true,
admin: {
rows: 2,
placeholder: 'З Києва маршруткою №xxx до зупинки "Шуміленд"',
},
},
],
},
{
name: 'workingHours',
type: 'array',
label: 'Графік роботи',
maxRows: 7,
fields: [
{
name: 'days',
type: 'text',
label: 'Дні',
required: true,
admin: {
placeholder: 'Понеділок П\'ятниця',
},
},
{
name: 'hours',
type: 'text',
label: 'Години',
required: true,
admin: {
placeholder: '10:00 20:00',
},
},
],
},
{
name: 'showDirectionsButton',
type: 'checkbox',
label: 'Показати кнопку "Прокласти маршрут"',
defaultValue: true,
},
{
name: 'directionsUrl',
type: 'text',
label: 'Посилання на Google Maps (для маршруту)',
admin: {
placeholder: 'https://goo.gl/maps/...',
condition: (_, siblingData) => siblingData?.showDirectionsButton,
},
},
],
}