Skip to content

Commit

Permalink
[TS migration][WorkspaceReimburse] Code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-rebelo committed Feb 8, 2024
1 parent e66017b commit 34135a2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type UpdateWorkspaceCustomUnitAndRateParams = {
policyID: string;
lastModified?: number | string;
lastModified?: string;
customUnit: string;
customUnitRate: string;
};
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ function WorkspaceRateAndUnitPage({policy, route}: WorkspaceRateAndUnitPageProps
const currentCustomUnitRate = Object.values(distanceCustomUnit?.rates ?? {}).find((r) => r.name === CONST.CUSTOM_UNITS.DEFAULT_RATE);
const unitID = distanceCustomUnit.customUnitID ?? '';
const unitName = distanceCustomUnit.name ?? '';
const rateNumValue = PolicyUtils.getNumericValue(rate, toLocaleDigit) as number;
const rateNumValue = PolicyUtils.getNumericValue(rate, toLocaleDigit);

const newCustomUnit: Policy.NewCustomUnit = {
customUnitID: unitID,
name: unitName,
attributes: {unit},
rates: {
...currentCustomUnitRate,
rate: rateNumValue * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET,
rate: Number(rateNumValue) * CONST.POLICY.CUSTOM_UNIT_RATE_BASE_OFFSET,
},
};

Expand Down
13 changes: 0 additions & 13 deletions src/pages/workspace/reimburse/WorkspaceReimburseView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,6 @@ function WorkspaceReimburseView({policy, reimbursementAccount}: WorkspaceReimbur
/>
</OfflineWithFeedback>
</View>
<OfflineWithFeedback
pendingAction={distanceCustomUnit?.pendingAction ?? distanceCustomRate?.pendingAction}
shouldShowErrorMessages={false}
>
<MenuItemWithTopDescription
title={currentRatePerUnit}
description={translate('workspace.reimburse.trackDistanceRate')}
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_RATE_AND_UNIT.getRoute(policy?.id ?? ''))}
wrapperStyle={[styles.mhn5, styles.wAuto]}
brickRoadIndicator={(distanceCustomUnit?.errors ?? distanceCustomRate?.errors) && CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR}
/>
</OfflineWithFeedback>
</Section>

<WorkspaceReimburseSection
Expand Down
2 changes: 1 addition & 1 deletion src/types/onyx/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type * as OnyxCommon from './OnyxCommon';
import type PersonalBankAccount from './PersonalBankAccount';
import type {Unit} from './Policy';

type FormValueType = string | boolean | Date | number | OnyxCommon.Errors;
type FormValueType = string | boolean | Date | OnyxCommon.Errors;

type BaseForm = {
/** Controls the loading state of the form */
Expand Down

0 comments on commit 34135a2

Please sign in to comment.