mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-07 05:53:46 +00:00
feat(ui): support mention notification on notification popover (#6395)
* feat(ui): support mention notification on notification popover * move timer to constant * update notification text
This commit is contained in:
parent
7fdab21a72
commit
3036e7fb5c
@ -16,7 +16,10 @@ import { isEmpty } from 'lodash';
|
|||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import AppState from '../../AppState';
|
import AppState from '../../AppState';
|
||||||
import { getFeedsWithFilter } from '../../axiosAPIs/feedsAPI';
|
import { getFeedsWithFilter } from '../../axiosAPIs/feedsAPI';
|
||||||
import { getUserPath } from '../../constants/constants';
|
import {
|
||||||
|
getUserPath,
|
||||||
|
NOTIFICATION_READ_TIMER,
|
||||||
|
} from '../../constants/constants';
|
||||||
import { FeedFilter } from '../../enums/mydata.enum';
|
import { FeedFilter } from '../../enums/mydata.enum';
|
||||||
import { NotificationTabsKey } from '../../enums/notification.enum';
|
import { NotificationTabsKey } from '../../enums/notification.enum';
|
||||||
import { ThreadType } from '../../generated/api/feed/createThread';
|
import { ThreadType } from '../../generated/api/feed/createThread';
|
||||||
@ -115,7 +118,7 @@ const NotificationBox = ({
|
|||||||
key === NotificationTabsKey.TASK
|
key === NotificationTabsKey.TASK
|
||||||
? onMarkTaskNotificationRead()
|
? onMarkTaskNotificationRead()
|
||||||
: onMarkMentionsNotificationRead();
|
: onMarkMentionsNotificationRead();
|
||||||
}, 4000);
|
}, NOTIFICATION_READ_TIMER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[currentUser, hasTaskNotification, hasMentionNotification]
|
[currentUser, hasTaskNotification, hasMentionNotification]
|
||||||
@ -153,6 +156,7 @@ const NotificationBox = ({
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<List
|
<List
|
||||||
|
className="tw-min-h-64"
|
||||||
dataSource={notificationDropDownList}
|
dataSource={notificationDropDownList}
|
||||||
footer={
|
footer={
|
||||||
<Button block href={viewAllPath} type="link">
|
<Button block href={viewAllPath} type="link">
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
import Icon from '@ant-design/icons';
|
import Icon from '@ant-design/icons';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { ReactComponent as IconMentions } from '../../assets/svg/ic-mentions.svg';
|
||||||
import { ReactComponent as IconTask } from '../../assets/svg/ic-task.svg';
|
import { ReactComponent as IconTask } from '../../assets/svg/ic-task.svg';
|
||||||
import { FeedFilter } from '../../enums/mydata.enum';
|
import { FeedFilter } from '../../enums/mydata.enum';
|
||||||
import {
|
import {
|
||||||
@ -34,19 +35,18 @@ export const tabsInfo = [
|
|||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
// TODO: remove comments when Backend support for Mention is done
|
{
|
||||||
// {
|
name: NotificationTabsName.MENTION,
|
||||||
// name: NotificationTabsName.MENTION,
|
key: NotificationTabsKey.CONVERSATION,
|
||||||
// key: NotificationTabsKey.CONVERSATION,
|
icon: (
|
||||||
// icon: (
|
<Icon
|
||||||
// <Icon
|
component={IconMentions}
|
||||||
// component={IconMentions}
|
style={{
|
||||||
// style={{
|
marginRight: '8px',
|
||||||
// marginRight: '8px',
|
}}
|
||||||
// }}
|
/>
|
||||||
// />
|
),
|
||||||
// ),
|
},
|
||||||
// },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const getFilters = (activeTab: ThreadType) => ({
|
export const getFilters = (activeTab: ThreadType) => ({
|
||||||
|
|||||||
@ -49,7 +49,7 @@ const NotificationFeedCard: FC<NotificationFeedProp> = ({
|
|||||||
<>{createdBy}</>
|
<>{createdBy}</>
|
||||||
{feedType === ThreadType.Conversation ? (
|
{feedType === ThreadType.Conversation ? (
|
||||||
<>
|
<>
|
||||||
<span> posted on </span> <span>{entityType} </span>
|
<span> mentioned you on the </span> <span>{entityType} </span>
|
||||||
<Link
|
<Link
|
||||||
className="tw-truncate"
|
className="tw-truncate"
|
||||||
to={prepareFeedLink(entityType, entityFQN)}>
|
to={prepareFeedLink(entityType, entityFQN)}>
|
||||||
|
|||||||
@ -17,7 +17,11 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|||||||
import { Link, NavLink, useHistory } from 'react-router-dom';
|
import { Link, NavLink, useHistory } from 'react-router-dom';
|
||||||
import AppState from '../../AppState';
|
import AppState from '../../AppState';
|
||||||
import Logo from '../../assets/svg/logo-monogram.svg';
|
import Logo from '../../assets/svg/logo-monogram.svg';
|
||||||
import { ROUTES, SOCKET_EVENTS } from '../../constants/constants';
|
import {
|
||||||
|
NOTIFICATION_READ_TIMER,
|
||||||
|
ROUTES,
|
||||||
|
SOCKET_EVENTS,
|
||||||
|
} from '../../constants/constants';
|
||||||
import {
|
import {
|
||||||
hasNotificationPermission,
|
hasNotificationPermission,
|
||||||
shouldRequestPermission,
|
shouldRequestPermission,
|
||||||
@ -103,7 +107,7 @@ const NavBar = ({
|
|||||||
hasTaskNotification &&
|
hasTaskNotification &&
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
handleTaskNotificationRead();
|
handleTaskNotificationRead();
|
||||||
}, 5000);
|
}, NOTIFICATION_READ_TIMER);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -111,7 +115,7 @@ const NavBar = ({
|
|||||||
hasMentionNotification &&
|
hasMentionNotification &&
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
handleMentionsNotificationRead();
|
handleMentionsNotificationRead();
|
||||||
}, 5000);
|
}, NOTIFICATION_READ_TIMER);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -125,8 +129,8 @@ const NavBar = ({
|
|||||||
const showBrowserNotification = (
|
const showBrowserNotification = (
|
||||||
about: string,
|
about: string,
|
||||||
createdBy: string,
|
createdBy: string,
|
||||||
id: string,
|
type: string,
|
||||||
type: string
|
id?: string
|
||||||
) => {
|
) => {
|
||||||
if (!hasNotificationPermission()) {
|
if (!hasNotificationPermission()) {
|
||||||
return;
|
return;
|
||||||
@ -169,8 +173,8 @@ const NavBar = ({
|
|||||||
showBrowserNotification(
|
showBrowserNotification(
|
||||||
activity.about,
|
activity.about,
|
||||||
activity.createdBy,
|
activity.createdBy,
|
||||||
activity.task.id,
|
activity.type,
|
||||||
activity.type
|
activity.task?.id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -182,8 +186,8 @@ const NavBar = ({
|
|||||||
showBrowserNotification(
|
showBrowserNotification(
|
||||||
activity.about,
|
activity.about,
|
||||||
activity.createdBy,
|
activity.createdBy,
|
||||||
activity.task.id,
|
activity.type,
|
||||||
activity.type
|
activity.task?.id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -286,7 +290,9 @@ const NavBar = ({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
overlayStyle={{
|
overlayStyle={{
|
||||||
|
zIndex: 9999,
|
||||||
width: '425px',
|
width: '425px',
|
||||||
|
minHeight: '375px',
|
||||||
}}
|
}}
|
||||||
placement="bottomRight"
|
placement="bottomRight"
|
||||||
trigger={['click']}
|
trigger={['click']}
|
||||||
|
|||||||
@ -451,3 +451,5 @@ export const TITLE_FOR_UPDATE_DESCRIPTION =
|
|||||||
export const configOptions = {
|
export const configOptions = {
|
||||||
headers: { 'Content-type': 'application/json-patch+json' },
|
headers: { 'Content-type': 'application/json-patch+json' },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const NOTIFICATION_READ_TIMER = 2500;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user