import React, { useEffect, useState } from 'react';
import FlowEditor from '@/pages/flowEditor/index';
import { useSelector } from 'react-redux';

const ProjectContainer = ({ selected }) => {
  const { flowData } = useSelector(state => state.ideContainer);
  const [selectedFlowData, setSelectedFlowData] = useState<any>({});

  useEffect(() => {
    setSelectedFlowData(flowData[selected.id]);
  }, [selected]);

  return (
    <FlowEditor initialData={selectedFlowData} />
  );
};

export default ProjectContainer;