Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS migration] Migrate 'MoneyRequestConfirmationList.js' component to TypeScript #34168

Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cef767a
ref: started migratiing MoneyRequestConfirmationList
kubabutkiewicz Jan 9, 2024
d76e0df
ref: keep migrating
kubabutkiewicz Jan 9, 2024
e0dc2e9
ref: wip
kubabutkiewicz Jan 10, 2024
8946496
fix: wip
kubabutkiewicz Jan 10, 2024
64f3421
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Jan 11, 2024
ef6ae5f
Update policyCategories type in MoneyRequestConfirmationList
kubabutkiewicz Jan 11, 2024
f00cfe9
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Jan 15, 2024
441e437
fix: wip
kubabutkiewicz Jan 15, 2024
814715b
fix: wip
kubabutkiewicz Jan 15, 2024
e5921ce
fix: resolve comments
kubabutkiewicz Jan 17, 2024
1c2368b
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Jan 17, 2024
5986deb
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Jan 18, 2024
d851908
fix: typecheck
kubabutkiewicz Jan 18, 2024
72262ac
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Jan 30, 2024
d4365b1
fix: typecheck
kubabutkiewicz Jan 30, 2024
2c030a3
fix: remove unnecessary default values
kubabutkiewicz Jan 30, 2024
5293f54
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Jan 30, 2024
b037ab9
fix: typecheck
kubabutkiewicz Jan 30, 2024
90cc670
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 2, 2024
523302c
fix: sync with main
kubabutkiewicz Feb 2, 2024
b8d621e
fix: resolve comments
kubabutkiewicz Feb 2, 2024
c5eb136
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 5, 2024
2933d8a
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 6, 2024
5f3be37
fix: typecheck
kubabutkiewicz Feb 6, 2024
2f30432
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 8, 2024
1da3d09
fix: typecheck
kubabutkiewicz Feb 8, 2024
1e8cda2
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 9, 2024
7b514b3
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 9, 2024
bee66eb
fix: conflicts
kubabutkiewicz Feb 9, 2024
3a172d3
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 12, 2024
f69fce5
fix: typecheck
kubabutkiewicz Feb 12, 2024
67dd282
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 13, 2024
b93fa6b
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 14, 2024
68f4cf9
fix: typecheck
kubabutkiewicz Feb 14, 2024
d885513
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 15, 2024
d7708c1
fix: removed uncessesary condition
kubabutkiewicz Feb 15, 2024
d534c73
Merge branch 'main' into ts-migration/MoneyRequestConfirmationList/co…
kubabutkiewicz Feb 16, 2024
daf4759
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 20, 2024
d5aba80
fix: displaying thumbnail
kubabutkiewicz Feb 20, 2024
c5a4bb8
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 21, 2024
ef465f9
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 22, 2024
90a7ad9
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 26, 2024
479cf7a
fix: typecheck
kubabutkiewicz Feb 26, 2024
f1915bc
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 27, 2024
f17da9e
fix: typecheck
kubabutkiewicz Feb 27, 2024
ad6eff9
fix: linter
kubabutkiewicz Feb 27, 2024
b953adc
Merge branch 'main' of github.com:kubabutkiewicz/expensify-app into t…
kubabutkiewicz Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.SELECTED_TAB]: string;
[ONYXKEYS.COLLECTION.PRIVATE_NOTES_DRAFT]: string;
[ONYXKEYS.COLLECTION.NEXT_STEP]: OnyxTypes.ReportNextStep;
[ONYXKEYS.COLLECTION.POLICY_TAX_RATE]: string[];
[ONYXKEYS.COLLECTION.POLICY_TAX_RATE]: OnyxTypes.PolicyTaxRate;
};

type OnyxValuesMapping = {
Expand Down
23 changes: 10 additions & 13 deletions src/components/ButtonWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,30 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import type {AnchorPosition} from '@styles/index';
import CONST from '@src/CONST';
import type AnchorAlignment from '@src/types/utils/AnchorAlignment';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import type IconAsset from '@src/types/utils/IconAsset';
import Button from './Button';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PopoverMenu from './PopoverMenu';

type PaymentType = DeepValueOf<typeof CONST.IOU.PAYMENT_TYPE | typeof CONST.IOU.REPORT_ACTION_TYPE>;

type DropdownOption = {
value: PaymentType;
type DropdownOption<T> = {
value: T;
text: string;
icon: IconAsset;
icon?: IconAsset;
iconWidth?: number;
iconHeight?: number;
iconDescription?: string;
};

type ButtonWithDropdownMenuProps = {
type ButtonWithDropdownMenuProps<T> = {
/** Text to display for the menu header */
menuHeaderText?: string;

/** Callback to execute when the main button is pressed */
onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: PaymentType) => void;
onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: T) => void;

/** Callback to execute when a dropdown option is selected */
onOptionSelected?: (option: DropdownOption) => void;
onOptionSelected?: (option: DropdownOption<T>) => void;

/** Call the onPress function on main button when Enter key is pressed */
pressOnEnter?: boolean;
Expand All @@ -55,19 +52,19 @@ type ButtonWithDropdownMenuProps = {

/** Menu options to display */
/** e.g. [{text: 'Pay with Expensify', icon: Wallet}] */
options: DropdownOption[];
options: Array<DropdownOption<T>>;

/** The anchor alignment of the popover menu */
anchorAlignment?: AnchorAlignment;

/* ref for the button */
buttonRef: RefObject<View>;
buttonRef?: RefObject<View>;

/** The priority to assign the enter key event listener to buttons. 0 is the highest priority. */
enterKeyEventListenerPriority?: number;
};

function ButtonWithDropdownMenu({
function ButtonWithDropdownMenu<T>({
isLoading = false,
isDisabled = false,
pressOnEnter = false,
Expand All @@ -83,7 +80,7 @@ function ButtonWithDropdownMenu({
options,
onOptionSelected,
enterKeyEventListenerPriority = 0,
}: ButtonWithDropdownMenuProps) {
}: ButtonWithDropdownMenuProps<T>) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down
6 changes: 3 additions & 3 deletions src/components/ConfirmedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ type ConfirmedRoutePropsOnyxProps = {

type ConfirmedRouteProps = ConfirmedRoutePropsOnyxProps & {
/** Transaction that stores the distance request data */
transaction: Transaction;
transaction: Transaction | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
transaction: Transaction | undefined;
transaction?: Transaction;

};

function ConfirmedRoute({mapboxAccessToken, transaction}: ConfirmedRouteProps) {
const {isOffline} = useNetwork();
const {route0: route} = transaction.routes ?? {};
const waypoints = transaction.comment?.waypoints ?? {};
const {route0: route} = transaction?.routes ?? {};
const waypoints = transaction?.comment?.waypoints ?? {};
const coordinates = route?.geometry?.coordinates ?? [];
const theme = useTheme();
const styles = useThemeStyles();
Expand Down
Loading
Loading