refactor(models): 🎨 Build types from validation schemas
This commit is contained in:
@ -70,11 +70,13 @@ export const ResultsContent = () => {
|
||||
</HStack>
|
||||
</Flex>
|
||||
<Flex pt={['10px', '60px']} w="full" justify="center">
|
||||
{publishedTypebot &&
|
||||
{workspace &&
|
||||
publishedTypebot &&
|
||||
(isAnalytics ? (
|
||||
<AnalyticsContent stats={stats} />
|
||||
) : (
|
||||
<SubmissionsContent
|
||||
workspaceId={workspace.id}
|
||||
typebotId={publishedTypebot.typebotId}
|
||||
onDeleteResults={handleDeletedResults}
|
||||
totalResults={stats?.totalStarts ?? 0}
|
||||
|
@ -18,12 +18,14 @@ import { Plan } from 'db'
|
||||
import { useToast } from 'components/shared/hooks/useToast'
|
||||
|
||||
type Props = {
|
||||
workspaceId: string
|
||||
typebotId: string
|
||||
totalResults: number
|
||||
totalHiddenResults?: number
|
||||
onDeleteResults: (total: number) => void
|
||||
}
|
||||
export const SubmissionsContent = ({
|
||||
workspaceId,
|
||||
typebotId,
|
||||
totalResults,
|
||||
totalHiddenResults,
|
||||
@ -51,6 +53,7 @@ export const SubmissionsContent = ({
|
||||
const resultHeader = parseResultHeader(blocksAndVariables)
|
||||
|
||||
const { data, mutate, setSize, hasMore } = useResults({
|
||||
workspaceId,
|
||||
typebotId,
|
||||
onError: (err) => showToast({ title: err.name, description: err.message }),
|
||||
})
|
||||
@ -125,7 +128,7 @@ export const SubmissionsContent = ({
|
||||
|
||||
const getAllTableData = async () => {
|
||||
if (!publishedTypebot) return []
|
||||
const results = await getAllResults(typebotId)
|
||||
const results = await getAllResults(workspaceId, typebotId)
|
||||
return convertResultsToTableData(results, resultHeader)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user