@ -1,7 +0,0 @@
|
||||
import { CodeIcon as CodeIco } from '@/components/icons'
|
||||
import { IconProps } from '@chakra-ui/react'
|
||||
import React from 'react'
|
||||
|
||||
export const CodeIcon = (props: IconProps) => (
|
||||
<CodeIco color="purple.500" {...props} />
|
||||
)
|
@ -1,3 +0,0 @@
|
||||
export { CodeSettings } from './components/CodeSettings'
|
||||
export { CodeNodeContent } from './components/CodeNodeContent'
|
||||
export { CodeIcon } from './components/CodeIcon'
|
@ -0,0 +1,15 @@
|
||||
import { featherIconsBaseProps } from '@/components/icons'
|
||||
import { Icon, IconProps, useColorModeValue } from '@chakra-ui/react'
|
||||
import React from 'react'
|
||||
|
||||
export const ScriptIcon = (props: IconProps) => (
|
||||
<Icon
|
||||
viewBox="0 0 24 24"
|
||||
color={useColorModeValue('purple.500', 'purple.300')}
|
||||
{...featherIconsBaseProps}
|
||||
{...props}
|
||||
>
|
||||
<polyline points="4 17 10 11 4 5"></polyline>
|
||||
<line x1="12" y1="19" x2="20" y2="19"></line>
|
||||
</Icon>
|
||||
)
|
@ -1,10 +1,10 @@
|
||||
import React from 'react'
|
||||
import { Text } from '@chakra-ui/react'
|
||||
import { CodeOptions } from 'models'
|
||||
import { ScriptOptions } from 'models'
|
||||
|
||||
type Props = CodeOptions
|
||||
type Props = ScriptOptions
|
||||
|
||||
export const CodeNodeContent = ({ name, content }: Props) => (
|
||||
export const ScriptNodeContent = ({ name, content }: Props) => (
|
||||
<Text color={content ? 'currentcolor' : 'gray.500'} noOfLines={1}>
|
||||
{content ? `Run ${name}` : 'Configure...'}
|
||||
</Text>
|
@ -1,16 +1,16 @@
|
||||
import { FormLabel, Stack, Text } from '@chakra-ui/react'
|
||||
import { CodeEditor } from '@/components/CodeEditor'
|
||||
import { CodeOptions } from 'models'
|
||||
import React from 'react'
|
||||
import { SwitchWithLabel } from '@/components/SwitchWithLabel'
|
||||
import { Input } from '@/components/inputs'
|
||||
import { ScriptOptions } from 'models'
|
||||
|
||||
type Props = {
|
||||
options: CodeOptions
|
||||
onOptionsChange: (options: CodeOptions) => void
|
||||
options: ScriptOptions
|
||||
onOptionsChange: (options: ScriptOptions) => void
|
||||
}
|
||||
|
||||
export const CodeSettings = ({ options, onOptionsChange }: Props) => {
|
||||
export const ScriptSettings = ({ options, onOptionsChange }: Props) => {
|
||||
const handleNameChange = (name: string) =>
|
||||
onOptionsChange({ ...options, name })
|
||||
const handleCodeChange = (content: string) =>
|
3
apps/builder/src/features/blocks/logic/script/index.ts
Normal file
3
apps/builder/src/features/blocks/logic/script/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export { ScriptSettings } from './components/ScriptSettings'
|
||||
export { ScriptNodeContent } from './components/ScriptNodeContent'
|
||||
export { ScriptIcon } from './components/ScriptIcon'
|
@ -6,9 +6,9 @@ import { getTestAsset } from '@/test/utils/playwright'
|
||||
|
||||
const typebotId = cuid()
|
||||
|
||||
test.describe('Code block', () => {
|
||||
test('code should trigger', async ({ page }) => {
|
||||
await importTypebotInDatabase(getTestAsset('typebots/logic/code.json'), {
|
||||
test.describe('Script block', () => {
|
||||
test('script should trigger', async ({ page }) => {
|
||||
await importTypebotInDatabase(getTestAsset('typebots/logic/script.json'), {
|
||||
id: typebotId,
|
||||
})
|
||||
|
Reference in New Issue
Block a user