diff --git a/web/app/components/base/confirm/index.tsx b/web/app/components/base/confirm/index.tsx index 8cb1c8bf8b..77a14fd64f 100644 --- a/web/app/components/base/confirm/index.tsx +++ b/web/app/components/base/confirm/index.tsx @@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' import Button from '../button' +import Tooltip from '../tooltip' export type IConfirm = { className?: string @@ -37,7 +38,9 @@ function Confirm({ }: IConfirm) { const { t } = useTranslation() const dialogRef = useRef(null) + const titleRef = useRef(null) const [isVisible, setIsVisible] = useState(isShow) + const [isTitleTruncated, setIsTitleTruncated] = useState(false) const confirmTxt = confirmText || `${t('common.operation.confirm')}` const cancelTxt = cancelText || `${t('common.operation.cancel')}` @@ -80,6 +83,13 @@ function Confirm({ } }, [isShow]) + useEffect(() => { + if (titleRef.current) { + const isOverflowing = titleRef.current.scrollWidth > titleRef.current.clientWidth + setIsTitleTruncated(isOverflowing) + } + }, [title, isVisible]) + if (!isVisible) return null @@ -92,8 +102,18 @@ function Confirm({
-
{title}
-
{content}
+ +
+ {title} +
+
+
{content}
{showCancel && } diff --git a/web/app/components/base/tooltip/index.tsx b/web/app/components/base/tooltip/index.tsx index eb7ca56cb0..46680c8f5b 100644 --- a/web/app/components/base/tooltip/index.tsx +++ b/web/app/components/base/tooltip/index.tsx @@ -17,6 +17,7 @@ export type TooltipProps = { popupContent?: React.ReactNode children?: React.ReactNode popupClassName?: string + portalContentClassName?: string noDecoration?: boolean offset?: OffsetOptions needsDelay?: boolean @@ -32,6 +33,7 @@ const Tooltip: FC = ({ popupContent, children, popupClassName, + portalContentClassName, noDecoration, offset, asChild = true, @@ -104,7 +106,7 @@ const Tooltip: FC = ({ {children ||
} {popupContent && (
{ )} )} - {currentStep === ApiKeyStep.Configuration &&
+ {currentStep === ApiKeyStep.Configuration &&
{ + onSelect(...args) + setIsOpen(false) + }} />