diff --git a/web/modals/keyserver-selection/keyserver-selection-modal.react.js b/web/modals/keyserver-selection/keyserver-selection-modal.react.js index a627e6774..5b4dcb7bc 100644 --- a/web/modals/keyserver-selection/keyserver-selection-modal.react.js +++ b/web/modals/keyserver-selection/keyserver-selection-modal.react.js @@ -1,62 +1,107 @@ // @flow import * as React from 'react'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import type { KeyserverInfo } from 'lib/types/keyserver-types.js'; import type { GlobalAccountUserInfo } from 'lib/types/user-types.js'; import css from './keyserver-selection-modal.css'; import Button, { buttonThemes } from '../../components/button.react.js'; import KeyserverPill from '../../components/keyserver-pill.react.js'; import StatusIndicator from '../../components/status-indicator.react.js'; import Modal from '../modal.react.js'; type Props = { +keyserverAdminUserInfo: GlobalAccountUserInfo, +keyserverInfo: KeyserverInfo, }; function KeyserverSelectionModal(props: Props): React.Node { const { keyserverAdminUserInfo, keyserverInfo } = props; const { popModal } = useModalContext(); + const { keyerverRemoveInfoText, keyserverRemoveButton } = + React.useMemo(() => { + if (keyserverInfo.connection.status !== 'connected') { + const removeInfoText = ( + <> +
+ You may delete an offline keyserver from your keyserver list. When + you delete a keyserver, you will still remain in the associated + communities. +
+
+ Any messages or content you have previously sent will remain on + the keyserver’s communities after disconnecting or deleting. +
+ + ); + + const removeButton = ( + + ); + + return { + keyerverRemoveInfoText: removeInfoText, + keyserverRemoveButton: removeButton, + }; + } + const removeInfoText = ( + <> +
+ Disconnecting from this keyserver will remove you from its + associated communities. +
+
+ Any messages or content you have previously sent will remain on the + keyserver. +
+ + ); + + const removeButton = ( + + ); + + return { + keyerverRemoveInfoText: removeInfoText, + keyserverRemoveButton: removeButton, + }; + }, [keyserverInfo.connection.status]); + return (
{keyserverInfo.urlPrefix}
-
- You may delete offline keyserver from your keyserver list. When you - delete a keyserver, you will still remain in the associated - communities. -
-
- Any messages or content you have previously sent will remain on the - keyserver’s communities after disconnecting or deleting. -
+ {keyerverRemoveInfoText}
-
- -
+
{keyserverRemoveButton}
); } export default KeyserverSelectionModal;