teqo-backup/src/collections/Petition.ts
Francisco Ignácio Fontoura Solla 14961c5fea feat: overhaul petition UX, add contact/signature data model, and refresh shadcn theming
- redesign petition page layout with responsive hero, content section, and form card
  ()
- refactor frontend theming setup:
  - add  with  in frontend layout
  - migrate/clean global style tokens and base styles in
  - adjust header/social visuals for theme-aware rendering
  (, ,
   , , )
- expand petition form with additional fields and new UI primitives
  (native select, textarea, button, state/city flow)
  (, , , )
- add new Payload collections and wire them into config:
  , ,
  (, ,
   , ,
   )
- update petition collection admin grouping and project config
  (, , )
- add supporting dependency/lockfile updates and workspace tooling tweaks
  (, , , )
2026-02-22 20:02:51 -03:00

66 lines
1.2 KiB
TypeScript

import { revalidateDocumentById } from '@/utilities/documents'
import type { CollectionConfig } from 'payload'
const slug = 'petition'
export const Petition: CollectionConfig<typeof slug> = {
slug,
labels: {
singular: 'Abaixo-assinado',
plural: 'Abaixo-assinados',
},
admin: {
group: 'Abaixo-assinados',
useAsTitle: 'title',
livePreview: {
url: ({ data }) => `/abaixo-assinado/${data.id}`,
},
},
versions: {
drafts: {
autosave: {
interval: 1000,
},
schedulePublish: true,
},
maxPerDoc: 5,
},
access: {
read: () => true,
},
hooks: {
beforeChange: [({ data }) => revalidateDocumentById(slug, data.id)],
},
fields: [
{
name: 'id',
type: 'text',
label: 'Trecho Identificador da URL',
required: true,
},
{
name: 'title',
type: 'text',
label: 'Título',
required: true,
},
{
name: 'subtitle',
type: 'text',
label: 'Subtítulo',
required: true,
},
{
name: 'enabled',
type: 'checkbox',
label: 'Ativo',
required: true,
},
{
name: 'body',
type: 'richText',
label: 'Corpo',
required: true,
},
],
}