2
0

feat(theme): Custom avatars

This commit is contained in:
Baptiste Arnaud
2022-02-16 15:08:50 +01:00
parent 1d3917f440
commit d2ac13ba5f
14 changed files with 294 additions and 81 deletions

View File

@ -1,5 +1,11 @@
import { Edge, PublicTypebot } from 'models'
import React, { createContext, ReactNode, useContext, useState } from 'react'
import React, {
createContext,
ReactNode,
useContext,
useEffect,
useState,
} from 'react'
const typebotContext = createContext<{
typebot: PublicTypebot
@ -24,6 +30,11 @@ export const TypebotContext = ({
}) => {
const [localTypebot, setLocalTypebot] = useState<PublicTypebot>(typebot)
useEffect(() => {
setLocalTypebot({ ...localTypebot, theme: typebot.theme })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [typebot.theme])
const updateVariableValue = (variableId: string, value: string) => {
setLocalTypebot((typebot) => ({
...typebot,