diff --git a/migrations/20260610_140000.ts b/migrations/20260610_140000.ts new file mode 100644 index 0000000..9ba066e --- /dev/null +++ b/migrations/20260610_140000.ts @@ -0,0 +1,15 @@ +import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' + +export async function up({ db }: MigrateUpArgs): Promise { + await db.execute(sql` + ALTER TABLE "locations" + ADD COLUMN IF NOT EXISTS "show_on_lokatsii" boolean DEFAULT true; + `) +} + +export async function down({ db }: MigrateDownArgs): Promise { + await db.execute(sql` + ALTER TABLE "locations" + DROP COLUMN IF EXISTS "show_on_lokatsii"; + `) +} diff --git a/migrations/index.ts b/migrations/index.ts index 8dfc971..b620851 100644 --- a/migrations/index.ts +++ b/migrations/index.ts @@ -2,6 +2,7 @@ import * as migration_20260515_153940 from './20260515_153940' import * as migration_20260515_162527 from './20260515_162527' import * as migration_20260518_104929 from './20260518_104929' import * as migration_20260518_115657 from './20260518_115657' +import * as migration_20260610_140000 from './20260610_140000' export const migrations = [ { @@ -24,4 +25,9 @@ export const migrations = [ down: migration_20260518_115657.down, name: '20260518_115657', }, + { + up: migration_20260610_140000.up, + down: migration_20260610_140000.down, + name: '20260610_140000', + }, ] diff --git a/src/app/(frontend)/lokatsii/page.tsx b/src/app/(frontend)/lokatsii/page.tsx index 3d8f769..36bab43 100644 --- a/src/app/(frontend)/lokatsii/page.tsx +++ b/src/app/(frontend)/lokatsii/page.tsx @@ -68,6 +68,7 @@ async function getLocations(): Promise { sort: 'sort', limit: 20, overrideAccess: true, + where: { showOnLokatsii: { equals: true } }, }) return result.docs as unknown as LocationCMS[] } catch { diff --git a/src/collections/Locations.ts b/src/collections/Locations.ts index 2370167..d7303e9 100644 --- a/src/collections/Locations.ts +++ b/src/collections/Locations.ts @@ -13,7 +13,15 @@ export const Locations: CollectionConfig = { }, admin: { useAsTitle: 'name', - defaultColumns: ['name', 'slug', 'showDetailPage', 'showInMenu', 'showOnHome', 'sort'], + defaultColumns: [ + 'name', + 'slug', + 'showOnLokatsii', + 'showDetailPage', + 'showInMenu', + 'showOnHome', + 'sort', + ], group: 'Каталог', }, fields: [ @@ -35,6 +43,12 @@ export const Locations: CollectionConfig = { fields: [{ name: 'image', type: 'upload', relationTo: 'media' }], }, { name: 'href', type: 'text', admin: { description: 'Зовнішнє посилання (якщо є)' } }, + { + name: 'showOnLokatsii', + type: 'checkbox', + defaultValue: true, + admin: { description: 'Показувати карточку на сторінці /lokatsii' }, + }, { name: 'showInMenu', type: 'checkbox', defaultValue: true }, { name: 'showOnHome', type: 'checkbox', defaultValue: true }, { name: 'sort', type: 'number', defaultValue: 0 }, diff --git a/src/payload-types.ts b/src/payload-types.ts index 42bb03a..0e77cf7 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -580,6 +580,10 @@ export interface Location { * Зовнішнє посилання (якщо є) */ href?: string | null + /** + * Показувати карточку на сторінці /lokatsii + */ + showOnLokatsii?: boolean | null showInMenu?: boolean | null showOnHome?: boolean | null sort?: number | null @@ -1402,6 +1406,7 @@ export interface LocationsSelect { id?: T } href?: T + showOnLokatsii?: T showInMenu?: T showOnHome?: T sort?: T @@ -1735,12 +1740,35 @@ export interface HomePage { */ backgroundImage?: (number | null) | Media } + /** + * Перетягніть для зміни порядку. Додайте або видаліть розділ. Зніміть «Показувати» — розділ зникне без видалення. + */ + sections?: + | { + type: + | 'locations' + | 'whyParents' + | 'video' + | 'birthday' + | 'gallery' + | 'reviews' + | 'faq' + | 'news' + | 'map' + enabled?: boolean | null + id?: string | null + }[] + | null sectionTitles?: { locations?: string | null whyParents?: string | null birthday?: string | null gallery?: string | null reviews?: string | null + /** + * Посилання на сторінку відгуків Google + */ + googleReviewUrl?: string | null news?: string | null } whyParents?: { @@ -1776,6 +1804,14 @@ export interface HomePage { } birthdayIntro?: { text?: string | null + /** + * Фоновий паттерн для не-featured карток (зелений фон). + */ + patternGreen?: (number | null) | Media + /** + * Фоновий паттерн для featured картки (оранжевий фон). + */ + patternOrange?: (number | null) | Media } news?: { title?: string | null @@ -2080,9 +2116,7 @@ export interface BirthdayPage { heroImage?: (number | null) | Media heroTitle?: string | null heroSubtitle?: string | null - heroCta?: string | null packageSectionTitle?: string | null - packageSectionSubtitle?: string | null packageItems?: | { title: string @@ -2109,58 +2143,12 @@ export interface BirthdayPage { | null whyVideos?: | { - src: string - poster?: string | null + video: number | Media + poster?: (number | null) | Media label?: string | null id?: string | null }[] | null - workingHours?: string | null - pricingSectionTitle?: string | null - pricingPackages?: - | { - /** - * Підпис над ціною - */ - label: string - /** - * Напр. "1 500 грн" - */ - price: string - /** - * Примітка під ціною - */ - note?: string | null - ctaLabel?: string | null - ctaHref?: string | null - id?: string | null - }[] - | null - entranceSectionTitle?: string | null - entrancePrices?: - | { - label: string - price: string - note?: string | null - ctaLabel?: string | null - ctaHref?: string | null - id?: string | null - }[] - | null - freeInclusions?: string | null - entertainmentSectionTitle?: string | null - entertainmentPackages?: - | { - /** - * Напр. "Тривалість 1 год" - */ - label: string - price: string - ctaLabel?: string | null - ctaHref?: string | null - id?: string | null - }[] - | null formTitle?: string | null formSubtitle?: string | null /** @@ -2460,6 +2448,13 @@ export interface HomePageSelect { | { backgroundImage?: T } + sections?: + | T + | { + type?: T + enabled?: T + id?: T + } sectionTitles?: | T | { @@ -2468,6 +2463,7 @@ export interface HomePageSelect { birthday?: T gallery?: T reviews?: T + googleReviewUrl?: T news?: T } whyParents?: @@ -2508,6 +2504,8 @@ export interface HomePageSelect { | T | { text?: T + patternGreen?: T + patternOrange?: T } news?: | T @@ -2735,9 +2733,7 @@ export interface BirthdayPageSelect { heroImage?: T heroTitle?: T heroSubtitle?: T - heroCta?: T packageSectionTitle?: T - packageSectionSubtitle?: T packageItems?: | T | { @@ -2759,45 +2755,11 @@ export interface BirthdayPageSelect { whyVideos?: | T | { - src?: T + video?: T poster?: T label?: T id?: T } - workingHours?: T - pricingSectionTitle?: T - pricingPackages?: - | T - | { - label?: T - price?: T - note?: T - ctaLabel?: T - ctaHref?: T - id?: T - } - entranceSectionTitle?: T - entrancePrices?: - | T - | { - label?: T - price?: T - note?: T - ctaLabel?: T - ctaHref?: T - id?: T - } - freeInclusions?: T - entertainmentSectionTitle?: T - entertainmentPackages?: - | T - | { - label?: T - price?: T - ctaLabel?: T - ctaHref?: T - id?: T - } formTitle?: T formSubtitle?: T form?: T