Skip to content

Commit 7d6e999

Browse files
committed
restore Composer.Footer compound API; orchestrator slots indicators back in
1 parent 482dd5d commit 7d6e999

3 files changed

Lines changed: 32 additions & 17 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
import ExceededCommentLength from '@components/ExceededCommentLength';
3+
import {useComposerSendState} from './ComposerContext';
4+
5+
function ComposerExceededLength() {
6+
const {exceededMaxLength, hasExceededMaxTaskTitleLength} = useComposerSendState();
7+
if (!exceededMaxLength) {
8+
return null;
9+
}
10+
return (
11+
<ExceededCommentLength
12+
maxCommentLength={exceededMaxLength}
13+
isTaskTitle={hasExceededMaxTaskTitleLength}
14+
/>
15+
);
16+
}
17+
18+
export default ComposerExceededLength;

src/pages/inbox/report/ReportActionCompose/ComposerFooter.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,24 @@
11
import React from 'react';
22
import {View} from 'react-native';
3-
import ExceededCommentLength from '@components/ExceededCommentLength';
4-
import OfflineIndicator from '@components/OfflineIndicator';
53
import useNetwork from '@hooks/useNetwork';
64
import useResponsiveLayout from '@hooks/useResponsiveLayout';
75
import useThemeStyles from '@hooks/useThemeStyles';
8-
import AgentZeroAwareTypingIndicator from './AgentZeroAwareTypingIndicator';
9-
import {useComposerSendState} from './ComposerContext';
106

117
type ComposerFooterProps = {
12-
reportID: string;
8+
children: React.ReactNode;
139
};
1410

15-
function ComposerFooter({reportID}: ComposerFooterProps) {
11+
function ComposerFooter({children}: ComposerFooterProps) {
1612
const styles = useThemeStyles();
1713
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
1814
const {isSmallScreenWidth} = useResponsiveLayout();
1915
const {isOffline} = useNetwork();
20-
const {exceededMaxLength, hasExceededMaxTaskTitleLength} = useComposerSendState();
2116

2217
return (
2318
<View
2419
style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, (!isSmallScreenWidth || (isSmallScreenWidth && !isOffline)) && styles.chatItemComposeSecondaryRow]}
2520
>
26-
{!isSmallScreenWidth && <OfflineIndicator containerStyles={[styles.chatItemComposeSecondaryRow]} />}
27-
<AgentZeroAwareTypingIndicator reportID={reportID} />
28-
{!!exceededMaxLength && (
29-
<ExceededCommentLength
30-
maxCommentLength={exceededMaxLength}
31-
isTaskTitle={hasExceededMaxTaskTitleLength}
32-
/>
33-
)}
21+
{children}
3422
</View>
3523
);
3624
}

src/pages/inbox/report/ReportActionCompose/ReportActionCompose.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import React from 'react';
22
import {View} from 'react-native';
33
import ImportedStateIndicator from '@components/ImportedStateIndicator';
4+
import OfflineIndicator from '@components/OfflineIndicator';
45
import OfflineWithFeedback from '@components/OfflineWithFeedback';
56
import useOnyx from '@hooks/useOnyx';
67
import useResponsiveLayout from '@hooks/useResponsiveLayout';
78
import useThemeStyles from '@hooks/useThemeStyles';
89
import {getReportOfflinePendingActionAndErrors} from '@libs/ReportUtils';
910
import ONYXKEYS from '@src/ONYXKEYS';
11+
import AgentZeroAwareTypingIndicator from './AgentZeroAwareTypingIndicator';
1012
import ComposerActionMenu from './ComposerActionMenu';
1113
import ComposerBox from './ComposerBox';
1214
import type {SuggestionsRef} from './ComposerContext';
1315
import ComposerDropZone from './ComposerDropZone';
1416
import ComposerEmojiPicker from './ComposerEmojiPicker';
17+
import ComposerExceededLength from './ComposerExceededLength';
1518
import ComposerFooter from './ComposerFooter';
1619
import ComposerInput from './ComposerInput';
1720
import ComposerLocalTime from './ComposerLocalTime';
@@ -26,7 +29,7 @@ type ReportActionComposeProps = {
2629
function ComposerInner({reportID}: ReportActionComposeProps) {
2730
const styles = useThemeStyles();
2831
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
29-
const {isSmallScreenWidth} = useResponsiveLayout();
32+
const {isSmallScreenWidth, shouldUseNarrowLayout} = useResponsiveLayout();
3033
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
3134
const [isComposerFullSize = false] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_IS_COMPOSER_FULL_SIZE}${reportID}`);
3235
const {reportPendingAction: pendingAction} = getReportOfflinePendingActionAndErrors(report);
@@ -49,7 +52,11 @@ function ComposerInner({reportID}: ReportActionComposeProps) {
4952
<Composer.SendButton />
5053
</Composer.Box>
5154
</Composer.DropZone>
52-
<Composer.Footer reportID={reportID} />
55+
<Composer.Footer>
56+
{!shouldUseNarrowLayout && <OfflineIndicator containerStyles={[styles.chatItemComposeSecondaryRow]} />}
57+
<Composer.TypingIndicator reportID={reportID} />
58+
<Composer.ExceededLength />
59+
</Composer.Footer>
5360
</OfflineWithFeedback>
5461
{!isSmallScreenWidth && (
5562
<View style={[styles.mln5, styles.mrn5]}>
@@ -77,6 +84,8 @@ Composer.Input = ComposerInput;
7784
Composer.EmojiPicker = ComposerEmojiPicker;
7885
Composer.SendButton = ComposerSendButton;
7986
Composer.Footer = ComposerFooter;
87+
Composer.TypingIndicator = AgentZeroAwareTypingIndicator;
88+
Composer.ExceededLength = ComposerExceededLength;
8089

8190
export default Composer;
8291
export type {SuggestionsRef, ComposerRef, ReportActionComposeProps};

0 commit comments

Comments
 (0)