diff --git a/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx b/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx
index 44966f0ebe..3082eb3789 100644
--- a/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx
+++ b/web/app/components/app-sidebar/app-info/__tests__/app-info-detail-panel.spec.tsx
@@ -11,26 +11,22 @@ vi.mock('../../../base/app-icon', () => ({
),
}))
-vi.mock('@/app/components/base/ui/dialog', () => ({
- Dialog: ({ open, onOpenChange, children }: {
- open: boolean
- onOpenChange: (open: boolean) => void
+vi.mock('@/app/components/base/content-dialog', () => ({
+ default: ({ show, onClose, children, className }: {
+ show: boolean
+ onClose: () => void
children: React.ReactNode
+ className?: string
}) => (
- open
+ show
? (
-
-
+
+
{children}
)
: null
),
- DialogPortal: ({ children }: { children: React.ReactNode }) => <>{children}>,
- DialogBackdrop: () =>
,
- DialogPopup: ({ children, className }: { children: React.ReactNode, className?: string }) => (
-
{children}
- ),
}))
vi.mock('@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view', () => ({
@@ -100,12 +96,12 @@ describe('AppInfoDetailPanel', () => {
describe('Rendering', () => {
it('should not render when show is false', () => {
render(
)
- expect(screen.queryByTestId('detail-drawer')).not.toBeInTheDocument()
+ expect(screen.queryByTestId('content-dialog')).not.toBeInTheDocument()
})
it('should render dialog when show is true', () => {
render(
)
- expect(screen.getByTestId('detail-drawer')).toBeInTheDocument()
+ expect(screen.getByTestId('content-dialog')).toBeInTheDocument()
})
it('should display app name', () => {
diff --git a/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx b/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx
index 93e7b4c586..4aacc0cdb1 100644
--- a/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx
+++ b/web/app/components/app-sidebar/app-info/app-info-detail-panel.tsx
@@ -1,17 +1,20 @@
import type { Operation } from './app-operations'
import type { AppInfoModalType } from './use-app-info-actions'
import type { App, AppSSO } from '@/types/app'
+import {
+ RiDeleteBinLine,
+ RiEditLine,
+ RiExchange2Line,
+ RiFileCopy2Line,
+ RiFileDownloadLine,
+ RiFileUploadLine,
+} from '@remixicon/react'
import * as React from 'react'
-import { useCallback, useMemo } from 'react'
+import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import CardView from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/card-view'
import Button from '@/app/components/base/button'
-import {
- Dialog,
- DialogBackdrop,
- DialogPopup,
- DialogPortal,
-} from '@/app/components/base/ui/dialog'
+import ContentDialog from '@/app/components/base/content-dialog'
import { AppModeEnum } from '@/types/app'
import AppIcon from '../../base/app-icon'
import { getAppModeLabel } from './app-mode-labels'
@@ -34,28 +37,23 @@ const AppInfoDetailPanel = ({
}: AppInfoDetailPanelProps) => {
const { t } = useTranslation()
- const handleOpenChange = useCallback((open: boolean) => {
- if (!open)
- onClose()
- }, [onClose])
-
const primaryOperations = useMemo
(() => [
{
id: 'edit',
title: t('editApp', { ns: 'app' }),
- icon: ,
+ icon: ,
onClick: () => openModal('edit'),
},
{
id: 'duplicate',
title: t('duplicate', { ns: 'app' }),
- icon: ,
+ icon: ,
onClick: () => openModal('duplicate'),
},
{
id: 'export',
title: t('export', { ns: 'app' }),
- icon: ,
+ icon: ,
onClick: exportCheck,
},
], [t, openModal, exportCheck])
@@ -65,7 +63,7 @@ const AppInfoDetailPanel = ({
? [{
id: 'import',
title: t('common.importDSL', { ns: 'workflow' }),
- icon: ,
+ icon: ,
onClick: () => openModal('importDSL'),
}]
: [],
@@ -79,7 +77,7 @@ const AppInfoDetailPanel = ({
{
id: 'delete',
title: t('operation.delete', { ns: 'common' }),
- icon: ,
+ icon: ,
onClick: () => openModal('delete'),
},
], [appDetail.mode, t, openModal])
@@ -90,64 +88,63 @@ const AppInfoDetailPanel = ({
return {
id: 'switch',
title: t('switch', { ns: 'app' }),
- icon: ,
+ icon: ,
onClick: () => openModal('switch'),
}
}, [appDetail.mode, t, openModal])
return (
-
diff --git a/web/app/components/base/content-dialog/__tests__/index.spec.tsx b/web/app/components/base/content-dialog/__tests__/index.spec.tsx
new file mode 100644
index 0000000000..e987d306a1
--- /dev/null
+++ b/web/app/components/base/content-dialog/__tests__/index.spec.tsx
@@ -0,0 +1,59 @@
+import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import ContentDialog from '../index'
+
+describe('ContentDialog', () => {
+ it('renders children when show is true', async () => {
+ render(
+