♻️ Re-organize workspace folders
This commit is contained in:
19
packages/schemas/features/blocks/bubbles/audio.ts
Normal file
19
packages/schemas/features/blocks/bubbles/audio.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { z } from 'zod'
|
||||
import { blockBaseSchema } from '../baseSchemas'
|
||||
import { BubbleBlockType } from './enums'
|
||||
|
||||
export const audioBubbleContentSchema = z.object({
|
||||
url: z.string().optional(),
|
||||
})
|
||||
|
||||
export const audioBubbleBlockSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([BubbleBlockType.AUDIO]),
|
||||
content: audioBubbleContentSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export const defaultAudioBubbleContent = {}
|
||||
|
||||
export type AudioBubbleBlock = z.infer<typeof audioBubbleBlockSchema>
|
||||
export type AudioBubbleContent = z.infer<typeof audioBubbleContentSchema>
|
21
packages/schemas/features/blocks/bubbles/embed.ts
Normal file
21
packages/schemas/features/blocks/bubbles/embed.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { z } from 'zod'
|
||||
import { variableStringSchema } from '../../utils'
|
||||
import { blockBaseSchema } from '../baseSchemas'
|
||||
import { BubbleBlockType } from './enums'
|
||||
|
||||
export const embedBubbleContentSchema = z.object({
|
||||
url: z.string().optional(),
|
||||
height: z.number().or(variableStringSchema),
|
||||
})
|
||||
|
||||
export const embedBubbleBlockSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([BubbleBlockType.EMBED]),
|
||||
content: embedBubbleContentSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export const defaultEmbedBubbleContent: EmbedBubbleContent = { height: 400 }
|
||||
|
||||
export type EmbedBubbleBlock = z.infer<typeof embedBubbleBlockSchema>
|
||||
export type EmbedBubbleContent = z.infer<typeof embedBubbleContentSchema>
|
7
packages/schemas/features/blocks/bubbles/enums.ts
Normal file
7
packages/schemas/features/blocks/bubbles/enums.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export enum BubbleBlockType {
|
||||
TEXT = 'text',
|
||||
IMAGE = 'image',
|
||||
VIDEO = 'video',
|
||||
EMBED = 'embed',
|
||||
AUDIO = 'audio',
|
||||
}
|
19
packages/schemas/features/blocks/bubbles/image.ts
Normal file
19
packages/schemas/features/blocks/bubbles/image.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { z } from 'zod'
|
||||
import { blockBaseSchema } from '../baseSchemas'
|
||||
import { BubbleBlockType } from './enums'
|
||||
|
||||
export const imageBubbleContentSchema = z.object({
|
||||
url: z.string().optional(),
|
||||
})
|
||||
|
||||
export const imageBubbleBlockSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([BubbleBlockType.IMAGE]),
|
||||
content: imageBubbleContentSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export const defaultImageBubbleContent: ImageBubbleContent = {}
|
||||
|
||||
export type ImageBubbleBlock = z.infer<typeof imageBubbleBlockSchema>
|
||||
export type ImageBubbleContent = z.infer<typeof imageBubbleContentSchema>
|
6
packages/schemas/features/blocks/bubbles/index.ts
Normal file
6
packages/schemas/features/blocks/bubbles/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './audio'
|
||||
export * from './embed'
|
||||
export * from './image'
|
||||
export * from './text'
|
||||
export * from './video'
|
||||
export * from './enums'
|
26
packages/schemas/features/blocks/bubbles/text.ts
Normal file
26
packages/schemas/features/blocks/bubbles/text.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { z } from 'zod'
|
||||
import { blockBaseSchema } from '../baseSchemas'
|
||||
import { BubbleBlockType } from './enums'
|
||||
|
||||
export const defaultTextBubbleContent: TextBubbleContent = {
|
||||
html: '',
|
||||
richText: [],
|
||||
plainText: '',
|
||||
}
|
||||
|
||||
export const textBubbleContentSchema = z.object({
|
||||
html: z.string(),
|
||||
richText: z.array(z.any()),
|
||||
plainText: z.string(),
|
||||
})
|
||||
|
||||
export type TextBubbleContent = z.infer<typeof textBubbleContentSchema>
|
||||
|
||||
export const textBubbleBlockSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([BubbleBlockType.TEXT]),
|
||||
content: textBubbleContentSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export type TextBubbleBlock = z.infer<typeof textBubbleBlockSchema>
|
5
packages/schemas/features/blocks/bubbles/video/enums.ts
Normal file
5
packages/schemas/features/blocks/bubbles/video/enums.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export enum VideoBubbleContentType {
|
||||
URL = 'url',
|
||||
YOUTUBE = 'youtube',
|
||||
VIMEO = 'vimeo',
|
||||
}
|
2
packages/schemas/features/blocks/bubbles/video/index.ts
Normal file
2
packages/schemas/features/blocks/bubbles/video/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './enums'
|
||||
export * from './schemas'
|
22
packages/schemas/features/blocks/bubbles/video/schemas.ts
Normal file
22
packages/schemas/features/blocks/bubbles/video/schemas.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { z } from 'zod'
|
||||
import { blockBaseSchema } from '../../baseSchemas'
|
||||
import { BubbleBlockType } from '../enums'
|
||||
import { VideoBubbleContentType } from './enums'
|
||||
|
||||
export const videoBubbleContentSchema = z.object({
|
||||
url: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
type: z.nativeEnum(VideoBubbleContentType).optional(),
|
||||
})
|
||||
|
||||
export const videoBubbleBlockSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([BubbleBlockType.VIDEO]),
|
||||
content: videoBubbleContentSchema,
|
||||
})
|
||||
)
|
||||
|
||||
export const defaultVideoBubbleContent: VideoBubbleContent = {}
|
||||
|
||||
export type VideoBubbleBlock = z.infer<typeof videoBubbleBlockSchema>
|
||||
export type VideoBubbleContent = z.infer<typeof videoBubbleContentSchema>
|
Reference in New Issue
Block a user