Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspaces list #11784

Merged
merged 55 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
06b816f
Adding workspaces to languages
chiragsalian Oct 12, 2022
65ffc10
a new route and menu item
chiragsalian Oct 12, 2022
77167cf
a new modal screen
chiragsalian Oct 12, 2022
657b6e6
updating modal stack navigator with new workspacesPage
chiragsalian Oct 12, 2022
7e2d1f5
New workspaces page
chiragsalian Oct 12, 2022
1c3078e
correcting the back button
chiragsalian Oct 12, 2022
f245ef2
Path rename so all workspace files are in the same place
chiragsalian Oct 12, 2022
08e8c9a
removing unused code and trying some stuff
chiragsalian Oct 12, 2022
163988e
adding avatars to the end of workspace
chiragsalian Oct 13, 2022
dce19a0
support for fallbackIcons. unsure why avatar component is not used in…
chiragsalian Oct 13, 2022
bd79e90
passing policy avatars
chiragsalian Oct 13, 2022
36315ce
Removing new workspace button from 3 dots and adding it as footer
chiragsalian Oct 13, 2022
f473b46
defining AVATAR_SIZE SMALLER
chiragsalian Oct 13, 2022
c9e1454
cleaning up MultipleAvatars component to work with both avatar and icon
chiragsalian Oct 13, 2022
58c59b8
shouldStackHorizontally param
chiragsalian Oct 14, 2022
bb47b9f
styles
chiragsalian Oct 14, 2022
bd10ede
displaying multiple avatars vertically
chiragsalian Oct 14, 2022
e2f65f8
using building icon instead of workspace
chiragsalian Oct 14, 2022
08aed4e
update to show both avatar and overlay
chiragsalian Oct 14, 2022
afd5b66
overlay opacity and style fixes
chiragsalian Oct 14, 2022
dc024c6
style cleanup
chiragsalian Oct 14, 2022
8ddb462
cleanup
chiragsalian Oct 14, 2022
de140aa
perfecting the styles
chiragsalian Oct 14, 2022
2a30e05
style corrections to make the avatars work when there are less than 4…
chiragsalian Oct 14, 2022
a13652d
Merge branch 'main' into chirag-workspaces-list
chiragsalian Oct 19, 2022
84eb382
adding a positioning style
chiragsalian Oct 19, 2022
89d5a96
correcting avatar styles
chiragsalian Oct 19, 2022
362518b
correct avatar styles with red brick road indicator
chiragsalian Oct 19, 2022
d828d75
adding blocking view for when workspaces are empty
chiragsalian Oct 19, 2022
b54f3de
workspaces language update
chiragsalian Oct 19, 2022
ba261a5
correcting a style
chiragsalian Oct 19, 2022
9fa8fd3
Merge branch 'main' into chirag-workspaces-list
chiragsalian Oct 19, 2022
d71b7bc
logic correction
chiragsalian Oct 19, 2022
ce16a35
cleanup
chiragsalian Oct 19, 2022
ee600aa
Merge branch 'main' into chirag-workspaces-list
chiragsalian Oct 20, 2022
18bfe1b
copy corrections
chiragsalian Oct 20, 2022
541663a
cleanup
chiragsalian Oct 20, 2022
ae0d150
added key to fix js console error
chiragsalian Oct 20, 2022
7e29244
updating avatar to match order
chiragsalian Oct 20, 2022
875e498
using span cause view breaks avatar arrangement
chiragsalian Oct 20, 2022
27f3699
bug fix
chiragsalian Oct 20, 2022
74deaf1
count correction
chiragsalian Oct 20, 2022
2b438b0
variable name correction
chiragsalian Oct 20, 2022
9747791
style overhaul to prevent js error and look good
chiragsalian Oct 20, 2022
d4e1879
fighting to get the styles right without js error
chiragsalian Oct 20, 2022
b8bdb8e
Merge branch 'main' into chirag-workspaces-list
chiragsalian Oct 21, 2022
4ba7415
correcting red brick road dot logic
chiragsalian Oct 24, 2022
3c6d5bc
Merge branch 'main' into chirag-workspaces-list
chiragsalian Oct 24, 2022
9d640dd
updating logic for pending deleted workspaces
chiragsalian Oct 24, 2022
964f9d7
Merge branch 'main' into chirag-workspaces-list
chiragsalian Oct 24, 2022
faa8210
logic correction
chiragsalian Oct 25, 2022
ff6e5de
adding shouldStackHorizontally prop
chiragsalian Oct 25, 2022
1423fd4
subscribing to beta and adding prop
chiragsalian Oct 25, 2022
a2a847f
lint fix
chiragsalian Oct 25, 2022
18a237d
making lint happy
chiragsalian Oct 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ const CONST = {
LARGE: 'large',
DEFAULT: 'default',
SMALL: 'small',
SMALLER: 'smaller',
SUBSCRIPT: 'subscript',
SMALL_SUBSCRIPT: 'small-subscript',
},
Expand Down
1 change: 1 addition & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
SETTINGS: 'settings',
SETTINGS_PROFILE: 'settings/profile',
SETTINGS_PREFERENCES: 'settings/preferences',
SETTINGS_WORKSPACES: 'settings/workspaces',
SETTINGS_SECURITY: 'settings/security',
SETTINGS_CLOSE: 'settings/security/closeAccount',
SETTINGS_PASSWORD: 'settings/security/password',
Expand Down
2 changes: 1 addition & 1 deletion src/components/BlockingViews/BlockingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const BlockingView = props => (
width={variables.iconSizeSuperLarge}
height={variables.iconSizeSuperLarge}
/>
<Text style={[styles.headerText, styles.textLarge, styles.mt5]}>{props.title}</Text>
<Text style={[styles.headerText, styles.textLarge, styles.mt5, styles.mb2]}>{props.title}</Text>
<Text style={[styles.w70, styles.textAlignCenter]}>{props.subtitle}</Text>
</View>
);
Expand Down
15 changes: 14 additions & 1 deletion src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import menuItemPropTypes from './menuItemPropTypes';
import SelectCircle from './SelectCircle';
import colors from '../styles/colors';
import variables from '../styles/variables';
import MultipleAvatars from './MultipleAvatars';

