Skip to content

Commit

Permalink
Merge branch 'main' into wave8/WorkspaceTaxesPage
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmydel authored Mar 13, 2024
2 parents d696446 + fa6bcc0 commit 14072ae
Show file tree
Hide file tree
Showing 21 changed files with 478 additions and 253 deletions.
7 changes: 1 addition & 6 deletions assets/images/document-slash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/NewApp_AdHoc.mobileprovision.gpg
Binary file not shown.
Binary file modified ios/NewApp_AdHoc_Notification_Service.mobileprovision.gpg
Binary file not shown.
5 changes: 5 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,11 @@ const CONST = {
MAKE_MEMBER: 'makeMember',
MAKE_ADMIN: 'makeAdmin',
},
CATEGORIES_BULK_ACTION_TYPES: {
DELETE: 'delete',
DISABLE: 'disable',
ENABLE: 'enable',
},
DISTANCE_RATES_BULK_ACTION_TYPES: {
DELETE: 'delete',
DISABLE: 'disable',
Expand Down
6 changes: 5 additions & 1 deletion src/components/AvatarWithImagePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type AvatarWithImagePickerProps = {
/** Additional style props for disabled picker */
disabledStyle?: StyleProp<ViewStyle>;

/** Additional style props for the edit icon */
editIconStyle?: StyleProp<ViewStyle>;

/** Executed once an image has been selected */
onImageSelected?: (file: File | CustomRNImageManipulatorResult) => void;

Expand Down Expand Up @@ -120,6 +123,7 @@ function AvatarWithImagePicker({
DefaultAvatar = () => null,
style,
disabledStyle,
editIconStyle,
pendingAction,
errors,
errorRowStyles,
Expand Down Expand Up @@ -323,7 +327,7 @@ function AvatarWithImagePicker({
)}
</View>
{!disabled && (
<View style={[styles.smallEditIcon, styles.smallAvatarEditIcon]}>
<View style={StyleSheet.flatten([styles.smallEditIcon, styles.smallAvatarEditIcon, editIconStyle])}>
<Icon
src={Expensicons.Pencil}
width={variables.iconSizeSmall}
Expand Down
6 changes: 5 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,7 @@ export default {
testTransactions: 'Test transactions',
issueAndManageCards: 'Issue and manage cards',
reconcileCards: 'Reconcile cards',
selected: ({selectedNumber}) => `${selectedNumber} selected`,
settlementFrequency: 'Settlement frequency',
deleteConfirmation: 'Are you sure you want to delete this workspace?',
unavailable: 'Unavailable workspace',
Expand All @@ -1767,14 +1768,17 @@ export default {
moreFeatures: 'More features',
requested: 'Requested',
distanceRates: 'Distance rates',
selected: ({selectedNumber}) => `${selectedNumber} selected`,
},
type: {
free: 'Free',
control: 'Control',
collect: 'Collect',
},
categories: {
deleteCategories: 'Delete categories',
disableCategories: 'Disable categories',
enableCategories: 'Enable categories',
deleteFailureMessage: 'An error occurred while deleting the category, please try again.',
categoryName: 'Category name',
requiresCategory: 'Members must categorize all spend',
enableCategory: 'Enable category',
Expand Down
6 changes: 5 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,7 @@ export default {
testTransactions: 'Transacciones de prueba',
issueAndManageCards: 'Emitir y gestionar tarjetas',
reconcileCards: 'Reconciliar tarjetas',
selected: ({selectedNumber}) => `${selectedNumber} seleccionados`,
settlementFrequency: 'Frecuencia de liquidación',
deleteConfirmation: '¿Estás seguro de que quieres eliminar este espacio de trabajo?',
unavailable: 'Espacio de trabajo no disponible',
Expand All @@ -1791,14 +1792,17 @@ export default {
moreFeatures: 'Más características',
requested: 'Solicitado',
distanceRates: 'Tasas de distancia',
selected: ({selectedNumber}) => `${selectedNumber} seleccionados`,
},
type: {
free: 'Gratis',
control: 'Control',
collect: 'Recolectar',
},
categories: {
deleteCategories: 'Eliminar categorías',
disableCategories: 'Desactivar categorías',
enableCategories: 'Activar categorías',
deleteFailureMessage: 'Se ha producido un error al intentar eliminar la categoría. Por favor, inténtalo más tarde.',
categoryName: 'Nombre de la categoría',
requiresCategory: 'Los miembros deben categorizar todos los gastos',
enableCategory: 'Activar categoría',
Expand Down
10 changes: 10 additions & 0 deletions src/libs/API/parameters/DeleteWorkspaceCategoriesParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type DeleteWorkspaceCategoriesParams = {
policyID: string;
/**
* A JSON-encoded string representing an array of category names to be deleted.
* Each element in the array is a string that specifies the name of a category.
*/
categories: string;
};

export default DeleteWorkspaceCategoriesParams;
5 changes: 5 additions & 0 deletions src/libs/API/parameters/OpenPolicyMoreFeaturesPageParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type OpenPolicyMoreFeaturesPageParams = {
policyID: string;
};

export default OpenPolicyMoreFeaturesPageParams;
2 changes: 2 additions & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export type {default as UpdateWorkspaceMembersRoleParams} from './UpdateWorkspac
export type {default as SetWorkspaceCategoriesEnabledParams} from './SetWorkspaceCategoriesEnabledParams';
export type {default as CreateWorkspaceCategoriesParams} from './CreateWorkspaceCategoriesParams';
export type {default as SetWorkspaceRequiresCategoryParams} from './SetWorkspaceRequiresCategoryParams';
export type {default as DeleteWorkspaceCategoriesParams} from './DeleteWorkspaceCategoriesParams';
export type {default as SetWorkspaceAutoReportingParams} from './SetWorkspaceAutoReportingParams';
export type {default as SetWorkspaceAutoReportingFrequencyParams} from './SetWorkspaceAutoReportingFrequencyParams';
export type {default as SetWorkspaceAutoReportingMonthlyOffsetParams} from './SetWorkspaceAutoReportingMonthlyOffsetParams';
Expand All @@ -174,4 +175,5 @@ export type {default as JoinPolicyInviteLinkParams} from './JoinPolicyInviteLink
export type {default as OpenPolicyWorkflowsPageParams} from './OpenPolicyWorkflowsPageParams';
export type {default as OpenPolicyDistanceRatesPageParams} from './OpenPolicyDistanceRatesPageParams';
export type {default as OpenPolicyTaxesPageParams} from './OpenPolicyTaxesPageParams';
export type {default as OpenPolicyMoreFeaturesPageParams} from './OpenPolicyMoreFeaturesPageParams';
export type {default as CreatePolicyTagsParams} from './CreatePolicyTagsParams';
4 changes: 4 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const WRITE_COMMANDS = {
CREATE_WORKSPACE_CATEGORIES: 'CreateWorkspaceCategories',
CREATE_POLICY_TAG: 'CreatePolicyTag',
SET_WORKSPACE_REQUIRES_CATEGORY: 'SetWorkspaceRequiresCategory',
DELETE_WORKSPACE_CATEGORIES: 'DeleteWorkspaceCategories',
SET_POLICY_REQUIRES_TAG: 'SetPolicyRequiresTag',
RENAME_POLICY_TAG_LIST: 'RenamePolicyTaglist',
CREATE_TASK: 'CreateTask',
Expand Down Expand Up @@ -282,6 +283,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.SET_WORKSPACE_CATEGORIES_ENABLED]: Parameters.SetWorkspaceCategoriesEnabledParams;
[WRITE_COMMANDS.CREATE_WORKSPACE_CATEGORIES]: Parameters.CreateWorkspaceCategoriesParams;
[WRITE_COMMANDS.SET_WORKSPACE_REQUIRES_CATEGORY]: Parameters.SetWorkspaceRequiresCategoryParams;
[WRITE_COMMANDS.DELETE_WORKSPACE_CATEGORIES]: Parameters.DeleteWorkspaceCategoriesParams;
[WRITE_COMMANDS.SET_POLICY_REQUIRES_TAG]: Parameters.SetPolicyRequiresTag;
[WRITE_COMMANDS.RENAME_POLICY_TAG_LIST]: Parameters.RenamePolicyTaglist;
[WRITE_COMMANDS.CREATE_POLICY_TAG]: Parameters.CreatePolicyTagsParams;
Expand Down Expand Up @@ -379,6 +381,7 @@ const READ_COMMANDS = {
OPEN_DRAFT_WORKSPACE_REQUEST: 'OpenDraftWorkspaceRequest',
OPEN_POLICY_WORKFLOWS_PAGE: 'OpenPolicyWorkflowsPage',
OPEN_POLICY_DISTANCE_RATES_PAGE: 'OpenPolicyDistanceRatesPage',
OPEN_POLICY_MORE_FEATURES_PAGE: 'OpenPolicyMoreFeaturesPage',
} as const;

type ReadCommand = ValueOf<typeof READ_COMMANDS>;
Expand Down Expand Up @@ -418,6 +421,7 @@ type ReadCommandParameters = {
[READ_COMMANDS.OPEN_DRAFT_WORKSPACE_REQUEST]: Parameters.OpenDraftWorkspaceRequestParams;
[READ_COMMANDS.OPEN_POLICY_WORKFLOWS_PAGE]: Parameters.OpenPolicyWorkflowsPageParams;
[READ_COMMANDS.OPEN_POLICY_DISTANCE_RATES_PAGE]: Parameters.OpenPolicyDistanceRatesPageParams;
[READ_COMMANDS.OPEN_POLICY_MORE_FEATURES_PAGE]: Parameters.OpenPolicyMoreFeaturesPageParams;
};

const SIDE_EFFECT_REQUEST_COMMANDS = {
Expand Down
5 changes: 1 addition & 4 deletions src/libs/EmojiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,8 @@ function getFrequentlyUsedEmojis(newEmoji: Emoji | Emoji[]): FrequentlyUsedEmoji
/**
* Given an emoji item object, return an emoji code based on its type.
*/
const getEmojiCodeWithSkinColor = (item: Emoji, preferredSkinToneIndex: OnyxEntry<string | number>): string | undefined => {
const getEmojiCodeWithSkinColor = (item: Emoji, preferredSkinToneIndex: OnyxEntry<number | string>): string => {
const {code, types} = item;
if (!preferredSkinToneIndex) {
return;
}

if (typeof preferredSkinToneIndex === 'number' && types?.[preferredSkinToneIndex]) {
return types[preferredSkinToneIndex];
Expand Down
10 changes: 9 additions & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {PersonalDetailsList, Policy, PolicyMembers, PolicyTagList, PolicyTags} from '@src/types/onyx';
import type {PersonalDetailsList, Policy, PolicyCategories, PolicyMembers, PolicyTagList, PolicyTags} from '@src/types/onyx';
import type {EmptyObject} from '@src/types/utils/EmptyObject';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import Navigation from './Navigation/Navigation';
Expand All @@ -30,6 +30,13 @@ function hasPolicyMemberError(policyMembers: OnyxEntry<PolicyMembers>): boolean
return Object.values(policyMembers ?? {}).some((member) => Object.keys(member?.errors ?? {}).length > 0);
}

/**
* Check if the policy has any errors within the categories.
*/
function hasPolicyCategoriesError(policyCategories: OnyxEntry<PolicyCategories>): boolean {
return Object.keys(policyCategories ?? {}).some((categoryName) => Object.keys(policyCategories?.[categoryName]?.errors ?? {}).length > 0);
}

/**
* Check if the policy has any error fields.
*/
Expand Down Expand Up @@ -295,6 +302,7 @@ export {
getPathWithoutPolicyID,
getPolicyMembersByIdWithoutCurrentUser,
goBackFromInvalidPolicy,
hasPolicyCategoriesError,
};

export type {MemberEmailsToAccountIDs};
Loading

0 comments on commit 14072ae

Please sign in to comment.