Skip to content

Commit

Permalink
Comment unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuuszzzzz committed Dec 21, 2023
1 parent 01c740c commit 2b0cb18
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 40 deletions.
94 changes: 55 additions & 39 deletions src/pages/WorkspaceSwitcherPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import HeaderPageLayout from '@components/HeaderPageLayout';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
import OptionRow from '@components/OptionRow';
import OptionsSelector from '@components/OptionsSelector';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
import Text from '@components/Text';
import useAutoFocusInput from '@hooks/useAutoFocusInput';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import * as PolicyUtils from '@libs/PolicyUtils';
Expand All @@ -17,8 +22,6 @@ import Icon from '@src/components/Icon';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import SCREENS from '@src/SCREENS';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
import OptionRow from '@components/OptionRow';

const propTypes = {
/** The list of this user's policies */
Expand Down Expand Up @@ -65,18 +68,19 @@ function WorkspaceSwitcherPage({policies, activeWorkspaceID}) {
(item) => {
const keyTitle = item.translationKey ? translate(item.translationKey) : item.title;


const option = {
text: keyTitle,
brickRoadIndicator: getIndicatorTypeForPolicy(item.policyId),
icons: [{
source: item.icon,
type: item.iconType,
fill: item.iconFill,
name: keyTitle,
fallbackIcon: item.fallbackIcon,
}],
}
icons: [
{
source: item.icon,
type: item.iconType,
fill: item.iconFill,
name: keyTitle,
fallbackIcon: item.fallbackIcon,
},
],
};

// return (
// <MenuItem
Expand Down Expand Up @@ -104,7 +108,6 @@ function WorkspaceSwitcherPage({policies, activeWorkspaceID}) {
isSelected={item.policyId === activeWorkspaceID}
/>
);

},
[activeWorkspaceID, getIndicatorTypeForPolicy, translate],
);
Expand Down Expand Up @@ -132,12 +135,13 @@ function WorkspaceSwitcherPage({policies, activeWorkspaceID}) {
);

const usersWorkspacesSectionData = useMemo(
() =>
[{
() => [
{
data: usersWorkspaces,
shouldShow: true,
indexOffset: 0,
}],
},
],
[usersWorkspaces],
);

Expand All @@ -158,39 +162,51 @@ function WorkspaceSwitcherPage({policies, activeWorkspaceID}) {

const getWorkspacesSection = useCallback(
(workspaces, section, showAddWorkspaceButton) => (
<View>
<View style={[styles.mh4, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.mb3]}>
<Text
style={styles.label}
color={theme.textSupporting}
>
{section}
</Text>
{showAddWorkspaceButton && <PressableWithFeedback accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}>
{({hovered}) => (
<Icon
src={Expensicons.Plus}
width={12}
height={12}
additionalStyles={[styles.highlightBG, styles.borderRadiusNormal, styles.p2, hovered && styles.bordersBG]}
/>
<View>
<View style={[styles.mh4, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.mb3]}>
<Text
style={styles.label}
color={theme.textSupporting}
>
{section}
</Text>
{showAddWorkspaceButton && (
<PressableWithFeedback accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}>
{({hovered}) => (
<Icon
src={Expensicons.Plus}
width={12}
height={12}
additionalStyles={[styles.highlightBG, styles.borderRadiusNormal, styles.p2, hovered && styles.bordersBG]}
/>
)}
</PressableWithFeedback>
)}
</PressableWithFeedback>}
</View>
<View style={{marginBottom: 12}}>
{_.map(workspaces, (item, index) => getMenuItem(item, index))}
</View>
</View>
),
[getMenuItem, styles.alignItemsCenter, styles.borderRadiusNormal, styles.bordersBG, styles.flexRow, styles.highlightBG, styles.justifyContentBetween, styles.label, styles.mb3, styles.mh4, styles.p2, theme.textSupporting],
<View style={{marginBottom: 12}}>{_.map(workspaces, (item, index) => getMenuItem(item, index))}</View>
</View>
),
[
getMenuItem,
styles.alignItemsCenter,
styles.borderRadiusNormal,
styles.bordersBG,
styles.flexRow,
styles.highlightBG,
styles.justifyContentBetween,
styles.label,
styles.mb3,
styles.mh4,
styles.p2,
theme.textSupporting,
],
);

const allWorkspacesSection = useMemo(() => getWorkspacesSection(allWorkspaces, 'Everything', false, false), [allWorkspaces, getWorkspacesSection]);
const usersWorkspacesSection = useMemo(() => getWorkspacesSection(usersWorkspaces, 'Workspaces', true, true), [getWorkspacesSection, usersWorkspaces]);

// const {inputCallbackRef} = useAutoFocusInput();


return (
<HeaderPageLayout
title="Choose a workspace"
Expand Down
2 changes: 1 addition & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ const styles = (theme: ThemeColors) =>
},

textInputLeftIconContainer: {
justifyContent: "center",
justifyContent: 'center',
paddingRight: 8,
},

Expand Down

0 comments on commit 2b0cb18

Please sign in to comment.