2
0

fix(analytics): 🐛 Analytics board

This commit is contained in:
Baptiste Arnaud
2022-02-11 18:06:59 +01:00
parent 93fed893c0
commit 7c164e25d7
13 changed files with 179 additions and 108 deletions

View File

@ -12,9 +12,9 @@ import { headerHeight } from 'components/shared/TypebotHeader'
export const computeDropOffPath = (
sourcePosition: Coordinates,
sourceStepIndex: number
sourceTop: number
) => {
const sourceCoord = computeSourceCoordinates(sourcePosition, sourceStepIndex)
const sourceCoord = computeSourceCoordinates(sourcePosition, sourceTop)
const segments = computeTwoSegments(sourceCoord, {
x: sourceCoord.x + 20,
y: sourceCoord.y + 80,
@ -276,7 +276,8 @@ export const computeEdgePathToMouse = ({
export const getEndpointTopOffset = (
graphPosition: Coordinates,
endpoints: IdMap<Endpoint>,
endpointId?: string
endpointId?: string,
isAnalytics?: boolean
): number | undefined => {
if (!endpointId) return
const endpointRef = endpoints[endpointId]?.ref
@ -285,7 +286,8 @@ export const getEndpointTopOffset = (
8 +
(endpointRef.current?.getBoundingClientRect().top ?? 0) -
graphPosition.y -
headerHeight
headerHeight -
(isAnalytics ? 60 : 0)
)
}

View File

@ -1,6 +1,6 @@
import imageCompression from 'browser-image-compression'
import { Parser } from 'htmlparser2'
import { Step, Typebot } from 'models'
import { PublicStep, Step, Typebot } from 'models'
export const fetcher = async (input: RequestInfo, init?: RequestInit) => {
const res = await fetch(input, init)
@ -98,7 +98,7 @@ export const removeUndefinedFields = <T>(obj: T): T =>
{} as T
)
export const stepHasOptions = (step: Step) => 'options' in step
export const stepHasOptions = (step: Step | PublicStep) => 'options' in step
export const parseVariableHighlight = (content: string, typebot: Typebot) => {
const varNames = typebot.variables.map((v) => v.name)