Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Jan 18, 2024
1 parent fe330e8 commit 7c80568
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/components/ActiveWorkspace/ActiveWorkspaceContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {createContext} from 'react';
type ActiveWorkspaceContextType = {
activeWorkspaceID?: string;
setActiveWorkspaceID: (activeWorkspaceID?: string) => void;
}
};

const ActiveWorkspaceContext = createContext<ActiveWorkspaceContextType>({activeWorkspaceID: undefined, setActiveWorkspaceID: () => undefined});

export default ActiveWorkspaceContext;
export {type ActiveWorkspaceContextType};
export {type ActiveWorkspaceContextType};
7 changes: 4 additions & 3 deletions src/components/ActiveWorkspace/ActiveWorkspaceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ function ActiveWorkspaceContextProvider({children}: React.PropsWithChildren) {
() => ({
activeWorkspaceID,
setActiveWorkspaceID,
}), [activeWorkspaceID]
)
}),
[activeWorkspaceID],
);

return <ActiveWorkspaceContext.Provider value={value}>{children}</ActiveWorkspaceContext.Provider>;
}

export default ActiveWorkspaceContextProvider;
export default ActiveWorkspaceContextProvider;
2 changes: 1 addition & 1 deletion src/components/OptionsSelector/optionsSelectorPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const propTypes = {
nestedScrollEnabled: PropTypes.bool,

/** Left icon to display in TextInput */
textIconLeft: PropTypes.elementType,
textIconLeft: PropTypes.elementType,
};

const defaultProps = {
Expand Down
17 changes: 7 additions & 10 deletions src/components/WorkspaceSwitcherButton.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useMemo } from 'react';
import React, {useMemo} from 'react';
import useActiveWorkspace from '@hooks/useActiveWorkspace';
import useLocalize from '@hooks/useLocalize';
import CONST from '@src/CONST';
import Navigation from '@libs/Navigation/Navigation';
import {getDefaultWorkspaceAvatar, getPolicy} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import useActiveWorkspace from '@hooks/useActiveWorkspace';
import {getPolicy, getDefaultWorkspaceAvatar} from "@libs/ReportUtils"
import * as Expensicons from './Icon/Expensicons';
import {PressableWithFeedback} from './Pressable';
import SubscriptAvatar from './SubscriptAvatar';
Expand All @@ -13,11 +13,9 @@ function WorkspaceSwitcherButton() {
const {translate} = useLocalize();
const {activeWorkspaceID} = useActiveWorkspace();


const {source, name, type} = useMemo(() => {

if(!activeWorkspaceID) {
return {source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR}
if (!activeWorkspaceID) {
return {source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR};
}

const policy = getPolicy(activeWorkspaceID);
Expand All @@ -26,10 +24,9 @@ function WorkspaceSwitcherButton() {
source: avatar,
name: policy?.name,
type: CONST.ICON_TYPE_WORKSPACE,
}
};
}, [activeWorkspaceID]);


return (
<PressableWithFeedback
accessibilityRole={CONST.ROLE.BUTTON}
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useActiveWorkspace.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {useContext} from 'react';
import ActiveWorkspaceContext from '@components/ActiveWorkspace/ActiveWorkspaceContext';
import type { ActiveWorkspaceContextType } from '@components/ActiveWorkspace/ActiveWorkspaceContext';
import type {ActiveWorkspaceContextType} from '@components/ActiveWorkspace/ActiveWorkspaceContext';

function useActiveWorkspace(): ActiveWorkspaceContextType {
function useActiveWorkspace(): ActiveWorkspaceContextType {
return useContext(ActiveWorkspaceContext);
}

Expand Down
4 changes: 1 addition & 3 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ function getPolicyBrickRoadIndicatorStatus(policy: OnyxEntry<Policy>, policyMemb
*/
function shouldShowPolicy(policy: OnyxEntry<Policy>, isOffline: boolean): boolean {
return (
!!policy &&
policy?.isPolicyExpenseChatEnabled &&
(isOffline || policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.keys(policy.errors ?? {}).length > 0)
!!policy && policy?.isPolicyExpenseChatEnabled && (isOffline || policy?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || Object.keys(policy.errors ?? {}).length > 0)
);
}

Expand Down

0 comments on commit 7c80568

Please sign in to comment.