2
0

feat(editor): Start preview from any block

This commit is contained in:
Baptiste Arnaud
2022-06-02 10:07:50 +02:00
parent 12f2e40152
commit 89d91f9114
15 changed files with 128 additions and 29 deletions

View File

@ -13,18 +13,23 @@ export enum RightPanel {
const editorContext = createContext<{
rightPanel?: RightPanel
setRightPanel: Dispatch<SetStateAction<RightPanel | undefined>>
startPreviewAtBlock: string | undefined
setStartPreviewAtBlock: Dispatch<SetStateAction<string | undefined>>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})
export const EditorContext = ({ children }: { children: ReactNode }) => {
const [rightPanel, setRightPanel] = useState<RightPanel>()
const [startPreviewAtBlock, setStartPreviewAtBlock] = useState<string>()
return (
<editorContext.Provider
value={{
rightPanel,
setRightPanel,
startPreviewAtBlock,
setStartPreviewAtBlock,
}}
>
{children}

View File

@ -440,9 +440,11 @@ const useLinkedTypebots = ({
},
Error
>(
typebotIds?.every((id) => typebotId === id)
? undefined
: `/api/typebots?${params}`,
workspaceId
? typebotIds?.every((id) => typebotId === id)
? undefined
: `/api/typebots?${params}`
: null,
fetcher
)
if (error) onError(error)

View File

@ -5,7 +5,7 @@ import {
useEffect,
useState,
} from 'react'
import { byId } from 'utils'
import { byId, isNotEmpty } from 'utils'
import { MemberInWorkspace, Plan, Workspace, WorkspaceRole } from 'db'
import {
createNewWorkspace,