From bb1d8b7e20724828a735560f27c93b88ee94ceb9 Mon Sep 17 00:00:00 2001 From: Kacper Michalik Date: Thu, 19 Oct 2023 12:05:22 +0200 Subject: [PATCH] feat:use context menu for information about unregistered username instead screen --- CHANGELOG.md | 2 + packages/mobile/src/App.tsx | 5 +- .../ContextMenu/ContextMenu.component.tsx | 61 +++-- .../ContextMenu/ContextMenu.types.ts | 6 + ...egisteredUsernameContextMenu.container.tsx | 20 ++ .../UnregisteredUsername.component.tsx | 31 --- .../UnregisteredUsername.test.tsx | 234 ------------------ packages/mobile/src/const/MenuNames.enum.ts | 1 + packages/mobile/src/const/ScreenNames.enum.ts | 1 - packages/mobile/src/route.params.ts | 6 +- .../src/screens/Channel/Channel.screen.tsx | 14 +- .../UnregisteredUsername.screen.tsx | 22 -- .../UnregisteredUsername.types.ts | 10 - .../src/store/navigation/navigation.slice.ts | 1 + 14 files changed, 81 insertions(+), 333 deletions(-) create mode 100644 packages/mobile/src/components/ContextMenu/menus/UnregisteredUsernameContextMenu.container.tsx delete mode 100644 packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.component.tsx delete mode 100644 packages/mobile/src/components/UserLabel/Unregistered/UnregisteredUsername.test.tsx delete mode 100644 packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.screen.tsx delete mode 100644 packages/mobile/src/screens/UnregisteredUsername/UnregisteredUsername.types.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fe34a70e5..11be2c541d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ * Fixed mobile bugs - joining by QR code and not showing username taken screen for user who has unique name +* Use context menu for information about unregistered username instead screen + * Shorter dots-placeholder for invite link * Removed registration attempts selector and corresponding usage. diff --git a/packages/mobile/src/App.tsx b/packages/mobile/src/App.tsx index 49b1e7019d..3b777d1164 100644 --- a/packages/mobile/src/App.tsx +++ b/packages/mobile/src/App.tsx @@ -45,10 +45,11 @@ import StoreProvider from './Provider' import { RootStackParamList } from './route.params' import ConnectionProcessScreen from './screens/ConnectionProcess/ConnectionProcess.screen' import { DuplicatedUsernameScreen } from './screens/DuplicatedUsername/DuplicatedUsername.screen' -import { UnregisteredUsernameScreen } from './screens/UnregisteredUsername/UnregisteredUsername.screen' + import UsernameTakenScreen from './screens/UsernameTaken/UsernameTaken.screen' import NewUsernameRequestedScreen from './screens/NewUsernameRequested/NewUsernameRequested.screen' import { PossibleImpersonationAttackScreen } from './screens/PossibleImpersonationAttack/PossibleImpersonationAttack.screen' +import { UnregisteredUsernameContextMenu } from './components/ContextMenu/menus/UnregisteredUsernameContextMenu.container' LogBox.ignoreAllLogs() @@ -105,7 +106,6 @@ function App(): JSX.Element { - + diff --git a/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx b/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx index a62feec289..f90abdfc10 100644 --- a/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx +++ b/packages/mobile/src/components/ContextMenu/ContextMenu.component.tsx @@ -2,9 +2,9 @@ import React, { FC } from 'react' import { View, Image, FlatList, TouchableWithoutFeedback, TouchableOpacity, Animated } from 'react-native' import { Typography } from '../Typography/Typography.component' import { ContextMenuItemProps, ContextMenuProps } from './ContextMenu.types' - import { defaultPalette } from '../../styles/palettes/default.palette' import { appImages } from '../../assets' +import { Button } from '../Button/Button.component' export const ContextMenu: FC = ({ visible, @@ -16,6 +16,8 @@ export const ContextMenu: FC = ({ linkAction = () => { console.log('No action attached for link tap gesture.') }, + unregisteredUsername, + username, }) => { const [show, setShow] = React.useState(false) const slidingAnimation = React.useRef(new Animated.Value(0)).current @@ -140,24 +142,45 @@ export const ContextMenu: FC = ({ )} - - item.title} - renderItem={({ item, index }) => ( - - - - )} - style={{ backgroundColor: defaultPalette.background.white }} - showsVerticalScrollIndicator={false} - /> - + + {items.length !== 0 && ( + + item.title} + renderItem={({ item, index }) => ( + + + + )} + style={{ backgroundColor: defaultPalette.background.white }} + showsVerticalScrollIndicator={false} + /> + + )} + + {unregisteredUsername && username && ( + + + The username{' '} + + @{username} + {' '} + has not been registered yet with the community owner, so it’s still possible for someone else to + register the same username. When the community owner is online,{' '} + + @{username} + {' '} + will be registered automatically and this alert will go away. + +