feat(footer): CMS-editable working hours in contacts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-06-12 14:14:37 +01:00
parent baf47934b0
commit 24b39bcbd9
8 changed files with 34 additions and 1 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE "footer"
ADD COLUMN IF NOT EXISTS "contacts_hours" varchar DEFAULT 'щодня з 11:00 до 20:00';

View file

@ -0,0 +1,15 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db }: MigrateUpArgs): Promise<void> {
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<void> {
await db.execute(sql`
ALTER TABLE "footer"
DROP COLUMN IF EXISTS "contacts_hours";
`)
}

View file

@ -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',
},
]

View file

@ -154,7 +154,7 @@ export async function Footer() {
{STATIC_CONTACTS.metro}
</p>
<p className="text-[14px] text-[#1a3009]/70" style={{ fontFamily: FONT }}>
{STATIC_CONTACTS.hours}
{cmsContacts?.hours ?? STATIC_CONTACTS.hours}
</p>
</div>

View file

@ -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',
},
],
},
{

View file

@ -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 }),

View file

@ -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<T extends boolean = true> {
phone?: T
email?: T
address?: T
hours?: T
}
socials?:
| T

View file

@ -33,6 +33,7 @@ export interface FooterContacts {
phone?: string | null
email?: string | null
address?: string | null
hours?: string | null
}
export interface FooterSocial {