2
0

feat(engine): Add Rating input

This commit is contained in:
Baptiste Arnaud
2022-06-07 19:09:08 +02:00
parent 301097623b
commit b1aecf843b
19 changed files with 455 additions and 28 deletions

View File

@ -22,6 +22,7 @@ import { ConfigureContent } from './contents/ConfigureContent'
import { ImageBubbleContent } from './contents/ImageBubbleContent'
import { PaymentInputContent } from './contents/PaymentInputContent'
import { PlaceholderContent } from './contents/PlaceholderContent'
import { RatingInputContent } from './contents/RatingInputContent'
import { SendEmailContent } from './contents/SendEmailContent'
import { TypebotLinkContent } from './contents/TypebotLinkContent'
import { ProviderWebhookContent } from './contents/ZapierContent'
@ -30,7 +31,7 @@ type Props = {
step: Step | StartStep
indices: StepIndices
}
export const StepNodeContent = ({ step, indices }: Props) => {
export const StepNodeContent = ({ step, indices }: Props): JSX.Element => {
if (isInputStep(step) && !isChoiceInput(step) && step.options.variableId) {
return <WithVariableContent step={step} />
}
@ -72,6 +73,9 @@ export const StepNodeContent = ({ step, indices }: Props) => {
case InputStepType.PAYMENT: {
return <PaymentInputContent step={step} />
}
case InputStepType.RATING: {
return <RatingInputContent step={step} />
}
case LogicStepType.SET_VARIABLE: {
return <SetVariableContent step={step} />
}
@ -144,8 +148,5 @@ export const StepNodeContent = ({ step, indices }: Props) => {
case 'start': {
return <Text>Start</Text>
}
default: {
return <Text>No input</Text>
}
}
}

View File

@ -0,0 +1,12 @@
import { Text } from '@chakra-ui/react'
import { RatingInputStep } from 'models'
type Props = {
step: RatingInputStep
}
export const RatingInputContent = ({ step }: Props) => (
<Text noOfLines={0} pr="6">
Rate from 1 to {step.options.length}
</Text>
)