diff --git a/native/profile/keyserver-selection-bottom-sheet.react.js b/native/profile/keyserver-selection-bottom-sheet.react.js index 639ad4627..9d8c3c2a9 100644 --- a/native/profile/keyserver-selection-bottom-sheet.react.js +++ b/native/profile/keyserver-selection-bottom-sheet.react.js @@ -1,130 +1,167 @@ // @flow import * as React from 'react'; import { View, Text } from 'react-native'; import type { KeyserverInfo } from 'lib/types/keyserver-types.js'; import BottomSheet from '../bottom-sheet/bottom-sheet.react.js'; import Button from '../components/button.react.js'; import CommIcon from '../components/comm-icon.react.js'; import Pill from '../components/pill.react.js'; import StatusIndicator from '../components/status-indicator.react.js'; import type { RootNavigationProp } from '../navigation/root-navigator.react.js'; import type { NavigationRoute } from '../navigation/route-names.js'; import { useColors, useStyles } from '../themes/colors.js'; export type KeyserverSelectionBottomSheetParams = { +keyserverAdminUsername: string, +keyserverInfo: KeyserverInfo, }; type Props = { +navigation: RootNavigationProp<'KeyserverSelectionBottomSheet'>, +route: NavigationRoute<'KeyserverSelectionBottomSheet'>, }; function KeyserverSelectionBottomSheet(props: Props): React.Node { const { navigation, route: { params: { keyserverAdminUsername, keyserverInfo }, }, } = props; const { goBack } = navigation; const bottomSheetRef = React.useRef(); const colors = useColors(); const styles = useStyles(unboundStyles); const cloudIcon = React.useMemo( () => ( ), [colors.panelForegroundLabel], ); const onPressRemoveKeyserver = React.useCallback(() => { // TODO }, []); + const removeKeyserver = React.useMemo(() => { + if (keyserverInfo.connection.status !== 'connected') { + return ( + <> + + You may delete offline keyservers 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. + + + + ); + } + return ( + <> + + Disconnecting from this keyserver will remove you from its associated + communities. + + + Any messages or content you have previously sent will remain on the + keyserver. + + + + ); + }, [ + keyserverInfo.connection.status, + onPressRemoveKeyserver, + styles.keyserverRemoveText, + styles.removeButtonContainer, + styles.removeButtonText, + ]); + return ( {keyserverInfo.urlPrefix} - - Disconnecting from this keyserver will remove you from its associated - communities. - - - Any messages or content you have previously sent will remain on the - keyserver. - - + {removeKeyserver} ); } const unboundStyles = { container: { paddingHorizontal: 16, }, keyserverDetailsContainer: { alignItems: 'center', justifyContent: 'space-between', paddingVertical: 16, backgroundColor: 'modalAccentBackground', marginBottom: 24, borderRadius: 8, }, keyserverHeaderContainer: { flexDirection: 'row', alignItems: 'center', }, statusIndicatorContainer: { marginLeft: 8, }, keyserverURLText: { color: 'modalForegroundLabel', marginTop: 8, }, keyserverRemoveText: { color: 'modalForegroundLabel', marginBottom: 24, }, removeButtonContainer: { backgroundColor: 'vibrantRedButton', paddingVertical: 12, borderRadius: 8, alignItems: 'center', }, removeButtonText: { color: 'floatingButtonLabel', }, }; export default KeyserverSelectionBottomSheet;