Skip to content

Commit

Permalink
Merge pull request Expensify#47812 from neonbhai/fix-integration-icons
Browse files Browse the repository at this point in the history
Fix: integration icons next to export buttons
  • Loading branch information
AndrewGable authored Oct 25, 2024
2 parents d5e4824 + 76b61d0 commit 9825fa2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/ButtonWithDropdownMenu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type DropdownOption<TValueType> = {
iconWidth?: number;
iconHeight?: number;
iconDescription?: string;
additionalIconStyles?: StyleProp<ViewStyle>;
onSelected?: () => void;
disabled?: boolean;
iconFill?: string;
Expand Down
5 changes: 5 additions & 0 deletions src/components/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ type MenuItemBaseProps = {
/** Any additional styles to pass to the icon container. */
iconStyles?: StyleProp<ViewStyle>;

/** Additional styles to pass to the icon itself */
additionalIconStyles?: StyleProp<ViewStyle>;

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

Expand Down Expand Up @@ -433,6 +436,7 @@ function MenuItem(
tooltipShiftHorizontal = 0,
tooltipShiftVertical = 0,
renderTooltipContent,
additionalIconStyles,
shouldShowSelectedItemCheck = false,
onHideTooltip,
shouldIconUseAutoWidthStyle = false,
Expand Down Expand Up @@ -663,6 +667,7 @@ function MenuItem(
isPaneMenu,
)
}
additionalStyles={additionalIconStyles}
/>
) : (
<ActivityIndicator
Expand Down
4 changes: 4 additions & 0 deletions src/components/ReportActionItem/ExportWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as ReportActions from '@libs/actions/Report';
import * as PolicyUtils from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
import type {ExportType} from '@pages/home/report/ReportDetailsExportPage';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Policy, Report} from '@src/types/onyx';
Expand Down Expand Up @@ -55,6 +56,9 @@ function ExportWithDropdownMenu({
icon: iconToDisplay,
disabled: !canBeExported,
displayInDefaultIconColor: true,
iconWidth: variables.iconSizeMenuItem,
iconHeight: variables.iconSizeMenuItem,
additionalIconStyles: styles.integrationIcon,
};
const options = [
{
Expand Down
13 changes: 10 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {SvgProps} from 'react-native-svg';
import type {OriginalMessageIOU, OriginalMessageModifiedExpense} from 'src/types/onyx/OriginalMessage';
import type {TupleToUnion, ValueOf} from 'type-fest';
import type {FileObject} from '@components/AttachmentModal';
import {FallbackAvatar, QBOCircle, XeroCircle} from '@components/Icon/Expensicons';
import {FallbackAvatar, IntacctSquare, NetSuiteSquare, QBOSquare, XeroSquare} from '@components/Icon/Expensicons';
import * as defaultGroupAvatars from '@components/Icon/GroupDefaultAvatars';
import * as defaultWorkspaceAvatars from '@components/Icon/WorkspaceDefaultAvatars';
import type {MoneyRequestAmountInputProps} from '@components/MoneyRequestAmountInput';
Expand Down Expand Up @@ -8253,11 +8253,18 @@ function getSourceIDFromReportAction(reportAction: OnyxEntry<ReportAction>): str

function getIntegrationIcon(connectionName?: ConnectionName) {
if (connectionName === CONST.POLICY.CONNECTIONS.NAME.XERO) {
return XeroCircle;
return XeroSquare;
}
if (connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO) {
return QBOCircle;
return QBOSquare;
}
if (connectionName === CONST.POLICY.CONNECTIONS.NAME.NETSUITE) {
return NetSuiteSquare;
}
if (connectionName === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT) {
return IntacctSquare;
}

return undefined;
}

Expand Down
5 changes: 5 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5264,6 +5264,11 @@ const styles = (theme: ThemeColors) =>
backgroundColor: theme.border,
},

integrationIcon: {
overflow: 'hidden',
borderRadius: variables.buttonBorderRadius,
},

colorGreenSuccess: {
color: colors.green400,
},
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default {
iconSizeExtraLarge: 40,
iconSizeSuperLarge: 60,
iconSizeUltraLarge: 80,
iconSizeMenuItem: 32,
iconBottomBar: 24,
sidebarAvatarSize: 28,
iconHeader: 48,
Expand Down

0 comments on commit 9825fa2

Please sign in to comment.