Browse Source

Antd updates (#2194)

* Fix antd Modal.visible warning by using updated attribute name 'open'.

* Update more attributes (onVisibleChange => onOpenChange, defaultVisible => defaultOpen) to fix browser console warnings.

* Update ModalProps property from 'visible' to 'open' to match the change in antd.

* Update variable names to match the antd change from 'visible' to 'open'.

* Inline this for the linter.

* One more visible => open reference.
pull/2192/head
Matthew Heller 3 years ago committed by GitHub
parent
commit
6e54ec7695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      web/components/action-buttons/ActionButton/ActionButton.tsx
  2. 2
      web/components/action-buttons/FollowButton.tsx
  3. 2
      web/components/chat/ChatModerationActionMenu/ChatModerationActionMenu.tsx
  4. 4
      web/components/chat/ChatTextField/ChatTextField.tsx
  5. 8
      web/components/common/UserDropdown/UserDropdown.tsx
  6. 4
      web/components/ui/Content/Content.tsx
  7. 6
      web/components/ui/Modal/Modal.tsx
  8. 16
      web/components/ui/NotifyReminderPopup/NotifyReminderPopup.tsx

2
web/components/action-buttons/ActionButton/ActionButton.tsx

@ -37,7 +37,7 @@ export const ActionButton: FC<ActionButtonProps> = ({
<Modal <Modal
title={description || title} title={description || title}
url={url} url={url}
visible={showModal} open={showModal}
height="80vh" height="80vh"
handleCancel={() => setShowModal(false)} handleCancel={() => setShowModal(false)}
/> />

2
web/components/action-buttons/FollowButton.tsx

@ -29,7 +29,7 @@ export const FollowButton: FC<FollowButtonProps> = props => {
</Button> </Button>
<Modal <Modal
title={`Follow ${name}`} title={`Follow ${name}`}
visible={showModal} open={showModal}
handleCancel={() => setShowModal(false)} handleCancel={() => setShowModal(false)}
width="550px" width="550px"
height="200px" height="200px"

2
web/components/chat/ChatModerationActionMenu/ChatModerationActionMenu.tsx

@ -121,7 +121,7 @@ export const ChatModerationActionMenu: FC<ChatModerationActionMenuProps> = ({
</Dropdown> </Dropdown>
<Modal <Modal
title={userDisplayName} title={userDisplayName}
visible={showUserDetailsModal} open={showUserDetailsModal}
handleCancel={() => { handleCancel={() => {
setShowUserDetailsModal(false); setShowUserDetailsModal(false);
}} }}

4
web/components/chat/ChatTextField/ChatTextField.tsx

@ -265,8 +265,8 @@ export const ChatTextField: FC<ChatTextFieldProps> = ({ defaultText }) => {
/> />
} }
trigger="click" trigger="click"
onVisibleChange={visible => setShowEmojis(visible)} onOpenChange={open => setShowEmojis(open)}
visible={showEmojis} open={showEmojis}
/> />
</Slate> </Slate>

8
web/components/common/UserDropdown/UserDropdown.tsx

@ -92,16 +92,12 @@ export const UserDropdown: FC<UserDropdownProps> = ({ username: defaultUsername
</Dropdown> </Dropdown>
<Modal <Modal
title="Change Chat Display Name" title="Change Chat Display Name"
visible={showNameChangeModal} open={showNameChangeModal}
handleCancel={() => setShowNameChangeModal(false)} handleCancel={() => setShowNameChangeModal(false)}
> >
<NameChangeModal /> <NameChangeModal />
</Modal> </Modal>
<Modal <Modal title="Authenticate" open={showAuthModal} handleCancel={() => setShowAuthModal(false)}>
title="Authenticate"
visible={showAuthModal}
handleCancel={() => setShowAuthModal(false)}
>
<AuthModal /> <AuthModal />
</Modal> </Modal>
</div> </div>

4
web/components/ui/Content/Content.tsx

@ -238,7 +238,7 @@ export const Content: FC = () => {
{externalActionButtons} {externalActionButtons}
<FollowButton size="small" /> <FollowButton size="small" />
<NotifyReminderPopup <NotifyReminderPopup
visible={showNotifyReminder} open={showNotifyReminder}
notificationClicked={() => setShowNotifyPopup(true)} notificationClicked={() => setShowNotifyPopup(true)}
notificationClosed={() => disableNotifyReminderPopup()} notificationClosed={() => disableNotifyReminderPopup()}
> >
@ -248,7 +248,7 @@ export const Content: FC = () => {
<Modal <Modal
title="Notify" title="Notify"
visible={showNotifyPopup} open={showNotifyPopup}
afterClose={() => disableNotifyReminderPopup()} afterClose={() => disableNotifyReminderPopup()}
handleCancel={() => disableNotifyReminderPopup()} handleCancel={() => disableNotifyReminderPopup()}
> >

6
web/components/ui/Modal/Modal.tsx

@ -5,7 +5,7 @@ import styles from './Modal.module.scss';
export type ModalProps = { export type ModalProps = {
title: string; title: string;
url?: string; url?: string;
visible: boolean; open: boolean;
handleOk?: () => void; handleOk?: () => void;
handleCancel?: () => void; handleCancel?: () => void;
afterClose?: () => void; afterClose?: () => void;
@ -17,7 +17,7 @@ export type ModalProps = {
export const Modal: FC<ModalProps> = ({ export const Modal: FC<ModalProps> = ({
title, title,
url, url,
visible, open,
handleOk, handleOk,
handleCancel, handleCancel,
afterClose, afterClose,
@ -51,7 +51,7 @@ export const Modal: FC<ModalProps> = ({
return ( return (
<AntModal <AntModal
title={title} title={title}
visible={visible} open={open}
onOk={handleOk} onOk={handleOk}
onCancel={handleCancel} onCancel={handleCancel}
afterClose={afterClose} afterClose={afterClose}

16
web/components/ui/NotifyReminderPopup/NotifyReminderPopup.tsx

@ -4,7 +4,7 @@ import React, { useState, useEffect, FC } from 'react';
import styles from './NotifyReminderPopup.module.scss'; import styles from './NotifyReminderPopup.module.scss';
export type NotifyReminderPopupProps = { export type NotifyReminderPopupProps = {
visible: boolean; open: boolean;
children: React.ReactNode; children: React.ReactNode;
notificationClicked: () => void; notificationClicked: () => void;
notificationClosed: () => void; notificationClosed: () => void;
@ -12,16 +12,16 @@ export type NotifyReminderPopupProps = {
export const NotifyReminderPopup: FC<NotifyReminderPopupProps> = ({ export const NotifyReminderPopup: FC<NotifyReminderPopupProps> = ({
children, children,
visible, open,
notificationClicked, notificationClicked,
notificationClosed, notificationClosed,
}) => { }) => {
const [visiblePopup, setVisiblePopup] = useState(visible); const [openPopup, setOpenPopup] = useState(open);
const [mounted, setMounted] = useState(false); const [mounted, setMounted] = useState(false);
useEffect(() => { useEffect(() => {
setVisiblePopup(visible); setOpenPopup(open);
}, [visible]); }, [open]);
useEffect(() => { useEffect(() => {
setMounted(true); setMounted(true);
@ -43,7 +43,7 @@ export const NotifyReminderPopup: FC<NotifyReminderPopupProps> = ({
const popupClosed = e => { const popupClosed = e => {
e.stopPropagation(); e.stopPropagation();
setVisiblePopup(false); setOpenPopup(false);
notificationClosed(); notificationClosed();
}; };
@ -64,8 +64,8 @@ export const NotifyReminderPopup: FC<NotifyReminderPopupProps> = ({
mounted && ( mounted && (
<Popover <Popover
placement="topLeft" placement="topLeft"
defaultVisible={visiblePopup} defaultOpen={openPopup}
visible={visiblePopup} open={openPopup}
destroyTooltipOnHide destroyTooltipOnHide
title={title} title={title}
content={content} content={content}

Loading…
Cancel
Save