From 24b39bcbd9ed6786ba54a1cb7619f33e7aff2b0e Mon Sep 17 00:00:00 2001
From: Vadym Samoilenko
Date: Fri, 12 Jun 2026 14:14:37 +0100
Subject: [PATCH] feat(footer): CMS-editable working hours in contacts
Co-Authored-By: Claude Fable 5
---
migrations/0024_footer_working_hours.sql | 2 ++
migrations/20260612_120000.ts | 15 +++++++++++++++
migrations/index.ts | 6 ++++++
src/components/layout/Footer.tsx | 2 +-
src/globals/Footer.ts | 6 ++++++
src/payload-generated-schema.ts | 1 +
src/payload-types.ts | 2 ++
src/types/globals.ts | 1 +
8 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 migrations/0024_footer_working_hours.sql
create mode 100644 migrations/20260612_120000.ts
diff --git a/migrations/0024_footer_working_hours.sql b/migrations/0024_footer_working_hours.sql
new file mode 100644
index 0000000..f0b5ac9
--- /dev/null
+++ b/migrations/0024_footer_working_hours.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "footer"
+ ADD COLUMN IF NOT EXISTS "contacts_hours" varchar DEFAULT 'щодня з 11:00 до 20:00';
diff --git a/migrations/20260612_120000.ts b/migrations/20260612_120000.ts
new file mode 100644
index 0000000..61cd43e
--- /dev/null
+++ b/migrations/20260612_120000.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 "footer"
+ ADD COLUMN IF NOT EXISTS "contacts_hours" varchar DEFAULT 'щодня з 11:00 до 20:00';
+ `)
+}
+
+export async function down({ db }: MigrateDownArgs): Promise {
+ await db.execute(sql`
+ ALTER TABLE "footer"
+ DROP COLUMN IF EXISTS "contacts_hours";
+ `)
+}
diff --git a/migrations/index.ts b/migrations/index.ts
index 51fac17..b7aba62 100644
--- a/migrations/index.ts
+++ b/migrations/index.ts
@@ -5,6 +5,7 @@ import * as migration_20260518_115657 from './20260518_115657'
import * as migration_20260610_140000 from './20260610_140000'
import * as migration_20260611_140000 from './20260611_140000'
import * as migration_20260611_160000 from './20260611_160000'
+import * as migration_20260612_120000 from './20260612_120000'
export const migrations = [
{
@@ -42,4 +43,9 @@ export const migrations = [
down: migration_20260611_160000.down,
name: '20260611_160000',
},
+ {
+ up: migration_20260612_120000.up,
+ down: migration_20260612_120000.down,
+ name: '20260612_120000',
+ },
]
diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx
index 8684986..a34bc1d 100644
--- a/src/components/layout/Footer.tsx
+++ b/src/components/layout/Footer.tsx
@@ -154,7 +154,7 @@ export async function Footer() {
{STATIC_CONTACTS.metro}
- {STATIC_CONTACTS.hours}
+ {cmsContacts?.hours ?? STATIC_CONTACTS.hours}
diff --git a/src/globals/Footer.ts b/src/globals/Footer.ts
index 0360e3a..0419283 100644
--- a/src/globals/Footer.ts
+++ b/src/globals/Footer.ts
@@ -25,6 +25,12 @@ export const Footer: GlobalConfig = {
{ name: 'phone', type: 'text' },
{ name: 'email', type: 'email' },
{ name: 'address', type: 'text' },
+ {
+ name: 'hours',
+ type: 'text',
+ label: 'Час роботи',
+ defaultValue: 'щодня з 11:00 до 20:00',
+ },
],
},
{
diff --git a/src/payload-generated-schema.ts b/src/payload-generated-schema.ts
index 98a065d..2d0adaf 100644
--- a/src/payload-generated-schema.ts
+++ b/src/payload-generated-schema.ts
@@ -2854,6 +2854,7 @@ export const footer = pgTable(
contacts_phone: varchar('contacts_phone'),
contacts_email: varchar('contacts_email'),
contacts_address: varchar('contacts_address'),
+ contacts_hours: varchar('contacts_hours').default('щодня з 11:00 до 20:00'),
copyrightText: varchar('copyright_text'),
updatedAt: timestamp('updated_at', { mode: 'string', withTimezone: true, precision: 3 }),
createdAt: timestamp('created_at', { mode: 'string', withTimezone: true, precision: 3 }),
diff --git a/src/payload-types.ts b/src/payload-types.ts
index c92f82a..2c31d1c 100644
--- a/src/payload-types.ts
+++ b/src/payload-types.ts
@@ -2109,6 +2109,7 @@ export interface Footer {
phone?: string | null
email?: string | null
address?: string | null
+ hours?: string | null
}
socials?:
| {
@@ -2979,6 +2980,7 @@ export interface FooterSelect {
phone?: T
email?: T
address?: T
+ hours?: T
}
socials?:
| T
diff --git a/src/types/globals.ts b/src/types/globals.ts
index 7948628..d2fadb0 100644
--- a/src/types/globals.ts
+++ b/src/types/globals.ts
@@ -33,6 +33,7 @@ export interface FooterContacts {
phone?: string | null
email?: string | null
address?: string | null
+ hours?: string | null
}
export interface FooterSocial {