diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataMarketplace/AnnouncementsWidgetV2/AnnouncementItemV2.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataMarketplace/AnnouncementsWidgetV2/AnnouncementItemV2.component.tsx index e588a293b692..68869a5ce0d6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataMarketplace/AnnouncementsWidgetV2/AnnouncementItemV2.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataMarketplace/AnnouncementsWidgetV2/AnnouncementItemV2.component.tsx @@ -72,8 +72,10 @@ const AnnouncementItemV2 = ({ } }}> { if (loading) { return (
@@ -131,7 +131,7 @@ const AnnouncementsWidgetV2 = ({ isEditView }: WidgetCommonProps) => { return (
@@ -148,7 +148,7 @@ const AnnouncementsWidgetV2 = ({ isEditView }: WidgetCommonProps) => { className="tw:rounded-md tw:bg-bg-primary tw:px-2 tw:py-0.5 tw:text-text-tertiary" size="text-sm" weight="medium"> - {String(announcements.length).padStart(2, '0')} + {announcements.length}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1.component.tsx index 84642ce008aa..b65dc41de34c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1.component.tsx @@ -14,15 +14,11 @@ import { Card, Typography } from 'antd'; import classNames from 'classnames'; import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { Link } from 'react-router-dom'; import { AnnouncementEntity } from '../../../../../rest/announcementsAPI'; -import { getShortRelativeTime } from '../../../../../utils/date-time/DateTimeUtils'; -import entityUtilClassBase from '../../../../../utils/EntityUtilClassBase'; import { getEntityFQN, getEntityType } from '../../../../../utils/FeedUtils'; -import { getUserPath } from '../../../../../utils/RouterUtils'; import { getEntityIcon } from '../../../../../utils/TableUtils'; -import RichTextEditorPreviewerV1 from '../../../../common/RichTextEditor/RichTextEditorPreviewerV1'; import './announcement-card-v1.less'; +import AnnouncementCardV1Content from './AnnouncementCardV1Content.component'; interface AnnouncementCardV1Props { announcement: AnnouncementEntity; @@ -61,115 +57,35 @@ const AnnouncementCardV1 = ({ }; }, [announcement]); - const { - announcementTitleSectionStyle, - announcementTitleStyle, - userNameStyle, - timeStampStyle, - } = useMemo(() => { - if (!currentBackgroundColor) { - return {}; - } - - return { - announcementTitleSectionStyle: { - background: `linear-gradient(270deg, #ffffff -12.07%, ${currentBackgroundColor} 500.72%)`, - color: `${currentBackgroundColor} !important`, - }, - announcementTitleStyle: { - borderLeft: `3px solid ${currentBackgroundColor}`, - color: `${currentBackgroundColor} !important`, - }, - userNameStyle: { - color: currentBackgroundColor, - }, - timeStampStyle: { - color: currentBackgroundColor, - }, - }; - }, [currentBackgroundColor]); - const entityIcon = useMemo(() => getEntityIcon(entityType), [entityType]); + const gradientBackground = currentBackgroundColor + ? `linear-gradient(270deg, #ffffff -12.07%, ${currentBackgroundColor} 500.72%)` + : undefined; + return ( -
-
-
-
- {userName && ( - e.stopPropagation()}> - {userName} - - )} - - {entityIcon} - - {entityFQN && entityType ? ( - - e.stopPropagation()}> - {entityName} - - - ) : ( - - {entityName} - - )} -
- - {getShortRelativeTime(timestamp)} - -
-
- - - {title} - - - {description && ( - - )} - - {!description && ( - - {t('message.no-announcement-message')} - - )} -
+ + {!description && ( + + {t('message.no-announcement-message')} + + )}
); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1Content.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1Content.component.tsx index 510f5b7a2a93..d58e72c6499b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1Content.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/AnnouncementCardV1Content.component.tsx @@ -26,6 +26,8 @@ import './announcement-card-v1-content.less'; const PRIMARY_COLOR = 'var(--ant-primary-color)'; interface AnnouncementCardV1ContentProps { + backgroundColor?: string; + borderColor?: string; className?: string; columnName: string; currentBackgroundColor?: string; @@ -44,13 +46,15 @@ interface AnnouncementCardV1ContentProps { const VARIANT_CONFIG = { default: { header: 'tw:h-11 tw:text-[16px] tw:rounded-lg', + titleSection: '', entityName: 'tw:!text-base tw:!font-medium', iconSize: 'tw:size-4', title: 'tw:text-sm tw:font-medium tw:!mb-1', description: 'tw:text-sm tw:mt-2', }, compact: { - header: 'tw:h-[30px] tw:text-xs tw:rounded-l-md', + header: 'tw:h-[30px] tw:flex-none tw:text-xs tw:rounded-[4px]', + titleSection: 'tw:px-[10px] tw:py-[6px] tw:pl-1', entityName: 'tw:!text-[11px] tw:!font-normal', iconSize: 'tw:size-[9px]', title: 'tw:text-xs tw:font-medium tw:!mb-0', @@ -59,6 +63,8 @@ const VARIANT_CONFIG = { }; const AnnouncementCardV1Content = ({ + backgroundColor, + borderColor, className, columnName, currentBackgroundColor, @@ -77,6 +83,8 @@ const AnnouncementCardV1Content = ({ const { t } = useTranslation(); const color = currentBackgroundColor ?? PRIMARY_COLOR; + const bgColor = backgroundColor ?? color; + const accentBorderColor = borderColor ?? color; const { announcementTitleSectionStyle, @@ -86,11 +94,11 @@ const AnnouncementCardV1Content = ({ } = useMemo(() => { return { announcementTitleSectionStyle: { - background: `linear-gradient(270deg, #ffffff -12.07%, ${color} 500.72%)`, + background: bgColor, + borderLeft: `3px solid ${accentBorderColor}`, color: `${color} !important`, }, announcementTitleStyle: { - borderLeft: `3px solid ${color}`, color: `${color} !important`, }, userNameStyle: { @@ -100,7 +108,7 @@ const AnnouncementCardV1Content = ({ color, }, }; - }, [color]); + }, [color, bgColor, accentBorderColor]); const handleEntityClick = (e: React.MouseEvent) => { e.stopPropagation(); @@ -116,30 +124,35 @@ const AnnouncementCardV1Content = ({
- {fieldOperation && fieldOperation !== FieldOperation.None ? ( + {userName || entityName ? (
- - {userName} - - - {' '} - {getFieldOperationText(fieldOperation)} - + {userName && ( + + {userName} + + )} + {fieldOperation && fieldOperation !== FieldOperation.None && ( + + {' '} + {getFieldOperationText(fieldOperation)} + + )}
- {fieldOperation && fieldOperation !== FieldOperation.None && ( + {(userName || entityName) && title && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/announcement-card-v1-content.less b/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/announcement-card-v1-content.less index 45ef72b71d2e..f562df42d2a3 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/announcement-card-v1-content.less +++ b/openmetadata-ui/src/main/resources/ui/src/components/MyData/Widgets/AnnouncementsWidgetV1/AnnouncementCardV1/announcement-card-v1-content.less @@ -90,7 +90,6 @@ .announcement-header { align-items: center; - border-left: 3px solid @primary-color; display: flex; flex: 1; font-weight: @font-semibold;