const propTypes = {
...menuItemPropTypes,
Expand Down Expand Up @@ -46,6 +47,8 @@ const defaultProps = {
interactive: true,
fallbackIcon: Expensicons.FallbackAvatar,
brickRoadIndicator: '',
floatRightAvatars: [],
shouldStackHorizontally: false,
chiragsalian marked this conversation as resolved.
Show resolved Hide resolved
};

const MenuItem = (props) => {
Expand Down Expand Up @@ -150,8 +153,18 @@ const MenuItem = (props) => {
</Text>
</View>
)}
{!_.isEmpty(props.floatRightAvatars) && (
<View style={[styles.justifyContentCenter, (props.brickRoadIndicator ? styles.mr4 : styles.mr3)]}>
<MultipleAvatars
icons={props.floatRightAvatars}
size={props.viewMode === CONST.OPTION_MODE.COMPACT ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT}
fallbackIcon={Expensicons.Workspace}
shouldStackHorizontally={props.shouldStackHorizontally}
/>
</View>
)}
{Boolean(props.brickRoadIndicator) && (
<View style={[styles.alignItemsCenter, styles.justifyContentCenter]}>
<View style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.l4]}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a small inconsistent padding issue caused by this change.

Issue: #18418
Issue Tittle: Workspaces icons and green dot has inconsistent padding

<Icon
src={Expensicons.DotIndicator}
fill={props.brickRoadIndicator === 'error' ? colors.red : colors.green}
Expand Down
97 changes: 66 additions & 31 deletions src/components/MultipleAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,21 @@ const propTypes = {

/** Tooltip for the Avatar */
avatarTooltips: PropTypes.arrayOf(PropTypes.string),

/** A fallback avatar icon to display when there is an error on loading avatar from remote URL. */
fallbackIcon: PropTypes.func,

/** Prop to identify if we should load avatars vertically instead of diagonally */
shouldStackHorizontally: PropTypes.bool,
};

const defaultProps = {
icons: [],
size: CONST.AVATAR_SIZE.DEFAULT,
secondAvatarStyle: [StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)],
avatarTooltips: [],
fallbackIcon: undefined,
shouldStackHorizontally: false,
};

