From 1628b955897e67520fec8f4326ef6b2fa7b847e7 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Wed, 13 Mar 2024 04:08:23 +0100 Subject: [PATCH] Removed spacer block --- src/blocks/sectionBlock.ts | 2 -- src/blocks/spacerBlock.ts | 20 -------------------- src/blocks/transcriptBlock.ts | 3 +-- src/collections/Pages/Pages.ts | 3 +-- src/constants.ts | 20 +------------------- src/styles.scss | 4 +--- src/types/collections.ts | 10 +--------- 7 files changed, 5 insertions(+), 57 deletions(-) delete mode 100644 src/blocks/spacerBlock.ts diff --git a/src/blocks/sectionBlock.ts b/src/blocks/sectionBlock.ts index 951650b..ea0de05 100644 --- a/src/blocks/sectionBlock.ts +++ b/src/blocks/sectionBlock.ts @@ -1,6 +1,5 @@ import { Block } from "payload/types"; import { createEditor } from "../utils/editor"; -import { spacerBlock } from "./spacerBlock"; import { transcriptBlock } from "./transcriptBlock"; const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ @@ -25,7 +24,6 @@ const generateRecursiveSectionBlock = (depth = 1, maxDepth = 5): Block => ({ alignment: true, blocks: [ ...(depth < maxDepth ? [generateRecursiveSectionBlock(depth + 1, maxDepth)] : []), - spacerBlock, transcriptBlock, ], }), diff --git a/src/blocks/spacerBlock.ts b/src/blocks/spacerBlock.ts deleted file mode 100644 index 601e98a..0000000 --- a/src/blocks/spacerBlock.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Block } from "payload/types"; -import { SpacerSizes } from "../constants"; - -export const spacerBlock: Block = { - slug: "spacerBlock", - interfaceName: "SpacerBlock", - labels: { singular: "Spacer", plural: "Spacers" }, - fields: [ - { - name: "size", - type: "radio", - defaultValue: "medium", - required: true, - options: Object.entries(SpacerSizes).map(([_, value]) => ({ - label: value, - value: value, - })), - }, - ], -}; diff --git a/src/blocks/transcriptBlock.ts b/src/blocks/transcriptBlock.ts index a744547..085261d 100644 --- a/src/blocks/transcriptBlock.ts +++ b/src/blocks/transcriptBlock.ts @@ -1,7 +1,6 @@ import { Block } from "payload/types"; import { cueBlock } from "./cueBlock"; import { lineBlock } from "./lineBlock"; -import { spacerBlock } from "./spacerBlock"; export const transcriptBlock: Block = { slug: "transcriptBlock", @@ -14,7 +13,7 @@ export const transcriptBlock: Block = { required: true, minRows: 1, admin: { initCollapsed: true, className: "no-label" }, - blocks: [lineBlock, cueBlock, spacerBlock], + blocks: [lineBlock, cueBlock], }, ], }; diff --git a/src/collections/Pages/Pages.ts b/src/collections/Pages/Pages.ts index b8a8a74..01a7bf2 100644 --- a/src/collections/Pages/Pages.ts +++ b/src/collections/Pages/Pages.ts @@ -1,6 +1,5 @@ import { Where } from "payload/types"; import { sectionBlock } from "../../blocks/sectionBlock"; -import { spacerBlock } from "../../blocks/spacerBlock"; import { transcriptBlock } from "../../blocks/transcriptBlock"; import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters"; import { CollectionGroups, Collections, PageType } from "../../constants"; @@ -142,7 +141,7 @@ export const Pages = buildVersionedCollectionConfig({ images: true, inlines: true, alignment: true, - blocks: [sectionBlock, spacerBlock, transcriptBlock], + blocks: [sectionBlock, transcriptBlock], links: true, lists: true, }), diff --git a/src/constants.ts b/src/constants.ts index 3cdfd84..195dfab 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,7 +1,6 @@ import type { Image, SectionBlock, - SpacerBlock, TranscriptBlock, } from "./types/collections"; @@ -90,13 +89,6 @@ export enum PageType { Generic = "Generic", } -export enum SpacerSizes { - Small = "Small", - Medium = "Medium", - Large = "Large", - XLarge = "Extra Large", -} - /* RICH TEXT */ export type RichTextContent = { @@ -210,10 +202,6 @@ export interface RichTextTranscriptBlock extends RichTextBlockNode { fields: TranscriptBlock; } -export interface RichTextSpacerBlock extends RichTextBlockNode { - fields: SpacerBlock; -} - export const isNodeParagraphNode = (node: RichTextNode): node is RichTextParagraphNode => node.type === "paragraph"; @@ -263,9 +251,6 @@ export const isBlockNodeTranscriptBlock = ( node: RichTextBlockNode ): node is RichTextTranscriptBlock => node.fields.blockType === "transcriptBlock"; -export const isBlockNodeSpacerBlock = (node: RichTextBlockNode): node is RichTextSpacerBlock => - node.fields.blockType === "spacerBlock"; - /* BLOCKS */ /* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */ @@ -293,7 +278,4 @@ export const isBlockCueBlock = (block: GenericBlock): block is CueBlock => block.blockType === "cueBlock"; export const isBlockLineBlock = (block: GenericBlock): block is LineBlock => - block.blockType === "lineBlock"; - -export const isBlockSpacerBlock = (block: GenericBlock): block is SpacerBlock => - block.blockType === "spacerBlock"; + block.blockType === "lineBlock"; \ No newline at end of file diff --git a/src/styles.scss b/src/styles.scss index 04abac1..f95aa3a 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -70,13 +70,11 @@ html[data-theme="light"] { display: none; } -.lexical-block__block-pill-transcriptBlock + .section-title, -.lexical-block__block-pill-spacerBlock + .section-title { +.lexical-block__block-pill-transcriptBlock + .section-title { display: none; } .blocks-field__block-pill-cueBlock + .section-title, -.blocks-field__block-pill-spacerBlock + .section-title, .blocks-field__block-pill-pageRange + .section-title, .blocks-field__block-pill-timeRange + .section-title, .blocks-field__block-pill-other + .section-title { diff --git a/src/types/collections.ts b/src/types/collections.ts index de14564..9e0d878 100644 --- a/src/types/collections.ts +++ b/src/types/collections.ts @@ -762,14 +762,6 @@ export interface PayloadMigration { updatedAt: string; createdAt: string; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "SpacerBlock". - */ -export interface SpacerBlock { - size: 'Small' | 'Medium' | 'Large' | 'Extra Large'; - blockType: 'spacerBlock'; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "LineBlock". @@ -819,7 +811,7 @@ export interface CueBlock { * via the `definition` "TranscriptBlock". */ export interface TranscriptBlock { - lines: (LineBlock | CueBlock | SpacerBlock)[]; + lines: (LineBlock | CueBlock)[]; id?: string | null; blockName?: string | null; blockType: 'transcriptBlock';