From 624a31023f6ac0ae8a6d3a52ca3c831046bccc89 Mon Sep 17 00:00:00 2001 From: rayane-djouah <77965000+rayane-djouah@users.noreply.github.com> Date: Tue, 2 Jan 2024 15:52:53 +0100 Subject: [PATCH] Typing refactor --- .../home/report/ReportActionItemSingle.tsx | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 69bbd924caef..43b5630b2685 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -21,20 +21,18 @@ import * as UserUtils from '@libs/UserUtils'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type {Report, ReportAction} from '@src/types/onyx'; -import {AvatarType} from '@src/types/onyx/OnyxCommon'; +import {Icon} from '@src/types/onyx/OnyxCommon'; +import ChildrenProps from '@src/types/utils/ChildrenProps'; import ReportActionItemDate from './ReportActionItemDate'; import ReportActionItemFragment from './ReportActionItemFragment'; -type ReportActionItemSingleProps = { +type ReportActionItemSingleProps = ChildrenProps & { /** All the data of the action */ action: ReportAction; /** Styles for the outermost View */ wrapperStyle?: StyleProp; - /** Children view component for this action item */ - children: React.ReactNode; - /** Report for this action */ report: Report; @@ -54,23 +52,6 @@ type ReportActionItemSingleProps = { isHovered?: boolean; }; -type SubAvatar = { - /** Avatar source to display */ - source: UserUtils.AvatarSource; - - /** Denotes whether it is a user avatar or a workspace avatar */ - type: AvatarType; - - /** Owner of the avatar. If user, displayName. If workspace, policy name */ - name: string; - - /** Avatar id */ - id?: number | string; - - /** A fallback avatar icon to display when there is an error on loading avatar from remote URL */ - fallbackIcon?: UserUtils.AvatarSource; -}; - const showUserDetails = (accountID: string) => { Navigation.navigate(ROUTES.PROFILE.getRoute(accountID)); }; @@ -119,7 +100,7 @@ function ReportActionItemSingle({ } // If this is a report preview, display names and avatars of both people involved - let secondaryAvatar: SubAvatar; + let secondaryAvatar: Icon; const primaryDisplayName = displayName; if (displayAllActors) { // The ownerAccountID and actorAccountID can be the same if the a user requests money back from the IOU's original creator, in that case we need to use managerID to avoid displaying the same user twice