Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): move app, workflow and account banners to dify-ui Alert (#45267)

yyh80afc6a21b41
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 2744ce70b11..4d53c7e45f8 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -563,7 +563,7 @@
},
"web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.tsx": {
"better-tailwindcss/enforce-logical-properties": {
- "count": 3
+ "count": 2
}
},
"web/app/components/app/configuration/debug/__tests__/index.spec.tsx": {
@@ -700,11 +700,6 @@
"count": 2
}
},
- "web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 1
- }
- },
"web/app/components/app/deploy/shared/deployment-configuration/index.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 3
@@ -776,11 +771,6 @@
"count": 4
}
},
- "web/app/components/app/overview/settings/index.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 3
- }
- },
"web/app/components/app/switch-app-modal/index.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 2
@@ -1294,7 +1284,7 @@
},
"web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx": {
"better-tailwindcss/enforce-logical-properties": {
- "count": 4
+ "count": 3
}
},
"web/app/components/base/features/types.ts": {
@@ -3082,11 +3072,6 @@
"count": 1
}
},
- "web/app/components/plugins/base/deprecation-notice.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 1
- }
- },
"web/app/components/plugins/card/base/corner-mark.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 4
@@ -3687,11 +3672,6 @@
"count": 1
}
},
- "web/app/components/rag-pipeline/components/publish-toast.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 2
- }
- },
"web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/popup.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 5
@@ -3705,11 +3685,6 @@
"count": 1
}
},
- "web/app/components/rag-pipeline/components/update-dsl-modal.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 1
- }
- },
"web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-init.spec.tsx": {
"typescript/no-deprecated": {
"count": 1
@@ -3824,7 +3799,7 @@
},
"web/app/components/share/text-generation/text-generation-result-panel.tsx": {
"better-tailwindcss/enforce-logical-properties": {
- "count": 2
+ "count": 1
},
"jsx-a11y/click-events-have-key-events": {
"count": 1
@@ -4397,11 +4372,6 @@
"count": 1
}
},
- "web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 2
- }
- },
"web/app/components/workflow/nodes/_base/components/error-handle/error-handle-type-selector.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 2
@@ -5956,11 +5926,6 @@
"count": 4
}
},
- "web/app/components/workflow/run/agent-log/agent-result-panel.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 2
- }
- },
"web/app/components/workflow/run/hooks.ts": {
"typescript/no-explicit-any": {
"count": 1
@@ -6134,11 +6099,6 @@
"count": 6
}
},
- "web/app/components/workflow/update-dsl-modal.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 1
- }
- },
"web/app/components/workflow/utils/index.ts": {
"no-barrel-files/no-barrel-files": {
"count": 10
@@ -6182,11 +6142,6 @@
"count": 1
}
},
- "web/app/components/workflow/variable-inspect/large-data-alert.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 1
- }
- },
"web/app/components/workflow/variable-inspect/left.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 2
diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx
index 5d8e116ea28..13b19184ba6 100644
--- a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx
+++ b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/index.spec.tsx
@@ -270,7 +270,7 @@ describe('SettingsModal', () => {
await screen.findByText('appDebug.datasetConfig.retrieveChangeTip'),
).toBeInTheDocument()
- await user.click(screen.getByLabelText('close-retrieval-change-tip'))
+ await user.click(screen.getByLabelText('common.operation.close'))
await waitFor(() => {
expect(
diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx
index b7a6f82c3b7..8fb49406377 100644
--- a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx
+++ b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx
@@ -123,7 +123,7 @@ describe('RetrievalChangeTip', () => {
const onDismiss = vi.fn()
render(<RetrievalChangeTip {...defaultProps} onDismiss={onDismiss} />)
- await user.click(screen.getByRole('button', { name: 'close-retrieval-change-tip' }))
+ await user.click(screen.getByRole('button', { name: 'common.operation.close' }))
expect(screen.getByText('Test message'))!.toBeInTheDocument()
expect(onDismiss).toHaveBeenCalledTimes(1)
diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.tsx
index 266d85ff298..761477961e9 100644
--- a/web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.tsx
+++ b/web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.tsx
@@ -3,9 +3,10 @@ import type { TFunction } from 'i18next'
import type { FC } from 'react'
import type { RetrievalConfig } from '@/types/app'
import type { DocPathWithoutLang } from '@/types/doc-paths'
+import { Alert, AlertClose, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
import { Separator } from '@langgenius/dify-ui/separator'
-import { RiCloseLine } from '@remixicon/react'
+import { useTranslation } from 'react-i18next'
import EconomicalRetrievalMethodConfig from '@/app/components/datasets/common/economical-retrieval-method-config'
import RetrievalMethodConfig from '@/app/components/datasets/common/retrieval-method-config'
import { IndexingType } from '@/app/components/datasets/create/step-two'
@@ -226,28 +227,22 @@ export const RetrievalChangeTip: FC<RetrievalChangeTipProps> = ({
message,
onDismiss,
}) => {
+ const { t } = useTranslation(['common'])
+
if (!visible) return null
return (
- <div className="absolute right-7.5 bottom-19 left-7.5 z-10 flex h-10 items-center justify-between rounded-lg border border-[#FEF0C7] bg-[#FFFAEB] px-3 shadow-lg">
- <div className="flex items-center">
- <span
- aria-hidden
- className="mr-1 i-custom-vender-solid-alertsAndFeedback-alert-triangle h-3 w-3 text-[#F79009]"
+ <div className="absolute right-7.5 bottom-19 left-7.5 z-10">
+ <Alert type="warning">
+ <AlertTitle>{message}</AlertTitle>
+ <AlertClose
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ onClick={(event) => {
+ onDismiss()
+ event.stopPropagation()
+ }}
/>
- <div className="text-xs leading-4.5 font-medium text-gray-700">{message}</div>
- </div>
- <button
- type="button"
- className="cursor-pointer p-1"
- onClick={(event) => {
- onDismiss()
- event.stopPropagation()
- }}
- aria-label="close-retrieval-change-tip"
- >
- <RiCloseLine className="size-4 text-gray-500" />
- </button>
+ </Alert>
</div>
)
}
diff --git a/web/app/components/app/deploy/environment-table/index.tsx b/web/app/components/app/deploy/environment-table/index.tsx
index c3f600d4236..abbec0eaf94 100644
--- a/web/app/components/app/deploy/environment-table/index.tsx
+++ b/web/app/components/app/deploy/environment-table/index.tsx
@@ -3,6 +3,7 @@
import type { EnvironmentDeployment } from '@dify/contracts/enterprise-app-deploy/types.gen'
import type { DeploymentDialogRequest, OpenDeploymentDialog } from '../types'
import type { OpenUndeployDialog, UndeployHandler } from './types'
+import { Alert, AlertActions, AlertTitle } from '@langgenius/dify-ui/alert'
import { AlertDialog } from '@langgenius/dify-ui/alert-dialog'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
@@ -186,28 +187,19 @@ export const EnvironmentTable = memo(
</div>
{latestVersionIsError && (
- <div
- role="alert"
- className="flex shrink-0 items-center gap-2 rounded-xl border border-state-destructive-border bg-state-destructive-hover-alt p-3"
- >
- <span
- aria-hidden
- className="i-ri-error-warning-fill size-4 shrink-0 text-text-destructive"
- />
- <p className="grow system-sm-medium text-text-destructive">
- {t(($) => $['studio.latestVersionLoadFailed'])}
- </p>
- <Button
- size="small"
- variant="secondary"
- loading={latestVersionIsRetrying}
- onClick={() => void refetchLatestVersion()}
- className="gap-1 px-2"
- >
- <span aria-hidden className="i-ri-reset-left-line size-3" />
- <span>{tCommon(($) => $['operation.retry'])}</span>
- </Button>
- </div>
+ <Alert type="error" className="shrink-0">
+ <AlertTitle>{t(($) => $['studio.latestVersionLoadFailed'])}</AlertTitle>
+ <AlertActions>
+ <Button
+ size="small"
+ loading={latestVersionIsRetrying}
+ onClick={() => void refetchLatestVersion()}
+ >
+ <span aria-hidden className="i-ri-reset-left-line size-3" />
+ <span>{tCommon(($) => $['operation.retry'])}</span>
+ </Button>
+ </AlertActions>
+ </Alert>
)}
<div
diff --git a/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx b/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx
index 5a25230e03d..cd7563054d1 100644
--- a/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx
+++ b/web/app/components/app/deploy/shared/deployment-configuration/deployment-precheck-alert.tsx
@@ -2,6 +2,7 @@
import type { UnsupportedNode, WorkflowPath } from '@dify/contracts/enterprise-app-deploy/types.gen'
import type { Emoji } from '@/app/components/tools/types'
+import { Alert, AlertDescription, AlertTitle } from '@langgenius/dify-ui/alert'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import BlockIcon from '@/app/components/workflow/block-icon'
@@ -119,24 +120,12 @@ export function DeploymentPrecheckAlert({ nodes }: { nodes: UnsupportedNode[] })
const nodeGroups = useMemo(() => groupUnsupportedNodes(nodes), [nodes])
return (
- <div
- role="alert"
- className="relative flex flex-col gap-2 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-4 shadow-xs backdrop-blur-[5px]"
- >
- <div className="pointer-events-none absolute inset-0 bg-linear-to-r from-components-badge-status-light-warning-halo to-background-gradient-mask-transparent opacity-40" />
- <span
- aria-hidden
- className="relative i-ri-alert-fill size-5 shrink-0 text-text-warning-secondary"
- />
- <div className="relative flex min-w-0 flex-col gap-1">
- <p className="system-sm-medium text-text-primary">{t(($) => $['studio.precheck.title'])}</p>
- <p className="system-xs-regular text-text-secondary">
- {t(($) => $['studio.precheck.description'])}
- </p>
- </div>
- <ul className="relative flex flex-col gap-1.5 border-y border-divider-regular py-3">
+ <Alert type="warning" role="alert">
+ <AlertTitle>{t(($) => $['studio.precheck.title'])}</AlertTitle>
+ <AlertDescription>{t(($) => $['studio.precheck.description'])}</AlertDescription>
+ <ul className="my-1.5 flex flex-col gap-1.5 border-y border-divider-regular py-3">
{nodeGroups.map(({ key, node, paths }) => (
- <li key={key} className="flex items-center gap-2 pr-1">
+ <li key={key} className="flex items-center gap-2 pe-1">
<UnsupportedNodeIcon node={node} icon={getProviderIcon(node)} />
<span className="min-w-0 flex-1 truncate system-xs-medium text-text-secondary">
{node.title}
@@ -145,9 +134,7 @@ export function DeploymentPrecheckAlert({ nodes }: { nodes: UnsupportedNode[] })
</li>
))}
</ul>
- <p className="relative system-xs-regular text-text-secondary">
- {t(($) => $['studio.precheck.supportMessage'])}
- </p>
- </div>
+ <AlertDescription>{t(($) => $['studio.precheck.supportMessage'])}</AlertDescription>
+ </Alert>
)
}
diff --git a/web/app/components/app/log/__tests__/archived-logs-notice.spec.tsx b/web/app/components/app/log/__tests__/archived-logs-notice.spec.tsx
index 6ff956a842b..6d0f9dc2242 100644
--- a/web/app/components/app/log/__tests__/archived-logs-notice.spec.tsx
+++ b/web/app/components/app/log/__tests__/archived-logs-notice.spec.tsx
@@ -38,8 +38,6 @@ describe('ArchivedLogsNotice', () => {
renderNotice()
const notice = screen.getByRole('status')
- expect(notice).toHaveAttribute('aria-live', 'polite')
- expect(notice).toHaveAttribute('aria-atomic', 'true')
expect(within(notice).getByText('appLog.archives.notice.description')).toBeInTheDocument()
await user.click(within(notice).getByRole('button', { name: 'appLog.archives.notice.action' }))
diff --git a/web/app/components/app/log/archived-logs-notice.tsx b/web/app/components/app/log/archived-logs-notice.tsx
index 3cb6641c863..3fda6349658 100644
--- a/web/app/components/app/log/archived-logs-notice.tsx
+++ b/web/app/components/app/log/archived-logs-notice.tsx
@@ -1,5 +1,6 @@
'use client'
+import { Alert, AlertActions, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
@@ -36,32 +37,17 @@ export function ArchivedLogsNotice() {
return null
return (
- <div
- role="status"
- aria-live="polite"
- aria-atomic="true"
- className="relative mb-3 shrink-0 overflow-hidden rounded-xl border border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]"
- >
- <div
- aria-hidden="true"
- className="absolute -inset-px bg-linear-to-r from-components-badge-status-light-normal-halo to-background-gradient-mask-transparent opacity-40"
- />
- <div className="relative flex items-center gap-3 px-3 py-2">
- <span
- aria-hidden="true"
- className="i-ri-information-2-fill size-5 shrink-0 text-text-accent"
- />
- <p className="min-w-0 flex-1 system-sm-semibold wrap-break-word text-text-primary">
- {t(($) => $['archives.notice.description'], { ns: 'appLog' })}
- </p>
+ <Alert type="info" className="mb-3 shrink-0">
+ <AlertTitle>{t(($) => $['archives.notice.description'], { ns: 'appLog' })}</AlertTitle>
+ <AlertActions>
<Button
+ size="small"
variant="primary"
- className="shrink-0"
onClick={() => setSettingsDestination('workflow-log-archives')}
>
{t(($) => $['archives.notice.action'], { ns: 'appLog' })}
</Button>
- </div>
- </div>
+ </AlertActions>
+ </Alert>
)
}
diff --git a/web/app/components/app/overview/settings/index.tsx b/web/app/components/app/overview/settings/index.tsx
index 949d07e9c3b..57babd05149 100644
--- a/web/app/components/app/overview/settings/index.tsx
+++ b/web/app/components/app/overview/settings/index.tsx
@@ -8,6 +8,7 @@ import type {
import type { DialogActions } from '@langgenius/dify-ui/dialog'
import type { IconPickerValue } from '@/app/components/base/icon-picker'
import type { Language } from '@/types/app'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
@@ -297,28 +298,13 @@ function SettingsForm({
<Form className="contents" onFormSubmit={handleFormSubmit}>
{canDeploy && (
<div className="px-6 py-2">
- <div
- role="status"
- aria-live="polite"
- aria-atomic="true"
- className="relative flex min-h-10 items-start gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs shadow-shadow-shadow-3 backdrop-blur-[5px]"
- >
- <div
- aria-hidden="true"
- className="absolute -inset-px bg-linear-to-r from-components-badge-status-light-normal-halo to-background-gradient-mask-transparent opacity-40"
- />
- <div className="relative flex size-6 shrink-0 items-center justify-center p-1">
- <span
- aria-hidden="true"
- className="i-ri-information-2-fill size-4 text-text-accent"
- />
- </div>
- <p className="relative min-w-0 flex-1 py-1 system-xs-medium wrap-break-word text-text-primary">
+ <Alert type="info">
+ <AlertTitle>
{t(($) => $[`${prefixSettings}.multiEnvironmentNotice`], {
ns: 'appOverview',
})}
- </p>
- </div>
+ </AlertTitle>
+ </Alert>
</div>
)}
<DialogBody className="flex flex-col gap-y-5">
@@ -448,7 +434,7 @@ function SettingsForm({
</Field>
<Field
name="chat_color_theme_inverted"
- className="ml-auto flex w-50 items-center justify-between gap-2"
+ className="ms-auto flex w-50 items-center justify-between gap-2"
>
<FieldLabel>
{t(($) => $[`${prefixSettings}.chatColorThemeInverted`], {
@@ -511,7 +497,7 @@ function SettingsForm({
inputPlaceholderField
)}
{canCustomizePlaceholder && (
- <FieldDescription className="text-right">
+ <FieldDescription className="text-end">
{`${inputInfo.inputPlaceholder.length} / ${INPUT_PLACEHOLDER_MAX_LENGTH}`}
</FieldDescription>
)}
@@ -525,7 +511,7 @@ function SettingsForm({
</FieldsetLegend>
{showUpgrade && <SettingsUpgradeButton />}
<Tooltip>
- <TooltipTrigger render={<div className="ml-auto" />}>
+ <TooltipTrigger render={<div className="ms-auto" />}>
<Switch
readOnly={pending}
aria-labelledby={copyrightLegendId}
diff --git a/web/app/components/base/alert.tsx b/web/app/components/base/alert.tsx
deleted file mode 100644
index 0506461568c..00000000000
--- a/web/app/components/base/alert.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { cn } from '@langgenius/dify-ui/cn'
-import { IconButton } from '@langgenius/dify-ui/icon-button'
-import { cva } from 'class-variance-authority'
-import { memo } from 'react'
-import { useTranslation } from 'react-i18next'
-
-type Props = Readonly<{
- type?: 'info'
- message: string
- onHide: () => void
- className?: string
-}>
-const bgVariants = cva('', {
- variants: {
- type: {
- info: 'from-components-badge-status-light-normal-halo to-background-gradient-mask-transparent',
- },
- },
-})
-const Alert: React.FC<Props> = ({ type = 'info', message, onHide, className }) => {
- const { t } = useTranslation(['common'])
-
- return (
- <div className={cn('pointer-events-none w-full', className)}>
- <div className="relative flex space-x-1 overflow-hidden rounded-xl border border-components-panel-border bg-components-panel-bg-blur p-3 shadow-lg">
- <div
- className={cn(
- 'pointer-events-none absolute inset-0 bg-linear-to-r opacity-[0.4]',
- bgVariants({ type }),
- )}
- ></div>
- <div className="flex size-6 items-center justify-center">
- <span className="i-ri-information-2-fill text-text-accent" />
- </div>
- <div className="p-1">
- <div className="system-xs-regular text-text-secondary">{message}</div>
- </div>
- <IconButton
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="pointer-events-auto"
- size="md"
- onClick={onHide}
- >
- <span className="i-ri-close-line size-4 text-text-tertiary" aria-hidden="true" />
- </IconButton>
- </div>
- </div>
- )
-}
-
-export default memo(Alert)
diff --git a/web/app/components/base/chat/chat/answer/workflow-process.tsx b/web/app/components/base/chat/chat/answer/workflow-process.tsx
index 447819c3bf5..18d88c06791 100644
--- a/web/app/components/base/chat/chat/answer/workflow-process.tsx
+++ b/web/app/components/base/chat/chat/answer/workflow-process.tsx
@@ -1,4 +1,5 @@
import type { ChatItem, WorkflowProcess } from '../../types'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
import { useStore as useAtomStore } from 'jotai'
import { use, useEffect, useState } from 'react'
@@ -133,12 +134,9 @@ const WorkflowProcessItem = ({
{!collapse && (
<div className="mt-1.5">
{failed && data.error && (
- <div
- role="alert"
- className="mb-1.5 rounded-lg border-[0.5px] border-state-destructive-border bg-state-destructive-hover px-2 py-1.5 system-xs-regular wrap-break-word text-text-destructive"
- >
- {localizedError}
- </div>
+ <Alert type="error" className="mb-1.5">
+ <AlertTitle>{localizedError}</AlertTitle>
+ </Alert>
)}
{data.tracing.length > 0 && (
<TracingPanel
diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
index e3a3b982cff..3e020381fb0 100644
--- a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
+++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx
@@ -1,6 +1,7 @@
import type { FC, ReactNode } from 'react'
import type { CodeBasedExtensionItem } from '@/models/common'
import type { ModerationConfig, ModerationContentConfig } from '@/models/debug'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import {
@@ -369,15 +370,14 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCance
{!isLoading &&
!isOpenAIProviderConfigured &&
localeData.type === 'openai_moderation' && (
- <div className="mt-2 flex items-center rounded-lg border border-[#FEF0C7] bg-[#FFFAEB] px-3 py-2">
- <span className="mr-1 i-custom-vender-line-general-info-circle h-4 w-4 text-[#F79009]" />
- <div className="flex items-center text-xs font-medium text-gray-700">
+ <Alert type="warning" className="mt-2">
+ <AlertTitle>
{t(($) => $['feature.moderation.modal.openaiNotConfig.before'], {
ns: 'appDebug',
})}
<button
type="button"
- className="cursor-pointer text-primary-600"
+ className="cursor-pointer text-text-accent"
onClick={handleOpenSettingsModal}
>
&nbsp;
@@ -387,8 +387,8 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({ data, onCance
{t(($) => $['feature.moderation.modal.openaiNotConfig.after'], {
ns: 'appDebug',
})}
- </div>
- </div>
+ </AlertTitle>
+ </Alert>
)}
</div>
{localeData.type === 'keywords' && (
diff --git a/web/app/components/explore/try-app/app/chat.tsx b/web/app/components/explore/try-app/app/chat.tsx
index 1a64d1a87ca..728ce535c58 100644
--- a/web/app/components/explore/try-app/app/chat.tsx
+++ b/web/app/components/explore/try-app/app/chat.tsx
@@ -2,6 +2,7 @@
import type { TrialAppDetailResponse } from '@dify/contracts/api/console/trial-apps/types.gen'
import type { FC } from 'react'
import type { EmbeddedChatbotContextValue } from '@/app/components/base/chat/embedded-chatbot/context'
+import { Alert, AlertClose, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
@@ -10,7 +11,6 @@ import { useBoolean } from 'ahooks'
import * as React from 'react'
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
-import Alert from '@/app/components/base/alert'
import AppIcon from '@/app/components/base/app-icon'
import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper'
import { EmbeddedChatbotContext } from '@/app/components/base/chat/embedded-chatbot/context'
@@ -27,7 +27,7 @@ type Props = Readonly<{
}>
const TryApp: FC<Props> = ({ appId, appDetail, className }) => {
- const { t } = useTranslation(['explore', 'share'])
+ const { t } = useTranslation(['explore', 'share', 'common'])
const media = useBreakpoints()
const isMobile = media === MediaType.mobile
const { removeConversationIdInfo, ...chatData } = useEmbeddedChatbot(AppSourceType.tryApp, appId)
@@ -90,11 +90,13 @@ const TryApp: FC<Props> = ({ appId, appDetail, className }) => {
</div>
<div className="mx-auto mt-4 flex h-0 w-full max-w-192.25 min-w-0 grow flex-col">
{!isHideTryNotice && (
- <Alert
- className="mb-4 shrink-0"
- message={t(($) => $['tryApp.tryInfo'], { ns: 'explore' })}
- onHide={hideTryNotice}
- />
+ <Alert type="info" className="mb-4 shrink-0">
+ <AlertTitle>{t(($) => $['tryApp.tryInfo'], { ns: 'explore' })}</AlertTitle>
+ <AlertClose
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ onClick={hideTryNotice}
+ />
+ </Alert>
)}
<ChatWrapper />
</div>
diff --git a/web/app/components/explore/try-app/app/text-generation.tsx b/web/app/components/explore/try-app/app/text-generation.tsx
index 406193d2ea7..78a3bf0456f 100644
--- a/web/app/components/explore/try-app/app/text-generation.tsx
+++ b/web/app/components/explore/try-app/app/text-generation.tsx
@@ -4,6 +4,7 @@ import type { InputValueTypes, Task } from '../../../share/text-generation/types
import type { MoreLikeThisConfig, PromptConfig, TextToSpeechConfig } from '@/models/debug'
import type { AppData, CustomConfigValueType, SiteInfo } from '@/models/share'
import type { VisionFile, VisionSettings } from '@/types/app'
+import { Alert, AlertClose, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
import { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react'
import { useBoolean } from 'ahooks'
@@ -11,7 +12,6 @@ import { noop } from 'es-toolkit/function'
import * as React from 'react'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Alert from '@/app/components/base/alert'
import AppIcon from '@/app/components/base/app-icon'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import Res from '@/app/components/share/text-generation/result'
@@ -33,7 +33,7 @@ type Props = Readonly<{
}>
const TextGeneration: FC<Props> = ({ appId, className, isWorkflow, appData }) => {
- const { t } = useTranslation(['explore', 'share'])
+ const { t } = useTranslation(['explore', 'share', 'common'])
const [descExpanded, setDescExpanded] = useState(false)
const [showDescToggle, setShowDescToggle] = useState(false)
const handleDescRef = useCallback((node: HTMLDivElement | null) => {
@@ -159,11 +159,13 @@ const TextGeneration: FC<Props> = ({ appId, className, isWorkflow, appData }) =>
<div className={cn('relative flex h-full flex-col', 'rounded-r-2xl bg-chatbot-bg')}>
<div className={cn('flex h-0 grow flex-col overflow-y-auto p-6')}>
{isCompleted && !isHideTryNotice && (
- <Alert
- className="mb-3 shrink-0"
- message={t(($) => $['tryApp.tryInfo'], { ns: 'explore' })}
- onHide={hideTryNotice}
- />
+ <Alert type="info" className="mb-3 shrink-0">
+ <AlertTitle>{t(($) => $['tryApp.tryInfo'], { ns: 'explore' })}</AlertTitle>
+ <AlertClose
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ onClick={hideTryNotice}
+ />
+ </Alert>
)}
{renderRes()}
</div>
diff --git a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
index 7a534065bbc..18704b5dde6 100644
--- a/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
+++ b/web/app/components/header/account-setting/members-page/invite-modal/index.tsx
@@ -3,6 +3,7 @@ import type { MemberInviteResponse } from '@dify/contracts/api/console/workspace
import type { DialogActions } from '@langgenius/dify-ui/dialog'
import type { Ref } from 'react'
import type { EmailRecipient } from './email-recipients'
+import { Alert, AlertDescription, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
@@ -121,12 +122,11 @@ function InviteForm({
>
<DialogBody className="grid gap-5">
{!isEmailSetup && (
- <div className="flex items-start gap-1.5 rounded-lg bg-state-warning-hover p-2 text-text-warning">
- <span aria-hidden="true" className="i-ri-error-warning-fill size-4 shrink-0" />
- <span className="system-xs-medium text-text-primary">
+ <Alert type="warning">
+ <AlertTitle>
{t(($) => $['members.emailNotSetup'], { ns: 'workspaceMembers' })}
- </span>
- </div>
+ </AlertTitle>
+ </Alert>
)}
<EmailRecipientsField
recipients={recipients}
@@ -138,20 +138,17 @@ function InviteForm({
/>
<RoleSelector hasServerError={Boolean(fieldErrors?.role)} disabled={isPending} />
{exceedsRemainingSeats && (
- <div
- role="status"
- className="flex items-start gap-1.5 rounded-lg bg-state-warning-hover p-2 body-xs-regular text-text-warning"
- >
- <span aria-hidden="true" className="i-ri-error-warning-line size-4 shrink-0" />
- <span>
+ <Alert type="warning">
+ <AlertTitle>
{t(($) => $['members.seatsRemaining'], {
ns: 'workspaceMembers',
count: remainingSeats,
})}
- <span aria-hidden="true"> · </span>
+ </AlertTitle>
+ <AlertDescription>
{t(($) => $['members.recipientCountExceedsSeats'], { ns: 'workspaceMembers' })}
- </span>
- </div>
+ </AlertDescription>
+ </Alert>
)}
{formError && (
<div role="alert" className="body-xs-regular text-text-destructive">
diff --git a/web/app/components/plugins/base/deprecation-notice.tsx b/web/app/components/plugins/base/deprecation-notice.tsx
index c003bd7e576..e66d2720599 100644
--- a/web/app/components/plugins/base/deprecation-notice.tsx
+++ b/web/app/components/plugins/base/deprecation-notice.tsx
@@ -1,6 +1,5 @@
import type { FC } from 'react'
-import { cn } from '@langgenius/dify-ui/cn'
-import { RiAlertFill } from '@remixicon/react'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { camelCase } from 'es-toolkit/string'
import * as React from 'react'
import { useMemo } from 'react'
@@ -14,9 +13,6 @@ type DeprecationNoticeProps = {
alternativePluginId: string
alternativePluginURL: string
className?: string
- innerWrapperClassName?: string
- iconWrapperClassName?: string
- textClassName?: string
}
const i18nPrefix = 'detailPanel.deprecation'
@@ -38,9 +34,6 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
alternativePluginId,
alternativePluginURL,
className,
- innerWrapperClassName,
- iconWrapperClassName,
- textClassName,
}) => {
const { t } = useTranslation(['plugin'])
@@ -57,59 +50,46 @@ const DeprecationNotice: FC<DeprecationNoticeProps> = ({
if (status !== 'deleted') return null
return (
- <div className={cn('w-full', className)}>
- <div
- className={cn(
- 'relative flex items-start gap-x-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs shadow-shadow-shadow-3 backdrop-blur-[5px]',
- innerWrapperClassName,
+ <Alert type="warning" className={className}>
+ <AlertTitle>
+ {hasValidDeprecatedReason && alternativePluginId && (
+ <Trans
+ t={t}
+ i18nKey={($) => $[`${i18nPrefix}.fullMessage`]}
+ ns="plugin"
+ components={{
+ CustomLink: (
+ <Link
+ href={alternativePluginURL}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline"
+ />
+ ),
+ }}
+ values={{
+ deprecatedReason: deprecatedReasonKey
+ ? t(($) => $[`${i18nPrefix}.reason.${deprecatedReasonKey}`], { ns: 'plugin' })
+ : '',
+ alternativePluginId,
+ }}
+ />
)}
- >
- <div className="absolute top-0 left-0 -z-10 size-full bg-toast-warning-bg opacity-40" />
- <div
- className={cn('flex size-6 shrink-0 items-center justify-center', iconWrapperClassName)}
- >
- <RiAlertFill className="size-4 text-text-warning-secondary" />
- </div>
- <div className={cn('grow py-1 system-xs-regular text-text-primary', textClassName)}>
- {hasValidDeprecatedReason && alternativePluginId && (
- <Trans
- t={t}
- i18nKey={($) => $[`${i18nPrefix}.fullMessage`]}
- ns="plugin"
- components={{
- CustomLink: (
- <Link
- href={alternativePluginURL}
- target="_blank"
- rel="noopener noreferrer"
- className="underline"
- />
- ),
- }}
- values={{
- deprecatedReason: deprecatedReasonKey
- ? t(($) => $[`${i18nPrefix}.reason.${deprecatedReasonKey}`], { ns: 'plugin' })
- : '',
- alternativePluginId,
- }}
- />
- )}
- {hasValidDeprecatedReason && !alternativePluginId && (
- <span>
- {t(($) => $[`${i18nPrefix}.onlyReason`], {
- ns: 'plugin',
- deprecatedReason: deprecatedReasonKey
- ? t(($) => $[`${i18nPrefix}.reason.${deprecatedReasonKey}`], { ns: 'plugin' })
- : '',
- })}
- </span>
- )}
- {!hasValidDeprecatedReason && (
- <span>{t(($) => $[`${i18nPrefix}.noReason`], { ns: 'plugin' })}</span>
- )}
- </div>
- </div>
- </div>
+ {hasValidDeprecatedReason && !alternativePluginId && (
+ <span>
+ {t(($) => $[`${i18nPrefix}.onlyReason`], {
+ ns: 'plugin',
+ deprecatedReason: deprecatedReasonKey
+ ? t(($) => $[`${i18nPrefix}.reason.${deprecatedReasonKey}`], { ns: 'plugin' })
+ : '',
+ })}
+ </span>
+ )}
+ {!hasValidDeprecatedReason && (
+ <span>{t(($) => $[`${i18nPrefix}.noReason`], { ns: 'plugin' })}</span>
+ )}
+ </AlertTitle>
+ </Alert>
)
}
diff --git a/web/app/components/rag-pipeline/components/publish-toast.tsx b/web/app/components/rag-pipeline/components/publish-toast.tsx
index 9f238e35f0a..81cc285ff57 100644
--- a/web/app/components/rag-pipeline/components/publish-toast.tsx
+++ b/web/app/components/rag-pipeline/components/publish-toast.tsx
@@ -1,5 +1,4 @@
-import { IconButton } from '@langgenius/dify-ui/icon-button'
-import { RiCloseLine, RiInformation2Fill } from '@remixicon/react'
+import { Alert, AlertClose, AlertDescription, AlertTitle } from '@langgenius/dify-ui/alert'
import { memo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
@@ -12,28 +11,15 @@ const PublishToast = () => {
if (publishedAt || hideToast) return null
return (
- <div className="pointer-events-none absolute right-0 bottom-11.25 left-0 z-10 flex justify-center">
- <div className="relative flex w-105 space-x-1 overflow-hidden rounded-xl border border-components-panel-border bg-components-panel-bg-blur p-3 shadow-lg">
- <div className="pointer-events-none absolute inset-0 bg-linear-to-r from-components-badge-status-light-normal-halo to-background-gradient-mask-transparent opacity-[0.4]"></div>
- <div className="flex size-6 items-center justify-center">
- <RiInformation2Fill className="text-text-accent" />
- </div>
- <div className="p-1">
- <div className="mb-1 system-sm-semibold text-text-primary">
- {t(($) => $['publishToast.title'], { ns: 'pipeline' })}
- </div>
- <div className="system-xs-regular text-text-secondary">
- {t(($) => $['publishToast.desc'], { ns: 'pipeline' })}
- </div>
- </div>
- <IconButton
+ <div className="nokey pointer-events-none absolute inset-x-0 bottom-11.25 z-10 flex justify-center">
+ <Alert type="info" className="pointer-events-auto w-105">
+ <AlertTitle>{t(($) => $['publishToast.title'], { ns: 'pipeline' })}</AlertTitle>
+ <AlertDescription>{t(($) => $['publishToast.desc'], { ns: 'pipeline' })}</AlertDescription>
+ <AlertClose
aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- className="nokey pointer-events-auto shrink-0"
onClick={() => setHideToast(true)}
- >
- <RiCloseLine aria-hidden="true" className="size-4 text-text-tertiary" />
- </IconButton>
- </div>
+ />
+ </Alert>
</div>
)
}
diff --git a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
index b7b7cecb2b1..f7b5fd51667 100644
--- a/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
+++ b/web/app/components/rag-pipeline/components/update-dsl-modal.tsx
@@ -1,5 +1,6 @@
'use client'
+import { Alert, AlertActions, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
@@ -10,7 +11,7 @@ import {
DialogHeaderCloseButton,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { RiAlertFill, RiFileDownloadLine } from '@remixicon/react'
+import { RiFileDownloadLine } from '@remixicon/react'
import { memo } from 'react'
import { useTranslation } from 'react-i18next'
import { Uploader } from '@/app/components/app/create-from-dsl-modal/uploader'
@@ -53,25 +54,17 @@ const UpdateDSLModal = ({ onCancel, onBackup, onImport }: UpdateDSLModalProps) =
/>
</DialogHeader>
<DialogBody>
- <div className="relative mb-2 flex grow gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs">
- <div className="pointer-events-none absolute top-0 left-0 size-full bg-toast-warning-bg opacity-40" />
- <div className="flex items-start justify-center p-1">
- <RiAlertFill className="size-4 shrink-0 text-text-warning-secondary" />
- </div>
- <div className="flex grow flex-col items-start gap-0.5 py-1">
- <div className="system-xs-medium whitespace-pre-line text-text-primary">
- {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
- </div>
- <div className="flex items-start gap-1 self-stretch pt-1 pb-0.5">
- <Button size="small" variant="secondary" className="relative" onClick={onBackup}>
- <RiFileDownloadLine className="size-3.5 text-components-button-secondary-text" />
- <div className="flex items-center justify-center gap-1">
- {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
- </div>
- </Button>
- </div>
- </div>
- </div>
+ <Alert type="warning" className="mb-2">
+ <AlertTitle className="whitespace-pre-line">
+ {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
+ </AlertTitle>
+ <AlertActions>
+ <Button size="small" onClick={onBackup}>
+ <RiFileDownloadLine className="size-3.5" />
+ {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
+ </Button>
+ </AlertActions>
+ </Alert>
<div>
<div className="pt-2 system-md-semibold text-text-primary">
{t(($) => $['common.chooseDSL'], { ns: 'workflow' })}
diff --git a/web/app/components/share/text-generation/text-generation-result-panel.tsx b/web/app/components/share/text-generation/text-generation-result-panel.tsx
index d612d115c2d..4955a5d94d1 100644
--- a/web/app/components/share/text-generation/text-generation-result-panel.tsx
+++ b/web/app/components/share/text-generation/text-generation-result-panel.tsx
@@ -4,6 +4,8 @@ import type { PromptConfig } from '@/models/debug'
import type { SiteInfo } from '@/models/share'
import type { AppSourceType } from '@/service/share'
import type { VisionFile, VisionSettings } from '@/types/app'
+import { Alert, AlertActions, AlertTitle } from '@langgenius/dify-ui/alert'
+import { Button } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from 'react-i18next'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
@@ -175,22 +177,20 @@ const TextGenerationResultPanel: FC<TextGenerationResultPanelProps> = ({
)}
</div>
{isCallBatchAPI && allFailedTaskList.length > 0 && (
- <div className="absolute bottom-6 left-1/2 z-10 flex -translate-x-1/2 items-center gap-2 rounded-xl border border-components-panel-border bg-components-panel-bg-blur p-3 shadow-lg backdrop-blur-xs">
- <span aria-hidden className="i-ri-error-warning-fill size-4 text-text-destructive" />
- <div className="system-sm-medium text-text-secondary">
- {t(($) => $['generation.batchFailed.info'], {
- ns: 'share',
- num: allFailedTaskList.length,
- })}
- </div>
- <div className="h-3.5 w-px bg-divider-regular"></div>
- <button
- type="button"
- className="inline cursor-pointer border-none bg-transparent p-0 text-left system-sm-semibold-uppercase text-text-accent focus-visible:ring-1 focus-visible:ring-components-input-border-active focus-visible:outline-hidden"
- onClick={handleRetryAllFailedTask}
- >
- {t(($) => $['generation.batchFailed.retry'], { ns: 'share' })}
- </button>
+ <div className="absolute bottom-6 left-1/2 z-10 -translate-x-1/2">
+ <Alert type="error" className="w-max max-w-105">
+ <AlertTitle>
+ {t(($) => $['generation.batchFailed.info'], {
+ ns: 'share',
+ num: allFailedTaskList.length,
+ })}
+ </AlertTitle>
+ <AlertActions>
+ <Button size="small" onClick={handleRetryAllFailedTask}>
+ {t(($) => $['generation.batchFailed.retry'], { ns: 'share' })}
+ </Button>
+ </AlertActions>
+ </Alert>
</div>
)}
</div>
diff --git a/web/app/components/tools/mcp/sections/authentication-section.tsx b/web/app/components/tools/mcp/sections/authentication-section.tsx
index 0d5c8646bc3..4ecb6f7e18e 100644
--- a/web/app/components/tools/mcp/sections/authentication-section.tsx
+++ b/web/app/components/tools/mcp/sections/authentication-section.tsx
@@ -1,5 +1,6 @@
'use client'
import type { FC } from 'react'
+import { Alert, AlertDescription, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
import { Input } from '@langgenius/dify-ui/input'
import { Switch } from '@langgenius/dify-ui/switch'
@@ -44,20 +45,14 @@ const AuthenticationSection: FC<AuthenticationSectionProps> = ({
</span>
</div>
{!isDynamicRegistration && (
- <div className="mt-2 flex gap-2 rounded-lg bg-state-warning-hover p-3">
- <span
- aria-hidden
- className="mt-0.5 i-custom-vender-solid-alertsAndFeedback-alert-triangle size-4 shrink-0 text-text-warning"
- />
- <div className="system-xs-regular text-text-secondary">
- <div className="mb-1">
- {t(($) => $['mcp.modal.redirectUrlWarning'], { ns: 'tools' })}
- </div>
- <code className="block rounded-sm bg-state-warning-active px-2 py-1 system-xs-medium break-all text-text-secondary">
+ <Alert type="warning" className="mt-2">
+ <AlertTitle>{t(($) => $['mcp.modal.redirectUrlWarning'], { ns: 'tools' })}</AlertTitle>
+ <AlertDescription>
+ <code className="mt-1 block rounded-sm bg-state-warning-active px-2 py-1 system-xs-medium break-all text-text-secondary">
{`${API_PREFIX}/mcp/oauth/callback`}
</code>
- </div>
- </div>
+ </AlertDescription>
+ </Alert>
)}
</div>
<div>
diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx
index 3f0b9962d78..47d82f35c21 100644
--- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx
+++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-tip.tsx
@@ -1,4 +1,4 @@
-import { RiAlertFill } from '@remixicon/react'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { ErrorHandleTypeEnum } from './types'
@@ -20,17 +20,9 @@ const ErrorHandleTip = ({ type }: ErrorHandleTipProps) => {
if (!type) return null
return (
- <div className="relative flex rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 pr-13 shadow-xs">
- <div
- className="absolute inset-0 rounded-lg opacity-40"
- style={{
- background:
- 'linear-gradient(92deg, rgba(247, 144, 9, 0.25) 0%, rgba(255, 255, 255, 0.00) 100%)',
- }}
- ></div>
- <RiAlertFill className="mr-1 size-4 shrink-0 text-text-warning-secondary" />
- <div className="grow system-xs-medium text-text-primary">{text}</div>
- </div>
+ <Alert type="warning">
+ <AlertTitle>{text}</AlertTitle>
+ </Alert>
)
}
diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
index 81ad8c64527..dec77a9fca0 100644
--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/search-method-option.tsx
@@ -3,6 +3,7 @@ import type { WeightedScore } from '../../types'
import type { RerankingModelSelectorProps } from './reranking-model-selector'
import type { TopKFieldProps, VisibleScoreThresholdFieldProps } from './top-k-and-score-threshold'
import type { HybridSearchModeOption, Option } from './type'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
import { Field, FieldItem, FieldLabel } from '@langgenius/dify-ui/field'
import { Fieldset, FieldsetLegend } from '@langgenius/dify-ui/fieldset'
@@ -310,15 +311,11 @@ export function SearchMethodOption({
readonly={readonly}
/>
{reranking.showMultiModalTip ? (
- <div className="mt-2 flex h-10 items-center gap-x-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs backdrop-blur-[5px]">
- <div className="absolute inset-0 bg-dataset-warning-message-bg opacity-40" />
- <div className="p-1">
- <div className="i-custom-vender-solid-alertsAndFeedback-alert-triangle size-4 text-text-warning-secondary" />
- </div>
- <span className="system-xs-medium text-text-primary">
+ <Alert type="warning" className="mt-2">
+ <AlertTitle>
{t(($) => $['form.retrievalSetting.multiModalTip'], { ns: 'datasetSettings' })}
- </span>
- </div>
+ </AlertTitle>
+ </Alert>
) : null}
</div>
) : null}
diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/error-message.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/error-message.tsx
index 90d5572f462..bd2b3f01c0c 100644
--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/error-message.tsx
+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/error-message.tsx
@@ -1,6 +1,6 @@
import type { FC } from 'react'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { cn } from '@langgenius/dify-ui/cn'
-import { RiErrorWarningFill } from '@remixicon/react'
import * as React from 'react'
type ErrorMessageProps = {
@@ -9,17 +9,11 @@ type ErrorMessageProps = {
const ErrorMessage: FC<ErrorMessageProps> = ({ message, className }) => {
return (
- <div
- className={cn(
- 'mt-1 flex gap-x-1 rounded-lg border-[0.5px] border-components-panel-border bg-toast-error-bg p-2',
- className,
- )}
- >
- <RiErrorWarningFill className="size-4 shrink-0 text-text-destructive" />
- <div className="max-h-12 grow overflow-y-auto system-xs-medium wrap-break-word whitespace-pre-line text-text-primary">
- {message}
- </div>
- </div>
+ <Alert type="error" role="note" className={cn('mt-1', className)}>
+ <AlertTitle className="whitespace-pre-line">
+ <div className="max-h-12 overflow-y-auto">{message}</div>
+ </AlertTitle>
+ </Alert>
)
}
diff --git a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx
index d490a042a99..f527ad0f826 100644
--- a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx
+++ b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx
@@ -1,4 +1,5 @@
import type { AgentLogItemWithChildren } from '@/types/workflow'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { useTranslation } from 'react-i18next'
import AgentLogItem from './agent-log-item'
import { AgentLogNav } from './agent-log-nav'
@@ -33,19 +34,9 @@ const AgentResultPanel = ({
))}
</div>
{top!.hasCircle && (
- <div className="mt-1 flex items-center rounded-xl border border-components-panel-border bg-components-panel-bg-blur px-3 pr-2 shadow-md">
- <div
- className="absolute inset-0 rounded-xl opacity-[0.4]"
- style={{
- background:
- 'linear-gradient(92deg, rgba(247, 144, 9, 0.25) 0%, rgba(255, 255, 255, 0.00) 100%)',
- }}
- ></div>
- <span aria-hidden className="mr-1.5 i-ri-alert-fill size-4 text-text-warning-secondary" />
- <div className="system-xs-medium text-text-primary">
- {t(($) => $.circularInvocationTip, { ns: 'runLog' })}
- </div>
- </div>
+ <Alert type="warning" className="mt-1">
+ <AlertTitle>{t(($) => $.circularInvocationTip, { ns: 'runLog' })}</AlertTitle>
+ </Alert>
)}
</div>
)
diff --git a/web/app/components/workflow/run/node.tsx b/web/app/components/workflow/run/node.tsx
index 36c6d2c8f08..c3deb487442 100644
--- a/web/app/components/workflow/run/node.tsx
+++ b/web/app/components/workflow/run/node.tsx
@@ -343,7 +343,7 @@ const NodePanel: FC<Props> = ({
isJSONStringifyBeauty
footer={
nodeInfo.inputs_truncated && (
- <LargeDataAlert textHasNoExport className="mx-1 mt-2 mb-1 h-7" />
+ <LargeDataAlert textHasNoExport className="mx-1 mt-2 mb-1" />
)
}
/>
@@ -376,7 +376,7 @@ const NodePanel: FC<Props> = ({
<LargeDataAlert
textHasNoExport
downloadUrl={nodeInfo.outputs_full_content?.download_url}
- className="mx-1 mt-2 mb-1 h-7"
+ className="mx-1 mt-2 mb-1"
/>
)
}
diff --git a/web/app/components/workflow/run/result-panel.tsx b/web/app/components/workflow/run/result-panel.tsx
index a3553079433..510339cd955 100644
--- a/web/app/components/workflow/run/result-panel.tsx
+++ b/web/app/components/workflow/run/result-panel.tsx
@@ -122,9 +122,7 @@ const ResultPanel: FC<ResultPanelProps> = ({
language={CodeLanguage.json}
value={inputs}
isJSONStringifyBeauty
- footer={
- inputs_truncated && <LargeDataAlert textHasNoExport className="mx-1 mt-2 mb-1 h-7" />
- }
+ footer={inputs_truncated && <LargeDataAlert textHasNoExport className="mx-1 mt-2 mb-1" />}
/>
{process_data && (
<CodeEditor
@@ -138,7 +136,7 @@ const ResultPanel: FC<ResultPanelProps> = ({
isJSONStringifyBeauty
footer={
process_data_truncated && (
- <LargeDataAlert textHasNoExport className="mx-1 mt-2 mb-1 h-7" />
+ <LargeDataAlert textHasNoExport className="mx-1 mt-2 mb-1" />
)
}
/>
@@ -159,7 +157,7 @@ const ResultPanel: FC<ResultPanelProps> = ({
<LargeDataAlert
textHasNoExport
downloadUrl={outputs_full_content?.download_url}
- className="mx-1 mt-2 mb-1 h-7"
+ className="mx-1 mt-2 mb-1"
/>
)
}
diff --git a/web/app/components/workflow/update-dsl-modal.tsx b/web/app/components/workflow/update-dsl-modal.tsx
index aca1e223b42..036e8f3f8d6 100644
--- a/web/app/components/workflow/update-dsl-modal.tsx
+++ b/web/app/components/workflow/update-dsl-modal.tsx
@@ -3,6 +3,7 @@
import type { AppDetailWithSite, Import } from '@dify/contracts/api/console/apps/types.gen'
import type { DialogActions, DialogProps } from '@langgenius/dify-ui/dialog'
import type { ReactNode } from 'react'
+import { Alert, AlertActions, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import {
Dialog,
@@ -14,7 +15,7 @@ import {
DialogHeaderCloseButton,
DialogTitle,
} from '@langgenius/dify-ui/dialog'
-import { RiAlertFill, RiFileDownloadLine } from '@remixicon/react'
+import { RiFileDownloadLine } from '@remixicon/react'
import { useMutation } from '@tanstack/react-query'
import { memo, useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -316,32 +317,17 @@ function ImportForm({
/>
</DialogHeader>
<DialogBody>
- <div className="relative mb-2 flex grow gap-0.5 overflow-hidden rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-2 shadow-xs">
- <div className="pointer-events-none absolute top-0 left-0 size-full bg-toast-warning-bg opacity-40" />
- <div className="flex items-start justify-center p-1">
- <RiAlertFill className="size-4 shrink-0 text-text-warning-secondary" />
- </div>
- <div className="flex grow flex-col items-start gap-0.5 py-1">
- <div className="system-xs-medium whitespace-pre-line text-text-primary">
- {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
- </div>
- <div className="flex items-start gap-1 self-stretch pt-1 pb-0.5">
- <Button
- type="button"
- size="small"
- variant="secondary"
- className="relative"
- disabled={isImporting}
- onClick={onBackup}
- >
- <RiFileDownloadLine className="size-3.5 text-components-button-secondary-text" />
- <div className="flex items-center justify-center gap-1">
- {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
- </div>
- </Button>
- </div>
- </div>
- </div>
+ <Alert type="warning" className="mb-2">
+ <AlertTitle className="whitespace-pre-line">
+ {t(($) => $['common.importDSLTip'], { ns: 'workflow' })}
+ </AlertTitle>
+ <AlertActions>
+ <Button type="button" size="small" disabled={isImporting} onClick={onBackup}>
+ <RiFileDownloadLine className="size-3.5" />
+ {t(($) => $['common.backupCurrentDraft'], { ns: 'workflow' })}
+ </Button>
+ </AlertActions>
+ </Alert>
<div>
<div className="pt-2 system-md-semibold text-text-primary">
{t(($) => $.chooseAppFile, { ns: 'app' })}
diff --git a/web/app/components/workflow/variable-inspect/large-data-alert.tsx b/web/app/components/workflow/variable-inspect/large-data-alert.tsx
index c190c770b7b..ad66d3d03c8 100644
--- a/web/app/components/workflow/variable-inspect/large-data-alert.tsx
+++ b/web/app/components/workflow/variable-inspect/large-data-alert.tsx
@@ -1,7 +1,6 @@
'use client'
import type { FC } from 'react'
-import { cn } from '@langgenius/dify-ui/cn'
-import { RiInformation2Fill } from '@remixicon/react'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
@@ -13,33 +12,24 @@ type Props = Readonly<{
const LargeDataAlert: FC<Props> = ({ textHasNoExport, downloadUrl, className }) => {
const { t } = useTranslation(['workflowDebug'])
- const text = textHasNoExport
- ? t(($) => $['debug.variableInspect.largeDataNoExport'], { ns: 'workflowDebug' })
- : t(($) => $['debug.variableInspect.largeData'], { ns: 'workflowDebug' })
return (
- <div
- className={cn(
- 'flex h-8 items-center justify-between rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg-blur px-2 shadow-xs',
- className,
- )}
- >
- <div className="flex h-full w-0 grow items-center space-x-1">
- <RiInformation2Fill className="size-4 shrink-0 text-text-accent" />
- <div className="w-0 grow truncate system-xs-regular text-text-primary" title={text}>
- {text}
- </div>
- </div>
+ <Alert type="info" className={className}>
+ <AlertTitle>
+ {textHasNoExport
+ ? t(($) => $['debug.variableInspect.largeDataNoExport'], { ns: 'workflowDebug' })
+ : t(($) => $['debug.variableInspect.largeData'], { ns: 'workflowDebug' })}
+ </AlertTitle>
{downloadUrl && (
<a
href={downloadUrl}
target="_blank"
rel="noopener noreferrer"
- className="ml-1 shrink-0 cursor-pointer system-xs-medium-uppercase text-text-accent"
+ className="self-start system-xs-medium-uppercase text-text-accent"
>
{t(($) => $['debug.variableInspect.export'], { ns: 'workflowDebug' })}
</a>
)}
- </div>
+ </Alert>
)
}
export default React.memo(LargeDataAlert)
diff --git a/web/app/components/workflow/variable-inspect/value-content-sections.tsx b/web/app/components/workflow/variable-inspect/value-content-sections.tsx
index 473cc57c9fb..f9291d1fa57 100644
--- a/web/app/components/workflow/variable-inspect/value-content-sections.tsx
+++ b/web/app/components/workflow/variable-inspect/value-content-sections.tsx
@@ -1,7 +1,6 @@
import type { UploadConfig } from '@dify/contracts/api/console/files/types.gen'
import type { FileEntity } from '@/app/components/base/file-uploader/types'
import type { VarInInspect } from '@/types/workflow'
-import { cn } from '@langgenius/dify-ui/cn'
import { Textarea } from '@langgenius/dify-ui/textarea'
import { useTranslation } from 'react-i18next'
import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uploader'
@@ -34,28 +33,29 @@ export const TextEditorSection = ({
const { t } = useTranslation(['workflow'])
return (
- <>
- {isTruncated && <LargeDataAlert className="absolute inset-x-3 top-1" />}
- {currentVar.value_type === 'string' ? (
- <DisplayContent
- previewType={PreviewType.Markdown}
- varType={currentVar.value_type}
- mdString={typeof value === 'string' ? value : String(value ?? '')}
- readonly={textEditorDisabled || isTruncated}
- handleTextChange={onTextChange}
- className={cn(isTruncated && 'pt-9')}
- />
- ) : (
- <Textarea
- aria-label={t(($) => $['errorMsg.fields.variableValue'], { ns: 'workflow' })}
- readOnly={textEditorDisabled}
- disabled={textEditorDisabled || isTruncated}
- className={cn('h-full', isTruncated && 'pt-12')}
- value={typeof value === 'number' ? value : String(value ?? '')}
- onValueChange={(value) => onTextChange(value)}
- />
- )}
- </>
+ <div className="flex h-full flex-col">
+ {isTruncated && <LargeDataAlert className="mx-3 mt-1 mb-1 shrink-0" />}
+ <div className="min-h-0 grow">
+ {currentVar.value_type === 'string' ? (
+ <DisplayContent
+ previewType={PreviewType.Markdown}
+ varType={currentVar.value_type}
+ mdString={typeof value === 'string' ? value : String(value ?? '')}
+ readonly={textEditorDisabled || isTruncated}
+ handleTextChange={onTextChange}
+ />
+ ) : (
+ <Textarea
+ aria-label={t(($) => $['errorMsg.fields.variableValue'], { ns: 'workflow' })}
+ readOnly={textEditorDisabled}
+ disabled={textEditorDisabled || isTruncated}
+ className="h-full"
+ value={typeof value === 'number' ? value : String(value ?? '')}
+ onValueChange={(value) => onTextChange(value)}
+ />
+ )}
+ </div>
+ </div>
)
}
diff --git a/web/app/education/apply/application-form.tsx b/web/app/education/apply/application-form.tsx
index d9a71b750e8..639ff462ed4 100644
--- a/web/app/education/apply/application-form.tsx
+++ b/web/app/education/apply/application-form.tsx
@@ -7,6 +7,7 @@ import type { ErrorFromErrorMap, InferContractRouterErrorMap } from '@orpc/contr
import type { TFunction } from 'i18next'
import type { ReactNode } from 'react'
import type { EducationRole } from './types'
+import { Alert, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
import { Checkbox } from '@langgenius/dify-ui/checkbox'
import { CheckboxGroup } from '@langgenius/dify-ui/checkbox-group'
@@ -176,12 +177,8 @@ const EducationApplyPage = ({ plan, token }: EducationApplyPageProps) => {
if (appliedEducationCase === AppliedEducationCase.activeSubscription) {
return (
<div className="flex w-full flex-col items-start gap-3">
- <div className="flex w-full items-start rounded-lg border-[0.5px] border-components-badge-status-light-warning-halo bg-state-warning-hover px-3 py-2.5">
- <span
- className="me-2 mt-0.5 i-ri-alert-fill size-4 shrink-0 text-text-warning-secondary"
- aria-hidden="true"
- />
- <div className="system-md-regular text-text-warning">
+ <Alert type="warning" className="w-full">
+ <AlertTitle>
<Trans
i18nKey={($) => $['applied.activeSubscription.description']}
ns="education"
@@ -196,8 +193,8 @@ const EducationApplyPage = ({ plan, token }: EducationApplyPageProps) => {
),
}}
/>
- </div>
- </div>
+ </AlertTitle>
+ </Alert>
{renderBackToDifyButton()}
</div>
)
@@ -205,15 +202,11 @@ const EducationApplyPage = ({ plan, token }: EducationApplyPageProps) => {
return (
<div className="flex w-full flex-col items-start gap-3">
- <div className="flex w-full items-start rounded-lg border-[0.5px] border-components-badge-status-light-warning-halo bg-state-warning-hover px-3 py-2.5">
- <span
- className="me-2 mt-0.5 i-ri-alert-fill size-4 shrink-0 text-text-warning-secondary"
- aria-hidden="true"
- />
- <div className="system-md-regular text-text-warning">
+ <Alert type="warning" className="w-full">
+ <AlertTitle>
{t(($) => $['applied.noPaymentPermission.description'], { ns: 'education' })}
- </div>
- </div>
+ </AlertTitle>
+ </Alert>
{renderBackToDifyButton()}
</div>
)
diff --git a/web/app/signin/components/turnstile.tsx b/web/app/signin/components/turnstile.tsx
index be8c8e21373..efb08650b8b 100644
--- a/web/app/signin/components/turnstile.tsx
+++ b/web/app/signin/components/turnstile.tsx
@@ -1,3 +1,4 @@
+import { Alert, AlertActions, AlertTitle } from '@langgenius/dify-ui/alert'
import { Button } from '@langgenius/dify-ui/button'
import { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -141,18 +142,14 @@ export default function Turnstile({
return (
<>
{hasError && (
- <div
- role="alert"
- className="mt-3 flex min-h-16.25 w-full items-center gap-3 rounded-xl border border-state-destructive-border bg-state-destructive-hover-alt p-3"
- >
- <span className="i-ri-error-warning-fill size-4 shrink-0 text-text-destructive" />
- <span className="grow system-xs-regular text-text-destructive">
- {t(($) => $['turnstile.loadError'], { ns: 'login' })}
- </span>
- <Button type="button" size="small" variant="secondary" onClick={handleRetry}>
- {t(($) => $['operation.retry'], { ns: 'common' })}
- </Button>
- </div>
+ <Alert type="error" className="mt-3 w-full">
+ <AlertTitle>{t(($) => $['turnstile.loadError'], { ns: 'login' })}</AlertTitle>
+ <AlertActions>
+ <Button type="button" size="small" onClick={handleRetry}>
+ {t(($) => $['operation.retry'], { ns: 'common' })}
+ </Button>
+ </AlertActions>
+ </Alert>
)}
<div ref={containerRef} className={`mt-3 h-16.25 w-full ${hasError ? 'hidden' : ''}`} />
<Script