From e15e2dc47c81308ff4993070cf97192e44a0790c Mon Sep 17 00:00:00 2001 From: janWilejan <119548498+janWilejan@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:28:12 +0000 Subject: [PATCH] Fix deprecated antd dropdown warnings (#3171) * Fix deprecated antd dropdown warnings --- .../ActionButtonMenu/ActionButtonMenu.tsx | 8 +-- .../ChatModerationActionMenu.module.scss | 3 - .../ChatModerationActionMenu.tsx | 67 ++++++------------- .../common/UserDropdown/UserDropdown.tsx | 66 +++++++++--------- web/pages/admin/viewer-info.tsx | 26 +++---- 5 files changed, 65 insertions(+), 105 deletions(-) delete mode 100644 web/components/chat/ChatModerationActionMenu/ChatModerationActionMenu.module.scss diff --git a/web/components/action-buttons/ActionButtonMenu/ActionButtonMenu.tsx b/web/components/action-buttons/ActionButtonMenu/ActionButtonMenu.tsx index cf9d00e30..d9e1d4e62 100644 --- a/web/components/action-buttons/ActionButtonMenu/ActionButtonMenu.tsx +++ b/web/components/action-buttons/ActionButtonMenu/ActionButtonMenu.tsx @@ -1,5 +1,5 @@ import { FC } from 'react'; -import { Button, Dropdown, Menu } from 'antd'; +import { Button, Dropdown } from 'antd'; import classNames from 'classnames'; import dynamic from 'next/dynamic'; import styles from './ActionButtonMenu.module.scss'; @@ -41,7 +41,7 @@ export const ActionButtonMenu: FC = ({ showNotifyItem, className, }) => { - const onMenuClick = a => { + const onClick = a => { if (a.key === NOTIFY_KEY) { notifyItemSelected(); return; @@ -87,13 +87,11 @@ export const ActionButtonMenu: FC = ({ }); } - const menu = ; - const dropdownClasses = classNames([styles.menu, className]); return ( = ({ }); }; - const onMenuClick: MenuProps['onClick'] = ({ key }) => { - if (key === 'hide-message') { - confirmHideMessage(); - } else if (key === 'ban-user') { - confirmBanUser(); - } else if (key === 'more-info') { - setShowUserDetailsModal(true); - } - }; - - const menu = ( - - - - - Hide Message - - ), - key: 'hide-message', - }, - { - label: ( -
- - - - Ban User -
- ), - key: 'ban-user', - }, - { - label:
More Info...
, - key: 'more-info', - }, - ]} - /> - ); + const items: MenuProps['items'] = [ + { + icon: , + label: 'Hide Message', + key: 'hide-message', + onClick: confirmHideMessage, + }, + { + icon: , + label: 'Ban User', + key: 'ban-user', + onClick: confirmBanUser, + }, + { + label: 'More Info...', + key: 'more-info', + onClick: () => setShowUserDetailsModal(true), + }, + ]; return ( <> - +
- ); + const offset: number = online && streamStart ? 0 : 1; + const items: MenuProps['items'] = times.slice(offset).map((time, index) => ({ + key: index + offset, + label: time.title, + onClick: onTimeWindowSelect, + })); return ( <> @@ -142,7 +132,7 @@ export default function ViewersOverTime() { )} - +