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

W8/ideal nav fixes #35

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ROUTES = {
route: 'bank-account/:stepToOpen?',
getRoute: (stepToOpen = '', policyID = '', backTo?: string) => getUrlWithBackToParam(`bank-account/${stepToOpen}?policyID=${policyID}`, backTo),
},
WORKSPACE_SWITCHER: 'workspaceSwitcher',
WORKSPACE_SWITCHER: 'workspace-switcher',
SETTINGS: 'settings',
SETTINGS_PROFILE: 'settings/profile',
SETTINGS_SHARE_CODE: 'settings/shareCode',
Expand Down
2 changes: 1 addition & 1 deletion src/components/MultipleAvatars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function MultipleAvatars({
<Avatar
source={icons[0].source}
size={size}
fill={icons[0].displayInDefaultIconColor ? undefined : icons[0].fill ?? theme.iconSuccessFill}
fill={icons[0].fill}
name={icons[0].name}
type={icons[0].type}
fallbackIcon={icons[0].fallbackIcon}
Expand Down
5 changes: 4 additions & 1 deletion src/components/SubscriptAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type SubAvatar = {

/** A fallback avatar icon to display when there is an error on loading avatar from remote URL. */
fallbackIcon?: AvatarSource;

/** The fill color for the icon. Can be hex, rgb, rgba, or valid react-native named color such as 'red' or 'blue'. */
fill?: string;
};

type SubscriptAvatarProps = {
Expand Down Expand Up @@ -108,7 +111,7 @@ function SubscriptAvatar({mainAvatar = {}, secondaryAvatar, subscriptIcon, size
]}
source={secondaryAvatar.source}
size={isSmall ? CONST.AVATAR_SIZE.SMALL_SUBSCRIPT : CONST.AVATAR_SIZE.SUBSCRIPT}
fill={theme.iconSuccessFill}
fill={secondaryAvatar.fill}
name={secondaryAvatar.name}
type={secondaryAvatar.type}
fallbackIcon={secondaryAvatar.fallbackIcon}
Expand Down
6 changes: 4 additions & 2 deletions src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type {NavigationState, PartialState} from '@react-navigation/native';
import {getStateFromPath} from '@react-navigation/native';
import {isAnonymousUser} from '@libs/actions/Session';
import getIsSmallScreenWidth from '@libs/getIsSmallScreenWidth';
import getTopmostNestedRHPRoute from '@libs/Navigation/getTopmostNestedRHPRoute';
import type {BottomTabName, CentralPaneName, FullScreenName, NavigationPartialRoute, RootStackParamList} from '@libs/Navigation/types';
Expand Down Expand Up @@ -226,14 +227,15 @@ function getAdaptedState(state: PartialState<NavigationState<RootStackParamList>

const getAdaptedStateFromPath: typeof getStateFromPath = (path, options) => {
const url = getPathWithoutPolicyID(path);
const policyID = extractPolicyIDFromPath(path);
const isAnonymous = isAnonymousUser();
// Anonymous users don't have access to workspaces
const policyID = isAnonymous ? undefined : extractPolicyIDFromPath(path);

const state = getStateFromPath(url, options);

if (state === undefined) {
throw new Error('Unable to parse path');
}

const adaptedState = getAdaptedState(state as PartialState<NavigationState<RootStackParamList>>, policyID);
return adaptedState;
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TeachersUnite/SaveTheWorldPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function SaveTheWorldPage() {
shouldShowBackButton
title={translate('sidebarScreen.saveTheWorld')}
backgroundColor={theme.PAGE_THEMES[SCREENS.SAVE_THE_WORLD.ROOT].backgroundColor}
onBackButtonPress={() => Navigation.goBack(ROUTES.HOME)}
onBackButtonPress={Navigation.goBack}
illustration={LottieAnimations.SaveTheWorld}
>
<View style={[styles.mb4, styles.justifyContentBetween, styles.mh5]}>
Expand Down
1 change: 0 additions & 1 deletion src/pages/WorkspaceSwitcherPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ function WorkspaceSwitcherPage({policies}) {
source: Expensicons.ExpensifyAppIcon,
name: CONST.WORKSPACE_SWITCHER.NAME,
type: CONST.ICON_TYPE_AVATAR,
displayInDefaultIconColor: true,
},
],
brickRoadIndicator: getIndicatorTypeForPolicy(undefined),
Expand Down
9 changes: 9 additions & 0 deletions src/pages/home/sidebar/SidebarLinksData.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ const propTypes = {

// eslint-disable-next-line react/forbid-prop-types
policyMembers: PropTypes.object,

/** Session info for the currently logged in user. */
session: PropTypes.shape({
/** Currently logged in user accountID */
accountID: PropTypes.number,
}),
};

const defaultProps = {
Expand All @@ -72,6 +78,9 @@ const defaultProps = {
betas: [],
policies: {},
policyMembers: {},
session: {
accountID: '',
},
};

function SidebarLinksData({
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/OnyxCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ type Icon = {

/** Fill color of the icon */
fill?: string;

/** Icon should be displayed in its own color */
displayInDefaultIconColor?: boolean;
};

export type {Icon, PendingAction, PendingFields, ErrorFields, Errors, AvatarType};
Loading