Skip to content

Commit

Permalink
Merge pull request #37285 from narefyev91/ui-changes-for-profile-page
Browse files Browse the repository at this point in the history
Profile page UI updates
  • Loading branch information
luacmartins authored Feb 28, 2024
2 parents fc828da + ffe9213 commit 59f8f3d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
Binary file added assets/images/workspace-profile-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/workspace-profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions src/pages/workspace/WorkspaceProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {ImageStyle, StyleProp} from 'react-native';
import {Image, ScrollView, StyleSheet, View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import WorkspaceProfileLight from '@assets/images/workspace-profile-light.png';
import WorkspaceProfile from '@assets/images/workspace-profile.png';
import Avatar from '@components/Avatar';
import AvatarWithImagePicker from '@components/AvatarWithImagePicker';
Expand All @@ -14,6 +15,7 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback';
import Section from '@components/Section';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useThemePreference from '@hooks/useThemePreference';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -42,6 +44,8 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
const styles = useThemeStyles();
const {translate} = useLocalize();
const {isSmallScreenWidth} = useWindowDimensions();
const themePreference = useThemePreference();
const isDarkTheme = themePreference === CONST.THEME.DARK;

const outputCurrency = policy?.outputCurrency ?? '';
const currencySymbol = currencyList?.[outputCurrency]?.symbol ?? '';
Expand All @@ -55,7 +59,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
const policyName = policy?.name ?? '';
const policyDescription = policy?.description ?? '';
const readOnly = !PolicyUtils.isPolicyAdmin(policy);
const imageStyle: StyleProp<ImageStyle> = isSmallScreenWidth ? [styles.mhv12, styles.mhn5] : [styles.mhv8, styles.mhn8];
const imageStyle: StyleProp<ImageStyle> = isSmallScreenWidth ? [styles.mhv12, styles.mhn5, styles.mbn5] : [styles.mhv8, styles.mhn8, styles.mbn5];

const DefaultAvatar = useCallback(
() => (
Expand Down Expand Up @@ -91,8 +95,8 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
title=""
>
<Image
style={StyleSheet.flatten([styles.br4, styles.wAuto, styles.h68, imageStyle])}
source={WorkspaceProfile}
style={StyleSheet.flatten([styles.wAuto, styles.h68, imageStyle])}
source={isDarkTheme ? WorkspaceProfile : WorkspaceProfileLight}
resizeMode="cover"
/>
<AvatarWithImagePicker
Expand All @@ -104,7 +108,12 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
DefaultAvatar={DefaultAvatar}
type={CONST.ICON_TYPE_WORKSPACE}
fallbackIcon={Expensicons.FallbackWorkspaceAvatar}
style={[styles.mb3, isSmallScreenWidth ? styles.mtn17 : styles.mtn20, styles.alignItemsStart, styles.sectionMenuItemTopDescription]}
style={[
isSmallScreenWidth ? styles.mb1 : styles.mb3,
isSmallScreenWidth ? styles.mtn17 : styles.mtn20,
styles.alignItemsStart,
styles.sectionMenuItemTopDescription,
]}
isUsingDefaultAvatar={!policy?.avatar ?? null}
onImageSelected={(file) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file as File)}
onImageRemoved={() => Policy.deleteWorkspaceAvatar(policy?.id ?? '')}
Expand Down
7 changes: 3 additions & 4 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3068,7 +3068,7 @@ const styles = (theme: ThemeColors) =>
smallEditIcon: {
alignItems: 'center',
backgroundColor: theme.buttonDefaultBG,
borderColor: theme.appBG,
borderColor: theme.cardBG,
borderRadius: 20,
borderWidth: 3,
color: theme.textReversed,
Expand Down Expand Up @@ -4630,9 +4630,8 @@ const styles = (theme: ThemeColors) =>
},

workspaceTitleStyle: {
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE_BOLD,
fontWeight: '500',
fontSize: variables.workspaceProfileName,
...headlineFont,
fontSize: variables.fontSizeXLarge,
},
} satisfies Styles);

Expand Down
4 changes: 4 additions & 0 deletions src/styles/utils/spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ export default {
marginBottom: -4,
},

mbn5: {
marginBottom: -20,
},

p0: {
padding: 0,
paddingHorizontal: 0,
Expand Down
1 change: 0 additions & 1 deletion src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export default {
updateAnimationH: 240,
updateTextViewContainerWidth: 310,
updateViewHeaderHeight: 70,
workspaceProfileName: 20,

mushroomTopHatWidth: 138,
mushroomTopHatHeight: 128,
Expand Down

0 comments on commit 59f8f3d

Please sign in to comment.