From 80c358838f15c24f0335a93e074760a44f42ece0 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Fri, 6 Jan 2023 17:51:16 -0300 Subject: [PATCH] refactor avatar component --- .../Avatar/{index.tsx => AvatarContainer.tsx} | 64 +++++++------------ app/containers/Avatar/AvatarWithEdit.tsx | 62 ++++++++++++++++++ app/containers/Avatar/index.ts | 5 ++ app/views/ProfileView/index.tsx | 4 +- app/views/RoomInfoEditView/index.tsx | 4 +- app/views/RoomInfoView/index.tsx | 30 ++++----- 6 files changed, 108 insertions(+), 61 deletions(-) rename app/containers/Avatar/{index.tsx => AvatarContainer.tsx} (61%) create mode 100644 app/containers/Avatar/AvatarWithEdit.tsx create mode 100644 app/containers/Avatar/index.ts diff --git a/app/containers/Avatar/index.tsx b/app/containers/Avatar/AvatarContainer.tsx similarity index 61% rename from app/containers/Avatar/index.tsx rename to app/containers/Avatar/AvatarContainer.tsx index ae3537865..9be1a394a 100644 --- a/app/containers/Avatar/index.tsx +++ b/app/containers/Avatar/AvatarContainer.tsx @@ -1,14 +1,10 @@ import React from 'react'; import { shallowEqual, useSelector } from 'react-redux'; -import Button from '../Button'; import { IApplicationState } from '../../definitions'; 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'; import { useAvatarETag } from './useAvatarETag'; interface IAvatarContainer extends IAvatar { @@ -27,11 +23,8 @@ const AvatarContainer = ({ onPress, getCustomEmoji, isStatic, - rid, - handleEdit + rid }: IAvatarContainer): React.ReactElement => { - const { colors } = useTheme(); - const server = useSelector((state: IApplicationState) => state.share.server.server || state.server.server); const serverVersion = useSelector((state: IApplicationState) => state.share.server.version || state.server.version); const { id, token, username } = useSelector( @@ -56,40 +49,27 @@ const AvatarContainer = ({ const { avatarETag } = useAvatarETag({ username, text, type, rid }); return ( - <> - - {handleEdit ? ( -