From 49f2c28b3e3a9b44f4905a9e79a7e259dccb7812 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Wed, 7 Dec 2022 00:11:25 -0300 Subject: [PATCH] [NEW] Change Avatar View --- app/containers/Avatar/index.tsx | 64 +++++++++++++-------- app/containers/Avatar/styles.ts | 9 +++ app/i18n/locales/en.json | 4 +- app/stacks/InsideStack.tsx | 3 + app/stacks/types.ts | 8 +++ app/views/ChangeAvatarView/AvatarUrl.tsx | 21 +++++++ app/views/ChangeAvatarView/index.tsx | 72 ++++++++++++++++++++++++ app/views/ChangeAvatarView/styles.ts | 15 +++++ app/views/ProfileView/index.tsx | 13 ++++- app/views/ProfileView/styles.ts | 2 +- 10 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 app/containers/Avatar/styles.ts create mode 100644 app/views/ChangeAvatarView/AvatarUrl.tsx create mode 100644 app/views/ChangeAvatarView/index.tsx create mode 100644 app/views/ChangeAvatarView/styles.ts diff --git a/app/containers/Avatar/index.tsx b/app/containers/Avatar/index.tsx index 9f762308d..f924e5435 100644 --- a/app/containers/Avatar/index.tsx +++ b/app/containers/Avatar/index.tsx @@ -3,11 +3,15 @@ import React, { useEffect, useRef, useState } from 'react'; import { shallowEqual, useSelector } from 'react-redux'; import { Observable, Subscription } from 'rxjs'; +import Button from '../Button'; import { IApplicationState, TSubscriptionModel, TUserModel } from '../../definitions'; import database from '../../lib/database'; import { getUserSelector } from '../../selectors/login'; import Avatar from './Avatar'; import { IAvatar } from './interfaces'; +import I18n from '../../i18n'; +import { useTheme } from '../../theme'; +import styles from './styles'; const AvatarContainer = ({ style, @@ -21,10 +25,12 @@ const AvatarContainer = ({ onPress, getCustomEmoji, isStatic, - rid -}: IAvatar): React.ReactElement => { + rid, + handleEdit +}: IAvatar & { handleEdit?: () => void }): React.ReactElement => { const subscription = useRef(); const [avatarETag, setAvatarETag] = useState(''); + const { colors } = useTheme(); const isDirect = () => type === 'd'; @@ -85,27 +91,39 @@ const AvatarContainer = ({ }, [text, type, size, avatarETag, externalProviderUrl]); return ( - + <> + + {handleEdit ? ( +