const MultipleAvatars = (props) => {
Expand All @@ -39,12 +47,13 @@ const MultipleAvatars = (props) => {
props.size === CONST.AVATAR_SIZE.SMALL ? styles.secondAvatarSmall : styles.secondAvatar,
...props.secondAvatarStyle,
];
const horizontalStyles = [styles.horizontalStackedAvatar4, styles.horizontalStackedAvatar3, styles.horizontalStackedAvatar2, styles.horizontalStackedAvatar1];

if (!props.icons.length) {
return null;
}

if (props.icons.length === 1) {
if (props.icons.length === 1 && !props.shouldStackHorizontally) {
return (
<View style={avatarContainerStyles}>
<Tooltip text={props.avatarTooltips[0]}>
Expand All @@ -60,41 +69,67 @@ const MultipleAvatars = (props) => {

return (
<View style={avatarContainerStyles}>
<View
style={singleAvatarStyles}
>
<Tooltip text={props.avatarTooltips[0]} absolute>
<Image
source={{uri: props.icons[0]}}
style={singleAvatarStyles}
/>
</Tooltip>
<View
style={secondAvatarStyles}
>
{props.icons.length === 2 ? (
<Tooltip text={props.avatarTooltips[1]} absolute>
<Image
source={{uri: props.icons[1]}}
style={singleAvatarStyles}
/>
</Tooltip>
) : (
<Tooltip text={props.avatarTooltips.slice(1).join(', ')} absolute>
{props.shouldStackHorizontally ? (
<>
{
_.map([...props.icons].splice(0, 4).reverse(), (icon, index) => (
<View
style={[singleAvatarStyles, styles.alignItemsCenter, styles.justifyContentCenter]}
key={`stackedAvatars-${index}`}
style={[styles.horizontalStackedAvatar, styles.alignItemsCenter, horizontalStyles[index]]}
>
<Text style={props.size === CONST.AVATAR_SIZE.SMALL
? styles.avatarInnerTextSmall
: styles.avatarInnerText}
>
{`+${props.icons.length - 1}`}
</Text>
<Avatar
source={icon || props.fallbackIcon}
fill={themeColors.iconSuccessFill}
size={CONST.AVATAR_SIZE.SMALLER}
/>
</View>
</Tooltip>
))
}
{props.icons.length > 4 && (
<View style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.horizontalStackedAvatar4Overlay]}>
<Text style={styles.avatarInnerTextSmall}>
{`+${props.icons.length - 4}`}
</Text>
</View>
)}
</>
) : (
<View
style={singleAvatarStyles}
>
<Tooltip text={props.avatarTooltips[0]} absolute>
<Image
source={{uri: props.icons[0]}}
style={singleAvatarStyles}
/>
</Tooltip>
<View
style={secondAvatarStyles}
>
{props.icons.length === 2 ? (
<Tooltip text={props.avatarTooltips[1]} absolute>
<Image
source={{uri: props.icons[1]}}
style={singleAvatarStyles}
/>
</Tooltip>
) : (
<Tooltip text={props.avatarTooltips.slice(1).join(', ')} absolute>
<View
style={[singleAvatarStyles, styles.alignItemsCenter, styles.justifyContentCenter]}
>
<Text style={props.size === CONST.AVATAR_SIZE.SMALL
? styles.avatarInnerTextSmall
: styles.avatarInnerText}
>
{`+${props.icons.length - 1}`}
</Text>
</View>
</Tooltip>
)}
</View>
</View>
</View>
)}
</View>
);
};
Expand Down
6 changes: 6 additions & 0 deletions src/components/menuItemPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,14 @@ const propTypes = {
/** A fallback avatar icon to display when there is an error on loading avatar from remote URL. */
fallbackIcon: PropTypes.func,

/** Avatars to show on the right of the menu item */
floatRightAvatars: PropTypes.arrayOf(PropTypes.string),

/** The type of brick road indicator to show. */
brickRoadIndicator: PropTypes.oneOf([CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, CONST.BRICK_ROAD_INDICATOR_STATUS.INFO, '']),

/** Prop to identify if we should load avatars vertically instead of diagonally */
shouldStackHorizontally: PropTypes.bool,
};

export default propTypes;
5 changes: 5 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
save: 'Save',
saveChanges: 'Save changes',
password: 'Password',
workspaces: 'Workspaces',
profile: 'Profile',
payments: 'Payments',
preferences: 'Preferences',
Expand Down Expand Up @@ -814,6 +815,10 @@ export default {
growlMessageOnDeleteError: 'This workspace cannot be deleted right now because reports are actively being processed',
unavailable: 'Unavailable workspace',
},
emptyWorkspace: {
title: 'Create a new workspace',
subtitle: 'Workspaces are where you\'ll chat with your team, reimburse expenses, issue cards, send invoices, pay bills, and more — all in one place.',
},
new: {
newWorkspace: 'New workspace',
getTheExpensifyCardAndMore: 'Get the Expensify Card and more',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
save: 'Guardar',
saveChanges: 'Guardar cambios',
password: 'Contraseña',
workspaces: 'Espacios de trabajo',
profile: 'Perfil',
payments: 'Pagos',
preferences: 'Preferencias',
Expand Down Expand Up @@ -816,6 +817,10 @@ export default {
growlMessageOnDeleteError: 'No se puede eliminar el espacio de trabajo porque tiene informes que están siendo procesados',
unavailable: 'Espacio de trabajo no disponible',
},
emptyWorkspace: {
title: 'Crear un nuevo espacio de trabajo',
subtitle: 'En los espacios de trabajo es donde puedes chatear con tu equipo, reembolsar gastos, emitir tarjetas, enviar y pagar facturas y mas — todo en un mismo lugar',
},
new: {
newWorkspace: 'Nuevo espacio de trabajo',
getTheExpensifyCardAndMore: 'Consigue la Tarjeta Expensify y más',
Expand Down
7 changes: 7 additions & 0 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ const SettingsModalStackNavigator = createModalStackNavigator([
},
name: 'Settings_Root',
},
{
getComponent: () => {
const SettingsWorkspacesPage = require('../../../pages/workspace/WorkspacesListPage').default;
return SettingsWorkspacesPage;
},
name: 'Settings_Workspaces',
},
{
getComponent: () => {
const SettingsProfilePage = require('../../../pages/settings/Profile/ProfilePage').default;
Expand Down
4 changes: 4 additions & 0 deletions src/libs/Navigation/linkingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default {
Settings_Root: {
path: ROUTES.SETTINGS,
},
Settings_Workspaces: {
path: ROUTES.SETTINGS_WORKSPACES,
exact: true,
},
Settings_Preferences: {
path: ROUTES.SETTINGS_PREFERENCES,
exact: true,
Expand Down
Loading