Skip to content

Commit

Permalink
Merge pull request #40553 from tienifr/fix/40225
Browse files Browse the repository at this point in the history
fix update icons in global create and money request flows
  • Loading branch information
mountiny authored Apr 26, 2024
2 parents 3a4e053 + c15fd3a commit 9790c24
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 13 deletions.
File renamed without changes
14 changes: 14 additions & 0 deletions assets/images/receipt-scan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import ChatBubbles from '@assets/images/chatbubbles.svg';
import Checkmark from '@assets/images/checkmark.svg';
import Close from '@assets/images/close.svg';
import ClosedSign from '@assets/images/closed-sign.svg';
import Coins from '@assets/images/coins.svg';
import Collapse from '@assets/images/collapse.svg';
import Concierge from '@assets/images/concierge.svg';
import Connect from '@assets/images/connect.svg';
Expand Down Expand Up @@ -123,6 +124,7 @@ import Printer from '@assets/images/printer.svg';
import Profile from '@assets/images/profile.svg';
import QrCode from '@assets/images/qrcode.svg';
import QuestionMark from '@assets/images/question-mark-circle.svg';
import ReceiptScan from '@assets/images/receipt-scan.svg';
import ReceiptSearch from '@assets/images/receipt-search.svg';
import Receipt from '@assets/images/receipt.svg';
import RemoveMembers from '@assets/images/remove-members.svg';
Expand All @@ -143,7 +145,6 @@ import Stopwatch from '@assets/images/stopwatch.svg';
import Sync from '@assets/images/sync.svg';
import Tag from '@assets/images/tag.svg';
import Task from '@assets/images/task.svg';
import Tax from '@assets/images/tax.svg';
import Thread from '@assets/images/thread.svg';
import ThreeDots from '@assets/images/three-dots.svg';
import ThumbsUp from '@assets/images/thumbs-up.svg';
Expand Down Expand Up @@ -234,7 +235,7 @@ export {
Fullscreen,
Folder,
Tag,
Tax,
Coins,
Thread,
Gallery,
Gear,
Expand Down Expand Up @@ -288,6 +289,7 @@ export {
QrCode,
QuestionMark,
Receipt,
ReceiptScan,
RemoveMembers,
ReceiptSearch,
Rotate,
Expand Down
2 changes: 1 addition & 1 deletion src/components/TabSelector/TabSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function getIconAndTitle(route: string, translate: LocaleContextProps['translate
case CONST.TAB_REQUEST.MANUAL:
return {icon: Expensicons.Pencil, title: translate('tabSelector.manual')};
case CONST.TAB_REQUEST.SCAN:
return {icon: Expensicons.Receipt, title: translate('tabSelector.scan')};
return {icon: Expensicons.ReceiptScan, title: translate('tabSelector.scan')};
case CONST.TAB.NEW_CHAT:
return {icon: Expensicons.User, title: translate('tabSelector.chat')};
case CONST.TAB.NEW_ROOM:
Expand Down
18 changes: 18 additions & 0 deletions src/libs/getIconForAction/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type {ValueOf} from 'type-fest';
import * as Expensicons from '@components/Icon/Expensicons';
import CONST from '@src/CONST';

const getIconForAction = (actionType: ValueOf<typeof CONST.IOU.TYPE>) => {
switch (actionType) {
case CONST.IOU.TYPE.TRACK:
return Expensicons.Coins;
case CONST.IOU.TYPE.REQUEST:
return Expensicons.Receipt;
case CONST.IOU.TYPE.SEND:
return Expensicons.Cash;
default:
return Expensicons.MoneyCircle;
}
};

export default getIconForAction;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
import getIconForAction from '@libs/getIconForAction';
import * as ReportUtils from '@libs/ReportUtils';
import * as IOU from '@userActions/IOU';
import * as Report from '@userActions/Report';
Expand Down Expand Up @@ -128,22 +129,22 @@ function AttachmentPickerWithMenuItems({
const moneyRequestOptions = useMemo(() => {
const options: MoneyRequestOptions = {
[CONST.IOU.TYPE.SPLIT]: {
icon: Expensicons.Receipt,
icon: Expensicons.Transfer,
text: translate('iou.splitExpense'),
onSelected: () => IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, report?.reportID ?? ''),
},
[CONST.IOU.TYPE.SUBMIT]: {
icon: Expensicons.MoneyCircle,
icon: getIconForAction(CONST.IOU.TYPE.REQUEST),
text: translate('iou.submitExpense'),
onSelected: () => IOU.startMoneyRequest(CONST.IOU.TYPE.SUBMIT, report?.reportID ?? ''),
},
[CONST.IOU.TYPE.PAY]: {
icon: Expensicons.Send,
icon: getIconForAction(CONST.IOU.TYPE.SEND),
text: translate('iou.paySomeone', {name: ReportUtils.getPayeeName(report)}),
onSelected: () => IOU.startMoneyRequest(CONST.IOU.TYPE.PAY, report?.reportID ?? ''),
},
[CONST.IOU.TYPE.TRACK]: {
icon: Expensicons.DocumentPlus,
icon: getIconForAction(CONST.IOU.TYPE.TRACK),
text: translate('iou.trackExpense'),
onSelected: () => IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK, report?.reportID ?? ''),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import usePermissions from '@hooks/usePermissions';
import usePrevious from '@hooks/usePrevious';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import getIconForAction from '@libs/getIconForAction';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import getTopmostCentralPaneRoute from '@libs/Navigation/getTopmostCentralPaneRoute';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -97,17 +98,21 @@ const getQuickActionIcon = (action: QuickActionName): React.FC<SvgProps> => {
case CONST.QUICK_ACTIONS.REQUEST_MANUAL:
return Expensicons.MoneyCircle;
case CONST.QUICK_ACTIONS.REQUEST_SCAN:
return Expensicons.Receipt;
return Expensicons.ReceiptScan;
case CONST.QUICK_ACTIONS.REQUEST_DISTANCE:
return Expensicons.Car;
case CONST.QUICK_ACTIONS.SPLIT_MANUAL:
case CONST.QUICK_ACTIONS.SPLIT_SCAN:
case CONST.QUICK_ACTIONS.SPLIT_DISTANCE:
return Expensicons.Transfer;
case CONST.QUICK_ACTIONS.SEND_MONEY:
return Expensicons.Send;
return getIconForAction(CONST.IOU.TYPE.SEND);
case CONST.QUICK_ACTIONS.ASSIGN_TASK:
return Expensicons.Task;
case CONST.QUICK_ACTIONS.TRACK_DISTANCE:
case CONST.QUICK_ACTIONS.TRACK_MANUAL:
case CONST.QUICK_ACTIONS.TRACK_SCAN:
return getIconForAction(CONST.IOU.TYPE.TRACK);
default:
return Expensicons.MoneyCircle;
}
Expand Down Expand Up @@ -310,7 +315,7 @@ function FloatingActionButtonAndPopover(
...(canUseTrackExpense && selfDMReportID
? [
{
icon: Expensicons.DocumentPlus,
icon: getIconForAction(CONST.IOU.TYPE.TRACK),
text: translate('iou.trackExpense'),
onSelected: () => {
interceptAnonymousUser(() =>
Expand All @@ -330,7 +335,7 @@ function FloatingActionButtonAndPopover(
]
: []),
{
icon: Expensicons.MoneyCircle,
icon: getIconForAction(CONST.IOU.TYPE.REQUEST),
text: translate('iou.submitExpense'),
onSelected: () =>
interceptAnonymousUser(() =>
Expand All @@ -356,7 +361,7 @@ function FloatingActionButtonAndPopover(
),
},
{
icon: Expensicons.Send,
icon: getIconForAction(CONST.IOU.TYPE.SEND),
text: translate('iou.paySomeone', {}),
onSelected: () =>
interceptAnonymousUser(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspaceInitialPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, reimbursementAcc
if (featureStates?.[CONST.POLICY.MORE_FEATURES.ARE_TAXES_ENABLED]) {
protectedCollectPolicyMenuItems.push({
translationKey: 'workspace.common.taxes',
icon: Expensicons.Tax,
icon: Expensicons.Coins,
action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_TAXES.getRoute(policyID)))),
routeName: SCREENS.WORKSPACE.TAXES,
brickRoadIndicator: PolicyUtils.hasTaxRateError(policy) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
Expand Down

0 comments on commit 9790c24

Please sign in to comment.