2
0

Add OpenAI block

Also migrate credentials to tRPC

Closes #253
This commit is contained in:
Baptiste Arnaud
2023-03-09 08:46:36 +01:00
parent 97cfdfe79f
commit ff04edf139
86 changed files with 2583 additions and 1055 deletions

View File

@ -19,7 +19,7 @@ export const CellWithValueStack = ({
}
return (
<Stack p="4" rounded="md" flex="1" borderWidth="1px" w="full">
<DropdownList<string>
<DropdownList
currentItem={item.column}
onItemSelect={handleColumnSelect}
items={columns}

View File

@ -21,7 +21,7 @@ export const CellWithVariableIdStack = ({
return (
<Stack p="4" rounded="md" flex="1" borderWidth="1px">
<DropdownList<string>
<DropdownList
currentItem={item.column}
onItemSelect={handleColumnSelect}
items={columns}

View File

@ -3,7 +3,6 @@ import { DropdownList } from '@/components/DropdownList'
import { useTypebot } from '@/features/editor'
import {
Cell,
CredentialsType,
defaultGoogleSheetsGetOptions,
defaultGoogleSheetsInsertOptions,
defaultGoogleSheetsUpdateOptions,
@ -27,6 +26,7 @@ import { useSheets } from '../../hooks/useSheets'
import { Sheet } from '../../types'
import { RowsFilterTableList } from './RowsFilterTableList'
import { createId } from '@paralleldrive/cuid2'
import { useWorkspace } from '@/features/workspace'
type Props = {
options: GoogleSheetsOptions
@ -39,6 +39,7 @@ export const GoogleSheetsSettingsBody = ({
onOptionsChange,
blockId,
}: Props) => {
const { workspace } = useWorkspace()
const { save } = useTypebot()
const { sheets, isLoading } = useSheets({
credentialsId: options?.credentialsId,
@ -94,12 +95,15 @@ export const GoogleSheetsSettingsBody = ({
return (
<Stack>
<CredentialsDropdown
type={CredentialsType.GOOGLE_SHEETS}
currentCredentialsId={options?.credentialsId}
onCredentialsSelect={handleCredentialsIdChange}
onCreateNewClick={handleCreateNewClick}
/>
{workspace && (
<CredentialsDropdown
type="google sheets"
workspaceId={workspace.id}
currentCredentialsId={options?.credentialsId}
onCredentialsSelect={handleCredentialsIdChange}
onCreateNewClick={handleCreateNewClick}
/>
)}
<GoogleSheetConnectModal
blockId={blockId}
isOpen={isOpen}
@ -125,7 +129,7 @@ export const GoogleSheetsSettingsBody = ({
isDefined(options.sheetId) && (
<>
<Divider />
<DropdownList<GoogleSheetsAction>
<DropdownList
currentItem={'action' in options ? options.action : undefined}
onItemSelect={handleActionChange}
items={Object.values(GoogleSheetsAction)}

View File

@ -29,13 +29,13 @@ export const RowsFilterComparisonItem = ({
return (
<Stack p="4" rounded="md" flex="1" borderWidth="1px">
<DropdownList<string>
<DropdownList
currentItem={item.column}
onItemSelect={handleColumnSelect}
items={columns}
placeholder="Select a column"
/>
<DropdownList<ComparisonOperators>
<DropdownList
currentItem={item.comparisonOperator}
onItemSelect={handleSelectComparisonOperator}
items={Object.values(ComparisonOperators)}

View File

@ -42,7 +42,7 @@ export const RowsFilterTableList = ({
Item={createRowsFilterComparisonItem}
ComponentBetweenItems={() => (
<Flex justify="center">
<DropdownList<LogicalOperator>
<DropdownList
currentItem={filter?.logicalOperator}
onItemSelect={handleLogicalOperatorChange}
items={Object.values(LogicalOperator)}