From 3e51710fe6cc2f046af401cdb733c6f543256416 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 24 Jan 2024 12:37:42 +0800 Subject: [PATCH] fix: explore app add to workspace (#2160) --- web/app/components/explore/app-card/index.tsx | 30 +++++++------------ web/app/components/explore/app-list/index.tsx | 14 ++------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/web/app/components/explore/app-card/index.tsx b/web/app/components/explore/app-card/index.tsx index 6286f739b4..14b96633b7 100644 --- a/web/app/components/explore/app-card/index.tsx +++ b/web/app/components/explore/app-card/index.tsx @@ -8,24 +8,16 @@ import type { App } from '@/models/explore' import AppModeLabel from '@/app/(commonLayout)/apps/AppModeLabel' import AppIcon from '@/app/components/base/app-icon' -const CustomizeBtn = ( - - - -) - export type AppCardProps = { app: App canCreate: boolean onCreate: () => void - onAddToWorkspace: (appId: string) => void } const AppCard = ({ app, canCreate, onCreate, - onAddToWorkspace, }: AppCardProps) => { const { t } = useTranslation() const { app: appBasicInfo, is_agent } = app @@ -42,18 +34,16 @@ const AppCard = ({
-
- - {canCreate && ( - - )} -
+ { + canCreate && ( +
+ +
+ ) + } ) diff --git a/web/app/components/explore/app-list/index.tsx b/web/app/components/explore/app-list/index.tsx index cb8a5c57b3..307145992e 100644 --- a/web/app/components/explore/app-list/index.tsx +++ b/web/app/components/explore/app-list/index.tsx @@ -10,7 +10,7 @@ import ExploreContext from '@/context/explore-context' import type { App, AppCategory } from '@/models/explore' import Category from '@/app/components/explore/category' import AppCard from '@/app/components/explore/app-card' -import { fetchAppDetail, fetchAppList, installApp } from '@/service/explore' +import { fetchAppDetail, fetchAppList } from '@/service/explore' import { createApp } from '@/service/apps' import CreateAppModal from '@/app/components/explore/create-app-modal' import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal' @@ -23,7 +23,7 @@ const Apps: FC = () => { const { t } = useTranslation() const { isCurrentWorkspaceManager } = useAppContext() const router = useRouter() - const { setControlUpdateInstalledApps, hasEditPermission } = useContext(ExploreContext) + const { hasEditPermission } = useContext(ExploreContext) const [currCategory, setCurrCategory] = React.useState('') const [allList, setAllList] = React.useState([]) const [isLoaded, setIsLoaded] = React.useState(false) @@ -44,15 +44,6 @@ const Apps: FC = () => { })() }, []) - const handleAddToWorkspace = async (appId: string) => { - await installApp(appId) - Toast.notify({ - type: 'success', - message: t('common.api.success'), - }) - setControlUpdateInstalledApps(Date.now()) - } - const [currApp, setCurrApp] = React.useState(null) const [isShowCreateModal, setIsShowCreateModal] = React.useState(false) const onCreate: CreateAppModalProps['onConfirm'] = async ({ name, icon, icon_background }) => { @@ -111,7 +102,6 @@ const Apps: FC = () => { setCurrApp(app) setIsShowCreateModal(true) }} - onAddToWorkspace={handleAddToWorkspace} /> ))}