-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚸 (pictureChoice) Allow dynamic picture choice with string variables
- Loading branch information
1 parent
d46e801
commit 1cb30e3
Showing
4 changed files
with
59 additions
and
32 deletions.
There are no files selected for viewing
36 changes: 28 additions & 8 deletions
36
...lder/src/features/blocks/integrations/googleSheets/components/GoogleSheetsNodeContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import React from 'react' | ||
import { Text } from '@chakra-ui/react' | ||
import { GoogleSheetsAction } from '@typebot.io/schemas' | ||
import { Stack, Text } from '@chakra-ui/react' | ||
import { GoogleSheetsAction, GoogleSheetsOptions } from '@typebot.io/schemas' | ||
import { useTypebot } from '@/features/editor/providers/TypebotProvider' | ||
import { SetVariableLabel } from '@/components/SetVariableLabel' | ||
|
||
type Props = { | ||
action?: GoogleSheetsAction | ||
options?: GoogleSheetsOptions | ||
} | ||
|
||
export const GoogleSheetsNodeContent = ({ action }: Props) => ( | ||
<Text color={action ? 'currentcolor' : 'gray.500'} noOfLines={1}> | ||
{action ?? 'Configure...'} | ||
</Text> | ||
) | ||
export const GoogleSheetsNodeContent = ({ options }: Props) => { | ||
const { typebot } = useTypebot() | ||
return ( | ||
<Stack> | ||
<Text color={options?.action ? 'currentcolor' : 'gray.500'} noOfLines={1}> | ||
{options?.action ?? 'Configure...'} | ||
</Text> | ||
{typebot && | ||
options?.action === GoogleSheetsAction.GET && | ||
options?.cellsToExtract | ||
.map((mapping) => mapping.variableId) | ||
.map((variableId, idx) => | ||
variableId ? ( | ||
<SetVariableLabel | ||
key={variableId + idx} | ||
variables={typebot.variables} | ||
variableId={variableId} | ||
/> | ||
) : null | ||
)} | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters