dify/web/app/components/explore/try-app/preview/flow-app-preview.tsx
Archie 72c92fa60a
refactor(web): mark Props of explore/try-app/preview components as read-only (#25219) (#37135)
Co-authored-by: archievi <13202986+archievi@users.noreply.github.com>
2026-06-07 12:36:03 +00:00

40 lines
907 B
TypeScript

'use client'
import type { FC } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
import * as React from 'react'
import Loading from '@/app/components/base/loading'
import WorkflowPreview from '@/app/components/workflow/workflow-preview'
import { useGetTryAppFlowPreview } from '@/service/use-try-app'
type Props = {
readonly appId: string
readonly className?: string
}
const FlowAppPreview: FC<Props> = ({
appId,
className,
}) => {
const { data, isLoading } = useGetTryAppFlowPreview(appId)
if (isLoading) {
return (
<div className="flex h-full items-center justify-center">
<Loading type="area" />
</div>
)
}
if (!data)
return null
return (
<div className="size-full">
<WorkflowPreview
{...data.graph}
className={cn(className)}
miniMapToRight
/>
</div>
)
}
export default React.memo(FlowAppPreview)