This commit is contained in:
parent
89e171ebf5
commit
edaf940748
7 changed files with 25878 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ import { isPublishedPublic } from '@/collections/access/public'
|
|||
import { ImageCardsBlock } from '@/collections/blocks/ImageCards'
|
||||
import { CollapsiblesBlock } from '@/collections/blocks/Collapsibles'
|
||||
import { TitleBlock } from '@/collections/blocks/Title'
|
||||
import { NextPrevButtonsBlock } from '@/collections/blocks/NextPrevButtons'
|
||||
|
||||
export const Groups: CollectionConfig = {
|
||||
slug: 'group',
|
||||
|
|
@ -91,6 +92,7 @@ export const Groups: CollectionConfig = {
|
|||
ButtonBlock,
|
||||
ImageCardsBlock,
|
||||
CollapsiblesBlock,
|
||||
NextPrevButtonsBlock
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { ImageCardsBlock } from '@/collections/blocks/ImageCards'
|
|||
import { TitleBlock } from '@/collections/blocks/Title'
|
||||
import { CollapsiblesBlock } from '@/collections/blocks/Collapsibles'
|
||||
import { isPublishedPublic } from '@/collections/access/public'
|
||||
import { NextPrevButtonsBlock } from '@/collections/blocks/NextPrevButtons'
|
||||
|
||||
export const Parish: CollectionConfig = {
|
||||
slug: 'parish',
|
||||
|
|
@ -125,6 +126,7 @@ export const Parish: CollectionConfig = {
|
|||
ImageCardsBlock,
|
||||
TitleBlock,
|
||||
CollapsiblesBlock,
|
||||
NextPrevButtonsBlock
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { DonationAppeal } from '@/components/DonationAppeal/DonationAppeal'
|
|||
import { ImageCardsBlock } from '@/compositions/Blocks/ImageCardsBlock'
|
||||
import { Title } from '@/components/Title/Title'
|
||||
import { Collapsible } from '@/components/Collapsible/Collapsible'
|
||||
import { NextPrevButtons } from '@/components/NextPrevButtons/NextPrevButtons'
|
||||
|
||||
type BlocksProps = {
|
||||
content: Parish['content']
|
||||
|
|
@ -97,9 +98,25 @@ export function ParishBlocks({ content }: BlocksProps) {
|
|||
</Container>
|
||||
</Section>
|
||||
}
|
||||
|
||||
if (item.blockType === 'nextPrevButtons') {
|
||||
const prev = item.prev?.href && item.prev?.text
|
||||
? { href: item.prev.href, text: item.prev.text }
|
||||
: undefined
|
||||
const next = item.next?.href && item.next?.text
|
||||
? { href: item.next.href, text: item.next.text }
|
||||
: undefined
|
||||
return (
|
||||
<Section key={item.id} padding={'medium'} paddingBottom={'small'}>
|
||||
<NextPrevButtons prev={prev} next={next} />
|
||||
</Section>
|
||||
)
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{ shouldAddMargin &&
|
||||
<Section></Section>
|
||||
}
|
||||
|
|
|
|||
25699
src/migrations/20260504_070356_next_prev_buttons.json
Normal file
25699
src/migrations/20260504_070356_next_prev_buttons.json
Normal file
File diff suppressed because it is too large
Load diff
89
src/migrations/20260504_070356_next_prev_buttons.ts
Normal file
89
src/migrations/20260504_070356_next_prev_buttons.ts
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||
|
||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
CREATE TABLE "parish_blocks_next_prev_buttons" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" uuid NOT NULL,
|
||||
"_path" text NOT NULL,
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"prev_text" varchar,
|
||||
"prev_href" varchar,
|
||||
"next_text" varchar,
|
||||
"next_href" varchar,
|
||||
"block_name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE "_parish_v_blocks_next_prev_buttons" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" uuid NOT NULL,
|
||||
"_path" text NOT NULL,
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"prev_text" varchar,
|
||||
"prev_href" varchar,
|
||||
"next_text" varchar,
|
||||
"next_href" varchar,
|
||||
"_uuid" varchar,
|
||||
"block_name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE "group_blocks_next_prev_buttons" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" uuid NOT NULL,
|
||||
"_path" text NOT NULL,
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"prev_text" varchar,
|
||||
"prev_href" varchar,
|
||||
"next_text" varchar,
|
||||
"next_href" varchar,
|
||||
"block_name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE "_group_v_blocks_next_prev_buttons" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" uuid NOT NULL,
|
||||
"_path" text NOT NULL,
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"prev_text" varchar,
|
||||
"prev_href" varchar,
|
||||
"next_text" varchar,
|
||||
"next_href" varchar,
|
||||
"_uuid" varchar,
|
||||
"block_name" varchar
|
||||
);
|
||||
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-05-10T07:03:55.605Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-05-10T07:03:55.910Z';
|
||||
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-06-03T07:03:55.993Z';
|
||||
ALTER TABLE "parish_blocks_next_prev_buttons" ADD CONSTRAINT "parish_blocks_next_prev_buttons_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."parish"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "_parish_v_blocks_next_prev_buttons" ADD CONSTRAINT "_parish_v_blocks_next_prev_buttons_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_parish_v"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "group_blocks_next_prev_buttons" ADD CONSTRAINT "group_blocks_next_prev_buttons_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."group"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "_group_v_blocks_next_prev_buttons" ADD CONSTRAINT "_group_v_blocks_next_prev_buttons_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."_group_v"("id") ON DELETE cascade ON UPDATE no action;
|
||||
CREATE INDEX "parish_blocks_next_prev_buttons_order_idx" ON "parish_blocks_next_prev_buttons" USING btree ("_order");
|
||||
CREATE INDEX "parish_blocks_next_prev_buttons_parent_id_idx" ON "parish_blocks_next_prev_buttons" USING btree ("_parent_id");
|
||||
CREATE INDEX "parish_blocks_next_prev_buttons_path_idx" ON "parish_blocks_next_prev_buttons" USING btree ("_path");
|
||||
CREATE INDEX "_parish_v_blocks_next_prev_buttons_order_idx" ON "_parish_v_blocks_next_prev_buttons" USING btree ("_order");
|
||||
CREATE INDEX "_parish_v_blocks_next_prev_buttons_parent_id_idx" ON "_parish_v_blocks_next_prev_buttons" USING btree ("_parent_id");
|
||||
CREATE INDEX "_parish_v_blocks_next_prev_buttons_path_idx" ON "_parish_v_blocks_next_prev_buttons" USING btree ("_path");
|
||||
CREATE INDEX "group_blocks_next_prev_buttons_order_idx" ON "group_blocks_next_prev_buttons" USING btree ("_order");
|
||||
CREATE INDEX "group_blocks_next_prev_buttons_parent_id_idx" ON "group_blocks_next_prev_buttons" USING btree ("_parent_id");
|
||||
CREATE INDEX "group_blocks_next_prev_buttons_path_idx" ON "group_blocks_next_prev_buttons" USING btree ("_path");
|
||||
CREATE INDEX "_group_v_blocks_next_prev_buttons_order_idx" ON "_group_v_blocks_next_prev_buttons" USING btree ("_order");
|
||||
CREATE INDEX "_group_v_blocks_next_prev_buttons_parent_id_idx" ON "_group_v_blocks_next_prev_buttons" USING btree ("_parent_id");
|
||||
CREATE INDEX "_group_v_blocks_next_prev_buttons_path_idx" ON "_group_v_blocks_next_prev_buttons" USING btree ("_path");`)
|
||||
}
|
||||
|
||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "parish_blocks_next_prev_buttons" DISABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "_parish_v_blocks_next_prev_buttons" DISABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "group_blocks_next_prev_buttons" DISABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "_group_v_blocks_next_prev_buttons" DISABLE ROW LEVEL SECURITY;
|
||||
DROP TABLE "parish_blocks_next_prev_buttons" CASCADE;
|
||||
DROP TABLE "_parish_v_blocks_next_prev_buttons" CASCADE;
|
||||
DROP TABLE "group_blocks_next_prev_buttons" CASCADE;
|
||||
DROP TABLE "_group_v_blocks_next_prev_buttons" CASCADE;
|
||||
ALTER TABLE "announcement" ALTER COLUMN "date" SET DEFAULT '2026-05-03T12:11:04.492Z';
|
||||
ALTER TABLE "calendar" ALTER COLUMN "date" SET DEFAULT '2026-05-03T12:11:04.791Z';
|
||||
ALTER TABLE "classifieds" ALTER COLUMN "until" SET DEFAULT '2026-05-29T12:11:04.854Z';`)
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ import * as migration_20260417_114727_simplify_recurring_events from './20260417
|
|||
import * as migration_20260423_115311 from './20260423_115311';
|
||||
import * as migration_20260423_131226_add_event_end_date_time from './20260423_131226_add_event_end_date_time';
|
||||
import * as migration_20260429_121105_collapsible_map_with_text from './20260429_121105_collapsible_map_with_text';
|
||||
import * as migration_20260504_070356_next_prev_buttons from './20260504_070356_next_prev_buttons';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -268,6 +269,11 @@ export const migrations = [
|
|||
{
|
||||
up: migration_20260429_121105_collapsible_map_with_text.up,
|
||||
down: migration_20260429_121105_collapsible_map_with_text.down,
|
||||
name: '20260429_121105_collapsible_map_with_text'
|
||||
name: '20260429_121105_collapsible_map_with_text',
|
||||
},
|
||||
{
|
||||
up: migration_20260504_070356_next_prev_buttons.up,
|
||||
down: migration_20260504_070356_next_prev_buttons.down,
|
||||
name: '20260504_070356_next_prev_buttons'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -297,6 +297,19 @@ export interface Parish {
|
|||
blockName?: string | null;
|
||||
blockType: 'collapsibles';
|
||||
}
|
||||
| {
|
||||
prev?: {
|
||||
text?: string | null;
|
||||
href?: string | null;
|
||||
};
|
||||
next?: {
|
||||
text?: string | null;
|
||||
href?: string | null;
|
||||
};
|
||||
id?: string | null;
|
||||
blockName?: string | null;
|
||||
blockType: 'nextPrevButtons';
|
||||
}
|
||||
)[]
|
||||
| null;
|
||||
contact: string;
|
||||
|
|
@ -879,6 +892,19 @@ export interface Group {
|
|||
blockName?: string | null;
|
||||
blockType: 'collapsibles';
|
||||
}
|
||||
| {
|
||||
prev?: {
|
||||
text?: string | null;
|
||||
href?: string | null;
|
||||
};
|
||||
next?: {
|
||||
text?: string | null;
|
||||
href?: string | null;
|
||||
};
|
||||
id?: string | null;
|
||||
blockName?: string | null;
|
||||
blockType: 'nextPrevButtons';
|
||||
}
|
||||
)[]
|
||||
| null;
|
||||
updatedAt: string;
|
||||
|
|
@ -1639,6 +1665,24 @@ export interface ParishSelect<T extends boolean = true> {
|
|||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
nextPrevButtons?:
|
||||
| T
|
||||
| {
|
||||
prev?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
href?: T;
|
||||
};
|
||||
next?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
href?: T;
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
contact?: T;
|
||||
photo?: T;
|
||||
|
|
@ -2034,6 +2078,24 @@ export interface GroupSelect<T extends boolean = true> {
|
|||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
nextPrevButtons?:
|
||||
| T
|
||||
| {
|
||||
prev?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
href?: T;
|
||||
};
|
||||
next?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
href?: T;
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
|
|
|
|||
Loading…
Reference in a new issue