import React, { useEffect } from 'react';
import Widget from 'App/mstore/types/widget';
import Funnelbar from './FunnelBar';
import cn from 'classnames';
import stl from './FunnelWidget.module.css';
import { useObserver } from 'mobx-react-lite';
import { NoContent, Icon } from 'UI';
import { useModal } from 'App/components/Modal';
interface Props {
metric: Widget;
isWidget?: boolean;
data: any;
}
function FunnelWidget(props: Props) {
const { metric, isWidget = false, data } = props;
const funnel = data.funnel || { stages: [] };
const totalSteps = funnel.stages.length;
const stages = isWidget ? [...funnel.stages.slice(0, 1), funnel.stages[funnel.stages.length - 1]] : funnel.stages;
const hasMoreSteps = funnel.stages.length > 2;
const lastStage = funnel.stages[funnel.stages.length - 1];
const remainingSteps = totalSteps - 2;
const { hideModal } = useModal();
useEffect(() => {
return () => {
if (isWidget) return;
hideModal();
}
}, []);
return useObserver(() => (