Skip to content

Commit

Permalink
feat(Violations): move propTypes into MoneyRequestView
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-coleman committed Dec 12, 2023
1 parent e91c965 commit 7ec9098
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
11 changes: 10 additions & 1 deletion src/components/ReportActionItem/MoneyRequestView.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import * as ReceiptUtils from '@libs/ReceiptUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import {transactionViolationsPropTypes} from '@libs/Violations/propTypes';
import AnimatedEmptyStateBackground from '@pages/home/report/AnimatedEmptyStateBackground';
import reportActionPropTypes from '@pages/home/report/reportActionPropTypes';
import iouReportPropTypes from '@pages/iouReportPropTypes';
Expand All @@ -44,6 +43,16 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import ReportActionItemImage from './ReportActionItemImage';

const violationNames = lodashValues(CONST.VIOLATIONS);

const transactionViolationPropType = PropTypes.shape({
type: PropTypes.string.isRequired,
name: PropTypes.oneOf(violationNames).isRequired,
data: PropTypes.objectOf(PropTypes.string),
});

const transactionViolationsPropTypes = PropTypes.arrayOf(transactionViolationPropType);

const propTypes = {
/** The report currently being looked at */
report: reportPropTypes.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ViolationMessages.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {useMemo} from 'react';
import {View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import ViolationsUtils from '@libs/Violations/ViolationsUtils';
import ViolationsUtils from '@libs/ViolationsUtils';
import useThemeStyles from '@styles/useThemeStyles';
import {TransactionViolation} from '@src/types/onyx';
import Text from './Text';
Expand Down
15 changes: 0 additions & 15 deletions src/libs/Violations/propTypes.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import reject from 'lodash/reject';
import Onyx from 'react-native-onyx';
import {Phrase, PhraseParameters} from '@libs/Localize';
import {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import {PolicyCategories, PolicyTags, Transaction, TransactionViolation} from '@src/types/onyx';
import {Phrase, PhraseParameters} from './Localize';

const ViolationsUtils = {
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ViolationUtilsTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {beforeEach} from '@jest/globals';
import Onyx from 'react-native-onyx';
import ViolationsUtils from '@libs/Violations/ViolationsUtils';
import ViolationsUtils from '@libs/ViolationsUtils';
import ONYXKEYS from '@src/ONYXKEYS';

const categoryOutOfPolicyViolation = {
Expand Down

0 comments on commit 7ec9098

Please sign in to comment.