Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ type AttachmentPickerWithMenuItemsProps = {
/** Whether or not the composer is full size */
isComposerFullSize: boolean;

/** Whether or not the user is blocked from concierge */
isBlockedFromConcierge: boolean;

/** Whether or not the attachment picker is disabled */
disabled?: boolean;

Expand Down Expand Up @@ -112,7 +109,6 @@ function AttachmentPickerWithMenuItems({
isFullComposerAvailable,
isComposerFullSize,
reportID,
isBlockedFromConcierge,
disabled,
setMenuVisibility,
isMenuVisible,
Expand Down Expand Up @@ -373,7 +369,7 @@ function AttachmentPickerWithMenuItems({
setMenuVisibility(!isMenuVisible);
}}
style={styles.composerSizeButton}
disabled={isBlockedFromConcierge || disabled}
disabled={disabled}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.create')}
>
Expand All @@ -400,7 +396,7 @@ function AttachmentPickerWithMenuItems({
// Keep focus on the composer when Collapse button is clicked.
onMouseDown={(e) => e.preventDefault()}
style={styles.composerSizeButton}
disabled={isBlockedFromConcierge || disabled}
disabled={disabled}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('reportActionCompose.collapse')}
>
Expand All @@ -424,7 +420,7 @@ function AttachmentPickerWithMenuItems({
// Keep focus on the composer when Expand button is clicked.
onMouseDown={(e) => e.preventDefault()}
style={styles.composerSizeButton}
disabled={isBlockedFromConcierge || disabled}
disabled={disabled}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('reportActionCompose.expand')}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ type ComposerWithSuggestionsProps = Partial<ChildrenProps> & {
/** Function to display a file in a modal */
displayFilesInModal: (file: FileObject[]) => void;

/** Whether the user is blocked from concierge */
isBlockedFromConcierge: boolean;

/** Whether the input is disabled */
disabled: boolean;
/** Whether the input is disabled, defaults to false */
disabled?: boolean;

/** Function to set whether the comment is empty */
setIsCommentEmpty: (isCommentEmpty: boolean) => void;
Expand Down Expand Up @@ -215,7 +212,6 @@ function ComposerWithSuggestions(
isMenuVisible,
inputPlaceholder,
displayFilesInModal,
isBlockedFromConcierge,
disabled,
setIsCommentEmpty,
handleSendMessage,
Expand Down Expand Up @@ -815,7 +811,7 @@ function ComposerWithSuggestions(
displayFilesInModal([file]);
}}
onClear={onClear}
isDisabled={isBlockedFromConcierge || disabled}
isDisabled={disabled}
selection={selection}
onSelectionChange={onSelectionChange}
isComposerFullSize={isComposerFullSize}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,12 @@ type ReportActionComposeProps = Pick<ComposerWithSuggestionsProps, 'reportID' |
/** The type of action that's pending */
pendingAction?: OnyxCommon.PendingAction;

/** Whether the report is ready for display */
isReportReadyForDisplay?: boolean;

/** A method to call when the input is focus */
onComposerFocus?: () => void;

/** A method to call when the input is blur */
onComposerBlur?: () => void;

/** Should the input be disabled */
disabled?: boolean;

/** Whether the main composer was hidden */
didHideComposerInput?: boolean;
};
Expand All @@ -125,13 +119,11 @@ const willBlurTextInputOnTapOutside = willBlurTextInputOnTapOutsideFunc();
let onSubmitAction = noop;

function ReportActionCompose({
disabled = false,
isComposerFullSize = false,
onSubmit,
pendingAction,
report,
reportID,
isReportReadyForDisplay = true,
lastReportAction,
onComposerFocus,
onComposerBlur,
Expand Down Expand Up @@ -393,11 +385,11 @@ function ReportActionCompose({
const isGroupPolicyReport = useMemo(() => !!report?.policyID && report.policyID !== CONST.POLICY.ID_FAKE, [report]);
const reportRecipientAccountIDs = getReportRecipientAccountIDs(report, currentUserPersonalDetails.accountID);
const reportRecipient = personalDetails?.[reportRecipientAccountIDs[0]];
const shouldUseFocusedColor = !isBlockedFromConcierge && !disabled && isFocused;
const shouldUseFocusedColor = !isBlockedFromConcierge && isFocused;

const hasReportRecipient = !isEmptyObject(reportRecipient);

const isSendDisabled = isCommentEmpty || isBlockedFromConcierge || !!disabled || !!exceededMaxLength;
const isSendDisabled = isCommentEmpty || isBlockedFromConcierge || !!exceededMaxLength;

// Note: using JS refs is not well supported in reanimated, thus we need to store the function in a shared value
// useSharedValue on web doesn't support functions, so we need to wrap it in an object.
Expand All @@ -413,13 +405,13 @@ function ReportActionCompose({
throw new Error('The composerRefShared.clear function is not set yet. This should never happen, and indicates a developer error.');
}

if (isSendDisabled || !isReportReadyForDisplay) {
if (isSendDisabled) {
return;
}

// This will cause onCleared to be triggered where we actually send the message
clearComposer();
}, [isSendDisabled, isReportReadyForDisplay, composerRefShared]);
}, [isSendDisabled, composerRefShared]);

const measureComposer = useCallback(
(e: LayoutChangeEvent) => {
Expand Down Expand Up @@ -621,8 +613,7 @@ function ReportActionCompose({
reportParticipantIDs={reportParticipantIDs}
isFullComposerAvailable={isFullComposerAvailable}
isComposerFullSize={isComposerFullSize}
isBlockedFromConcierge={isBlockedFromConcierge}
disabled={disabled}
disabled={isBlockedFromConcierge}
setMenuVisibility={setMenuVisibility}
isMenuVisible={isMenuVisible}
onTriggerAttachmentPicker={onTriggerAttachmentPicker}
Expand Down Expand Up @@ -660,8 +651,7 @@ function ReportActionCompose({
setIsFullComposerAvailable={setIsFullComposerAvailable}
displayFilesInModal={displayFilesInModal}
onCleared={submitForm}
isBlockedFromConcierge={isBlockedFromConcierge}
disabled={disabled}
disabled={isBlockedFromConcierge}
setIsCommentEmpty={setIsCommentEmpty}
handleSendMessage={handleSendMessage}
shouldShowComposeInput={shouldShowComposeInput}
Expand Down Expand Up @@ -696,7 +686,7 @@ function ReportActionCompose({
</AttachmentComposerModal>
{canUseTouchScreen() && isMediumScreenWidth ? null : (
<EmojiPickerButton
isDisabled={isBlockedFromConcierge || disabled}
isDisabled={isBlockedFromConcierge}
onModalHide={(isNavigating) => {
if (isNavigating) {
return;
Expand Down
6 changes: 0 additions & 6 deletions src/pages/home/report/ReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ type ReportFooterProps = {
/** The pending action when we are adding a chat */
pendingAction?: PendingAction;

/** Whether the report is ready for display */
isReportReadyForDisplay?: boolean;

/** Whether the composer is in full size */
isComposerFullSize?: boolean;

Expand All @@ -81,7 +78,6 @@ function ReportFooter({
report = {reportID: '-1'},
reportMetadata,
policy,
isReportReadyForDisplay = true,
isComposerFullSize = false,
onComposerBlur,
onComposerFocus,
Expand Down Expand Up @@ -234,7 +230,6 @@ function ReportFooter({
lastReportAction={lastReportAction}
pendingAction={pendingAction}
isComposerFullSize={isComposerFullSize}
isReportReadyForDisplay={isReportReadyForDisplay}
didHideComposerInput={didHideComposerInput}
reportTransactions={reportTransactions}
/>
Expand All @@ -254,7 +249,6 @@ export default memo(
prevProps.pendingAction === nextProps.pendingAction &&
prevProps.isComposerFullSize === nextProps.isComposerFullSize &&
prevProps.lastReportAction === nextProps.lastReportAction &&
prevProps.isReportReadyForDisplay === nextProps.isReportReadyForDisplay &&
deepEqual(prevProps.reportMetadata, nextProps.reportMetadata) &&
deepEqual(prevProps.policy?.employeeList, nextProps.policy?.employeeList) &&
deepEqual(prevProps.policy?.role, nextProps.policy?.role) &&
Expand Down
1 change: 0 additions & 1 deletion tests/perf-test/ReportActionCompose.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ function ReportActionComposeWrapper() {
<ReportActionCompose
onSubmit={() => jest.fn()}
reportID="1"
disabled={false}
report={LHNTestUtils.getFakeReport()}
isComposerFullSize
/>
Expand Down
Loading