Skip to content

Commit

Permalink
fix eslint check
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Sep 19, 2024
1 parent deba3fd commit e7b577a
Showing 1 changed file with 7 additions and 42 deletions.
49 changes: 7 additions & 42 deletions src/pages/iou/request/step/IOURequestStepDistance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {View} from 'react-native';
import type {ScrollView as RNScrollView} from 'react-native';
import type {RenderItemParams} from 'react-native-draggable-flatlist/lib/typescript/types';
import type {OnyxEntry} from 'react-native-onyx';
import {useOnyx, withOnyx} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
import DistanceRequestFooter from '@components/DistanceRequest/DistanceRequestFooter';
import DistanceRequestRenderItem from '@components/DistanceRequest/DistanceRequestRenderItem';
Expand Down Expand Up @@ -41,44 +41,28 @@ import withFullTransactionOrNotFound from './withFullTransactionOrNotFound';
import type {WithWritableReportOrNotFoundProps} from './withWritableReportOrNotFound';
import withWritableReportOrNotFound from './withWritableReportOrNotFound';

type IOURequestStepDistanceOnyxProps = {
/** backup version of the original transaction */
transactionBackup: OnyxEntry<OnyxTypes.Transaction>;

/** The policy which the user has access to and which the report is tied to */
policy: OnyxEntry<OnyxTypes.Policy>;

/** Personal details of all users */
personalDetails: OnyxEntry<OnyxTypes.PersonalDetailsList>;

/** Whether the confirmation step should be skipped */
skipConfirmation: OnyxEntry<boolean>;
};

type IOURequestStepDistanceProps = IOURequestStepDistanceOnyxProps &
WithCurrentUserPersonalDetailsProps &
type IOURequestStepDistanceProps = WithCurrentUserPersonalDetailsProps &
WithWritableReportOrNotFoundProps<typeof SCREENS.MONEY_REQUEST.STEP_DISTANCE | typeof SCREENS.MONEY_REQUEST.CREATE> & {
/** The transaction object being modified in Onyx */
transaction: OnyxEntry<OnyxTypes.Transaction>;
};

function IOURequestStepDistance({
report,
policy,
route: {
params: {action, iouType, reportID, transactionID, backTo},
},
transaction,
transactionBackup,
personalDetails,
currentUserPersonalDetails,
skipConfirmation,
}: IOURequestStepDistanceProps) {
const styles = useThemeStyles();
const {isOffline} = useNetwork();
const {translate} = useLocalize();
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID ?? -1}`);

const [transactionBackup] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report ? report?.policyID : '-1'}`);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`);
const [optimisticWaypoints, setOptimisticWaypoints] = useState<WaypointCollection | null>(null);
const waypoints = useMemo(
() =>
Expand Down Expand Up @@ -522,26 +506,7 @@ function IOURequestStepDistance({

IOURequestStepDistance.displayName = 'IOURequestStepDistance';

const IOURequestStepDistanceWithOnyx = withOnyx<IOURequestStepDistanceProps, IOURequestStepDistanceOnyxProps>({
transactionBackup: {
key: ({route}) => {
const transactionID = route.params.transactionID ?? -1;
return `${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`;
},
},
policy: {
key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report?.policyID : '-1'}`,
},
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
skipConfirmation: {
key: ({route}) => {
const transactionID = route.params.transactionID ?? -1;
return `${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`;
},
},
})(IOURequestStepDistance);
const IOURequestStepDistanceWithOnyx = IOURequestStepDistance;

const IOURequestStepDistanceWithCurrentUserPersonalDetails = withCurrentUserPersonalDetails(IOURequestStepDistanceWithOnyx);
// eslint-disable-next-line rulesdir/no-negated-variables
Expand Down

0 comments on commit e7b577a

Please sign in to comment.