dify/web/app/components/explore/try-app/preview/flow-app-preview.tsx
yyh af7d5e60b4
feat(ui): scaffold @langgenius/dify-ui and migrate design tokens (#35256)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-04-15 13:11:20 +00:00

40 lines
893 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 = {
appId: string
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="h-full w-full">
<WorkflowPreview
{...data.graph}
className={cn(className)}
miniMapToRight
/>
</div>
)
}
export default React.memo(FlowAppPreview)