2
0

♻️ Rename Code block to Script block

Closes #245
This commit is contained in:
Baptiste Arnaud
2023-01-27 15:58:05 +01:00
parent 068f9bbd17
commit a842f57297
35 changed files with 113 additions and 103 deletions

View File

@ -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} />
)

View File

@ -1,3 +0,0 @@
export { CodeSettings } from './components/CodeSettings'
export { CodeNodeContent } from './components/CodeNodeContent'
export { CodeIcon } from './components/CodeIcon'

View File

@ -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>
)

View File

@ -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>

View File

@ -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) =>

View File

@ -0,0 +1,3 @@
export { ScriptSettings } from './components/ScriptSettings'
export { ScriptNodeContent } from './components/ScriptNodeContent'
export { ScriptIcon } from './components/ScriptIcon'

View File

@ -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,
})