diff --git a/web/app/components/explore/app-card/index.tsx b/web/app/components/explore/app-card/index.tsx index 0363fce32c..dda12083c3 100644 --- a/web/app/components/explore/app-card/index.tsx +++ b/web/app/components/explore/app-card/index.tsx @@ -32,7 +32,7 @@ const AppCard = ({ const setShowTryAppPanel = useContextSelector(ExploreContext, ctx => ctx.setShowTryAppPanel) const showTryAPPPanel = useCallback((appId: string) => { return () => { - setShowTryAppPanel?.(true, { appId, category: app.category }) + setShowTryAppPanel?.(true, { appId, app }) } }, [setShowTryAppPanel, app.category]) diff --git a/web/app/components/explore/app-list/index.tsx b/web/app/components/explore/app-list/index.tsx index 02b3ae085d..429a40d38a 100644 --- a/web/app/components/explore/app-list/index.tsx +++ b/web/app/components/explore/app-list/index.tsx @@ -149,6 +149,11 @@ const Apps = ({ setShowTryAppPanel(false) }, [setShowTryAppPanel]) const appParams = useContextSelector(ExploreContext, ctx => ctx.currentApp) + const handleShowFromTryApp = useCallback(() => { + setCurrApp(appParams?.app || null) + setIsShowCreateModal(true) + }, [appParams?.app]) + if (!categories || categories.length === 0) { return (
@@ -246,8 +251,9 @@ const Apps = ({ {isShowTryAppPanel && ( )}
diff --git a/web/app/components/explore/try-app/app-info/index.tsx b/web/app/components/explore/try-app/app-info/index.tsx index 4d17575466..69146a036e 100644 --- a/web/app/components/explore/try-app/app-info/index.tsx +++ b/web/app/components/explore/try-app/app-info/index.tsx @@ -13,6 +13,7 @@ type Props = { appDetail: TryAppInfo category?: string className?: string + onCreate: () => void } const headerClassName = 'system-sm-semibold-uppercase text-text-secondary mb-3' @@ -21,6 +22,7 @@ const AppInfo: FC = ({ className, category, appDetail, + onCreate, }) => { const { t } = useTranslation() const mode = appDetail?.mode @@ -55,7 +57,7 @@ const AppInfo: FC = ({ {appDetail.description && (
{appDetail.description}
)} - diff --git a/web/app/components/explore/try-app/index.tsx b/web/app/components/explore/try-app/index.tsx index 15102facdb..9446e2526e 100644 --- a/web/app/components/explore/try-app/index.tsx +++ b/web/app/components/explore/try-app/index.tsx @@ -15,12 +15,14 @@ type Props = { appId: string category?: string onClose: () => void + onCreate: () => void } const TryApp: FC = ({ appId, category, onClose, + onCreate, }) => { const [type, setType] = useState(TypeEnum.TRY) const { data: appDetail, isLoading } = useGetTryAppInfo(appId) @@ -52,7 +54,7 @@ const TryApp: FC = ({ {/* Main content */}
{type === TypeEnum.TRY ? : } - +
)} diff --git a/web/context/explore-context.ts b/web/context/explore-context.ts index 20ce516323..6d11a919b1 100644 --- a/web/context/explore-context.ts +++ b/web/context/explore-context.ts @@ -1,10 +1,10 @@ import { createContext } from 'use-context-selector' -import type { InstalledApp } from '@/models/explore' +import type { App, InstalledApp } from '@/models/explore' import { noop } from 'lodash-es' export type CurrentTryAppParams = { appId: string - category?: string + app: App } type IExplore = {