refactor(editor): ♻️ Undo / Redo buttons + structure refacto
Yet another huge refacto... While implementing undo and redo features I understood that I updated the stored typebot too many times (i.e. on each key input) so I had to rethink it entirely. I also moved around some files.
This commit is contained in:
70
apps/builder/components/editor/StepsSideBar/StepIcon.tsx
Normal file
70
apps/builder/components/editor/StepsSideBar/StepIcon.tsx
Normal file
@ -0,0 +1,70 @@
|
||||
import { IconProps } from '@chakra-ui/react'
|
||||
import {
|
||||
CalendarIcon,
|
||||
ChatIcon,
|
||||
CheckSquareIcon,
|
||||
EditIcon,
|
||||
EmailIcon,
|
||||
ExternalLinkIcon,
|
||||
FilmIcon,
|
||||
FilterIcon,
|
||||
FlagIcon,
|
||||
GlobeIcon,
|
||||
ImageIcon,
|
||||
NumberIcon,
|
||||
PhoneIcon,
|
||||
TextIcon,
|
||||
WebhookIcon,
|
||||
} from 'assets/icons'
|
||||
import { GoogleAnalyticsLogo, GoogleSheetsLogo } from 'assets/logos'
|
||||
import {
|
||||
BubbleStepType,
|
||||
InputStepType,
|
||||
IntegrationStepType,
|
||||
LogicStepType,
|
||||
StepType,
|
||||
} from 'models'
|
||||
import React from 'react'
|
||||
|
||||
type StepIconProps = { type: StepType } & IconProps
|
||||
|
||||
export const StepIcon = ({ type, ...props }: StepIconProps) => {
|
||||
switch (type) {
|
||||
case BubbleStepType.TEXT:
|
||||
return <ChatIcon color="blue.500" {...props} />
|
||||
case BubbleStepType.IMAGE:
|
||||
return <ImageIcon color="blue.500" {...props} />
|
||||
case BubbleStepType.VIDEO:
|
||||
return <FilmIcon color="blue.500" {...props} />
|
||||
case InputStepType.TEXT:
|
||||
return <TextIcon color="orange.500" {...props} />
|
||||
case InputStepType.NUMBER:
|
||||
return <NumberIcon color="orange.500" {...props} />
|
||||
case InputStepType.EMAIL:
|
||||
return <EmailIcon color="orange.500" {...props} />
|
||||
case InputStepType.URL:
|
||||
return <GlobeIcon color="orange.500" {...props} />
|
||||
case InputStepType.DATE:
|
||||
return <CalendarIcon color="orange.500" {...props} />
|
||||
case InputStepType.PHONE:
|
||||
return <PhoneIcon color="orange.500" {...props} />
|
||||
case InputStepType.CHOICE:
|
||||
return <CheckSquareIcon color="orange.500" {...props} />
|
||||
case LogicStepType.SET_VARIABLE:
|
||||
return <EditIcon color="purple.500" {...props} />
|
||||
case LogicStepType.CONDITION:
|
||||
return <FilterIcon color="purple.500" {...props} />
|
||||
case LogicStepType.REDIRECT:
|
||||
return <ExternalLinkIcon color="purple.500" {...props} />
|
||||
case IntegrationStepType.GOOGLE_SHEETS:
|
||||
return <GoogleSheetsLogo {...props} />
|
||||
case IntegrationStepType.GOOGLE_ANALYTICS:
|
||||
return <GoogleAnalyticsLogo {...props} />
|
||||
case IntegrationStepType.WEBHOOK:
|
||||
return <WebhookIcon />
|
||||
case 'start':
|
||||
return <FlagIcon {...props} />
|
||||
default:
|
||||
return <></>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user