From 98bdd552cdada5a2f936a5893d030c014621887b Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Thu, 5 May 2022 13:51:14 -0400 Subject: [PATCH] add: `AvatarEditView` --- app/definitions/rest/v1/users.ts | 2 +- app/i18n/locales/en.json | 1 + app/lib/services/restApi.ts | 2 +- app/stacks/InsideStack.tsx | 2 + app/stacks/MasterDetailStack/index.tsx | 2 + app/stacks/MasterDetailStack/types.ts | 1 + app/stacks/types.ts | 1 + app/views/AvatarEditView/index.tsx | 53 +++++++ app/views/ProfileView/index.tsx | 130 ++++++++---------- .../ProfileView/interfaces.ts} | 14 +- app/views/ProfileView/styles.ts | 8 +- app/views/RoomInfoEditView/index.tsx | 2 +- 12 files changed, 130 insertions(+), 88 deletions(-) create mode 100644 app/views/AvatarEditView/index.tsx rename app/{definitions/IProfileViewInterfaces.ts => views/ProfileView/interfaces.ts} (75%) diff --git a/app/definitions/rest/v1/users.ts b/app/definitions/rest/v1/users.ts index 898799102..4f4d8703c 100644 --- a/app/definitions/rest/v1/users.ts +++ b/app/definitions/rest/v1/users.ts @@ -1,4 +1,4 @@ -import { IParams } from '../../IProfileViewInterfaces'; +import { IParams } from '../../../views/ProfileView/interfaces'; import type { ITeam } from '../../ITeam'; import type { IUser } from '../../IUser'; import { INotificationPreferences, IUserPreferences, IUserRegistered } from '../../IUser'; diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index a89c45e31..b4a74d5b2 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -114,6 +114,7 @@ "Auto_Translate": "Auto-Translate", "Avatar_changed_successfully": "Avatar changed successfully!", "Avatar_Url": "Avatar URL", + "Avatar_Url_Insert_Image": "Insert image URL here", "Away": "Away", "Back": "Back", "Black": "Black", diff --git a/app/lib/services/restApi.ts b/app/lib/services/restApi.ts index 44e361589..e74edfb1f 100644 --- a/app/lib/services/restApi.ts +++ b/app/lib/services/restApi.ts @@ -7,7 +7,7 @@ import { SubscriptionType, IUser } from '../../definitions'; -import { IAvatarSuggestion, IParams } from '../../definitions/IProfileViewInterfaces'; +import { IAvatarSuggestion, IParams } from '../../views/ProfileView/interfaces'; import { ISpotlight } from '../../definitions/ISpotlight'; import { TEAM_TYPE } from '../../definitions/ITeam'; import { Encryption } from '../encryption'; diff --git a/app/stacks/InsideStack.tsx b/app/stacks/InsideStack.tsx index aef07c76f..1d37b5a47 100644 --- a/app/stacks/InsideStack.tsx +++ b/app/stacks/InsideStack.tsx @@ -33,6 +33,7 @@ import CannedResponseDetail from '../views/CannedResponseDetail'; import { themes } from '../lib/constants'; // Profile Stack import ProfileView from '../views/ProfileView'; +import AvatarEditView from '../views/AvatarEditView'; import UserPreferencesView from '../views/UserPreferencesView'; import UserNotificationPrefView from '../views/UserNotificationPreferencesView'; // Display Preferences View @@ -148,6 +149,7 @@ const ProfileStackNavigator = () => { + { component={ProfileView} options={props => ProfileView.navigationOptions!({ ...props, isMasterDetail: true })} /> + ): React.ReactElement => { + const [avatarUrl, setAvatarUrl] = useState(''); + const [saving] = useState(false); + + // const username = useSelector((state: IApplicationState) => getUserSelector(state).username); + // const url = useSelector((state: IApplicationState) => getUserSelector(state).username); + + const { theme } = useTheme(); + + useLayoutEffect(() => { + navigation.setOptions({ + title: 'Avatar' + }); + }, []); + return ( + + {/* */} + setAvatarUrl(value)} + // onSubmitEditing={this.submit} + testID='profile-view-avatar-url' + theme={theme} + /> +