import { Stack } from '@chakra-ui/react' import { SubmissionsTable } from 'components/results/ResultsTable' import React, { useState } from 'react' import { UnlockPlanInfo } from 'components/shared/Info' import { LogsModal } from './LogsModal' import { useTypebot } from 'contexts/TypebotContext' import { Plan } from 'db' import { useResults } from 'contexts/ResultsProvider' import { ResultModal } from './ResultModal' export const ResultsContent = () => { const { flatResults: results, fetchMore, hasMore, resultHeader, totalHiddenResults, tableData, } = useResults() const { typebot, publishedTypebot } = useTypebot() const [inspectingLogsResultId, setInspectingLogsResultId] = useState< string | null >(null) const [expandedResultIndex, setExpandedResultIndex] = useState( null ) const handleLogsModalClose = () => setInspectingLogsResultId(null) const handleResultModalClose = () => setExpandedResultIndex(null) const handleLogOpenIndex = (index: number) => () => { if (!results) return setInspectingLogsResultId(results[index].id) } const handleResultExpandIndex = (index: number) => () => setExpandedResultIndex(index) return ( {totalHiddenResults && ( )} {publishedTypebot && ( )} {typebot && ( )} ) }