(s3) Improve storage management and type safety

Closes #756
This commit is contained in:
Baptiste Arnaud
2023-09-08 15:28:11 +02:00
parent 43be38cf50
commit fbb198af9d
47 changed files with 790 additions and 128 deletions

View File

@@ -284,7 +284,11 @@ export const BlockNode = ({
)}
{typebot && isMediaBubbleBlock(block) && (
<MediaBubblePopoverContent
typebotId={typebot.id}
uploadFileProps={{
workspaceId: typebot.workspaceId,
typebotId: typebot.id,
blockId: block.id,
}}
block={block}
onContentChange={handleContentChange}
/>

View File

@@ -2,6 +2,7 @@ import { AudioBubbleForm } from '@/features/blocks/bubbles/audio/components/Audi
import { EmbedUploadContent } from '@/features/blocks/bubbles/embed/components/EmbedUploadContent'
import { ImageBubbleSettings } from '@/features/blocks/bubbles/image/components/ImageBubbleSettings'
import { VideoUploadContent } from '@/features/blocks/bubbles/video/components/VideoUploadContent'
import { FilePathUploadProps } from '@/features/upload/api/generateUploadUrl'
import {
Portal,
PopoverContent,
@@ -17,7 +18,7 @@ import {
import { useRef } from 'react'
type Props = {
typebotId: string
uploadFileProps: FilePathUploadProps
block: Exclude<BubbleBlock, TextBubbleBlock>
onContentChange: (content: BubbleBlockContent) => void
}
@@ -42,7 +43,7 @@ export const MediaBubblePopoverContent = (props: Props) => {
}
export const MediaBubbleContent = ({
typebotId,
uploadFileProps,
block,
onContentChange,
}: Props) => {
@@ -50,7 +51,7 @@ export const MediaBubbleContent = ({
case BubbleBlockType.IMAGE: {
return (
<ImageBubbleSettings
typebotId={typebotId}
uploadFileProps={uploadFileProps}
block={block}
onContentChange={onContentChange}
/>
@@ -76,7 +77,7 @@ export const MediaBubbleContent = ({
return (
<AudioBubbleForm
content={block.content}
fileUploadPath={`typebots/${typebotId}/blocks/${block.id}`}
uploadFileProps={uploadFileProps}
onContentChange={onContentChange}
/>
)