2
0

feat(engine): Add retry bubbles

This commit is contained in:
Baptiste Arnaud
2022-02-10 10:25:38 +01:00
parent 276f1c1e90
commit 8c8d77e052
15 changed files with 217 additions and 29 deletions

View File

@ -1,9 +1,10 @@
import { PublicTypebot } from 'models'
import { Edge, PublicTypebot } from 'models'
import React, { createContext, ReactNode, useContext, useState } from 'react'
const typebotContext = createContext<{
typebot: PublicTypebot
updateVariableValue: (variableId: string, value: string) => void
createEdge: (edge: Edge) => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})
@ -25,11 +26,20 @@ export const TypebotContext = ({
),
}))
}
const createEdge = (edge: Edge) => {
setLocalTypebot((typebot) => ({
...typebot,
edges: [...typebot.edges, edge],
}))
}
return (
<typebotContext.Provider
value={{
typebot: localTypebot,
updateVariableValue,
createEdge,
}}
>
{children}