Skip to content

Commit

Permalink
Revert "Merge pull request #38722 from rayane-djouah/Feat-Redesign-th…
Browse files Browse the repository at this point in the history
…read-ancestry"

This reverts commit 903fe8a, reversing
changes made to d6fc25a.
  • Loading branch information
mountiny committed Mar 29, 2024
1 parent b5797f9 commit 6a85f5a
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 133 deletions.
3 changes: 0 additions & 3 deletions assets/images/thread.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/components/AvatarWithDisplayName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ function AvatarWithDisplayName({
<ParentNavigationSubtitle
parentNavigationSubtitleData={parentNavigationSubtitleData}
parentReportID={report?.parentReportID}
parentReportActionID={report?.parentReportActionID}
pressableStyles={[styles.alignSelfStart, styles.mw100]}
/>
)}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ import Sync from '@assets/images/sync.svg';
import Tag from '@assets/images/tag.svg';
import Task from '@assets/images/task.svg';
import Tax from '@assets/images/tax.svg';
import Thread from '@assets/images/thread.svg';
import ThreeDots from '@assets/images/three-dots.svg';
import ThumbsUp from '@assets/images/thumbs-up.svg';
import Transfer from '@assets/images/transfer.svg';
Expand Down Expand Up @@ -231,7 +230,6 @@ export {
Folder,
Tag,
Tax,
Thread,
Gallery,
Gear,
Globe,
Expand Down
7 changes: 2 additions & 5 deletions src/components/ParentNavigationSubtitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ type ParentNavigationSubtitleProps = {
/** parent Report ID */
parentReportID?: string;

/** parent Report Action ID */
parentReportActionID?: string;

/** PressableWithoutFeedack additional styles */
pressableStyles?: StyleProp<ViewStyle>;
};

function ParentNavigationSubtitle({parentNavigationSubtitleData, parentReportActionID, parentReportID = '', pressableStyles}: ParentNavigationSubtitleProps) {
function ParentNavigationSubtitle({parentNavigationSubtitleData, parentReportID = '', pressableStyles}: ParentNavigationSubtitleProps) {
const styles = useThemeStyles();
const {workspaceName, reportName} = parentNavigationSubtitleData;

Expand All @@ -31,7 +28,7 @@ function ParentNavigationSubtitle({parentNavigationSubtitleData, parentReportAct
return (
<PressableWithoutFeedback
onPress={() => {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(parentReportID, parentReportActionID));
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(parentReportID));
}}
accessibilityLabel={translate('threads.parentNavigationSummary', {reportName, workspaceName})}
role={CONST.ROLE.LINK}
Expand Down
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2415,7 +2415,6 @@ export default {
hiddenMessage: '[Hidden message]',
},
threads: {
thread: 'Thread',
replies: 'Replies',
reply: 'Reply',
from: 'From',
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2907,7 +2907,6 @@ export default {
hiddenMessage: '[Mensaje oculto]',
},
threads: {
thread: 'Hilo',
replies: 'Respuestas',
reply: 'Respuesta',
from: 'De',
Expand Down
7 changes: 6 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ type Ancestor = {
report: Report;
reportAction: ReportAction;
shouldDisplayNewMarker: boolean;
shouldHideThreadDividerLine: boolean;
};

type AncestorIDs = {
Expand Down Expand Up @@ -5477,7 +5478,7 @@ function shouldDisableThread(reportAction: OnyxEntry<ReportAction>, reportID: st
);
}

function getAllAncestorReportActions(report: Report | null | undefined): Ancestor[] {
function getAllAncestorReportActions(report: Report | null | undefined, shouldHideThreadDividerLine: boolean): Ancestor[] {
if (!report) {
return [];
}
Expand All @@ -5487,6 +5488,7 @@ function getAllAncestorReportActions(report: Report | null | undefined): Ancesto

// Store the child of parent report
let currentReport = report;
let currentUnread = shouldHideThreadDividerLine;

while (parentReportID) {
const parentReport = getReport(parentReportID);
Expand All @@ -5501,11 +5503,14 @@ function getAllAncestorReportActions(report: Report | null | undefined): Ancesto
report: currentReport,
reportAction: parentReportAction,
shouldDisplayNewMarker: isParentReportActionUnread,
// We should hide the thread divider line if the previous ancestor action is unread
shouldHideThreadDividerLine: currentUnread,
});
parentReportID = parentReport?.parentReportID;
parentReportActionID = parentReport?.parentReportActionID;
if (!isEmptyObject(parentReport)) {
currentReport = parentReport;
currentUnread = isParentReportActionUnread;
}
}

Expand Down
1 change: 0 additions & 1 deletion src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
<ParentNavigationSubtitle
parentNavigationSubtitleData={parentNavigationSubtitleData}
parentReportID={report?.parentReportID}
parentReportActionID={report?.parentReportActionID}
pressableStyles={[styles.mt1, styles.mw100]}
/>
)}
Expand Down
1 change: 0 additions & 1 deletion src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ function HeaderView({report, personalDetails, parentReport, parentReportAction,
<ParentNavigationSubtitle
parentNavigationSubtitleData={parentNavigationSubtitleData}
parentReportID={report.parentReportID}
parentReportActionID={report.parentReportActionID}
pressableStyles={[styles.alignSelfStart, styles.mw100]}
/>
)}
Expand Down
36 changes: 0 additions & 36 deletions src/pages/home/report/RepliesDivider.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ function ReportActionItem({
checkIfContextMenuActive={toggleContextMenuFromActiveReportAction}
setIsEmojiPickerActive={setIsEmojiPickerActive}
/>
<View style={StyleUtils.getReportActionItemStyle(hovered || isWhisper || isContextMenuActive || !!isEmojiPickerActive || draftMessage !== undefined, !!onPress)}>
<View style={StyleUtils.getReportActionItemStyle(hovered || isWhisper || isContextMenuActive || !!isEmojiPickerActive || draftMessage !== undefined)}>
<OfflineWithFeedback
onClose={() => ReportActions.clearAllRelatedReportActionErrors(report.reportID, action)}
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down
15 changes: 4 additions & 11 deletions src/pages/home/report/ReportActionItemParentAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';
import AnimatedEmptyStateBackground from './AnimatedEmptyStateBackground';
import RepliesDivider from './RepliesDivider';
import ReportActionItem from './ReportActionItem';
import ThreadDivider from './ThreadDivider';

type ReportActionItemParentActionProps = {
/** Flag to show, hide the thread divider line */
Expand All @@ -39,9 +37,6 @@ type ReportActionItemParentActionProps = {

/** Report actions belonging to the report's parent */
parentReportAction: OnyxEntry<OnyxTypes.ReportAction>;

/** Whether we should display "Replies" divider */
shouldDisplayReplyDivider: boolean;
};

function ReportActionItemParentAction({
Expand All @@ -51,7 +46,6 @@ function ReportActionItemParentAction({
parentReportAction,
index = 0,
shouldHideThreadDividerLine = false,
shouldDisplayReplyDivider,
}: ReportActionItemParentActionProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand All @@ -67,15 +61,15 @@ function ReportActionItemParentAction({
onyxSubscribe({
key: `${ONYXKEYS.COLLECTION.REPORT}${ancestorReportID}`,
callback: () => {
setAllAncestors(ReportUtils.getAllAncestorReportActions(report));
setAllAncestors(ReportUtils.getAllAncestorReportActions(report, shouldHideThreadDividerLine));
},
}),
);
unsubscribeReportActions.push(
onyxSubscribe({
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${ancestorReportID}`,
callback: () => {
setAllAncestors(ReportUtils.getAllAncestorReportActions(report));
setAllAncestors(ReportUtils.getAllAncestorReportActions(report, shouldHideThreadDividerLine));
},
}),
);
Expand All @@ -101,9 +95,8 @@ function ReportActionItemParentAction({
errorRowStyles={[styles.ml10, styles.mr2]}
onClose={() => Report.navigateToConciergeChatAndDeleteReport(ancestor.report.reportID)}
>
<ThreadDivider ancestor={ancestor} />
<ReportActionItem
onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.parentReportID ?? '', ancestor.reportAction.reportActionID))}
onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(ancestor.report.reportID))}
parentReportAction={parentReportAction}
report={ancestor.report}
reportActions={reportActions}
Expand All @@ -114,9 +107,9 @@ function ReportActionItemParentAction({
shouldDisplayNewMarker={ancestor.shouldDisplayNewMarker}
index={index}
/>
{!ancestor.shouldHideThreadDividerLine && <View style={[styles.threadDividerLine]} />}
</OfflineWithFeedback>
))}
{shouldDisplayReplyDivider && <RepliesDivider shouldHideThreadDividerLine={shouldHideThreadDividerLine} />}
</View>
);
}
Expand Down
1 change: 0 additions & 1 deletion src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ function ReportActionsList({
mostRecentIOUReportActionID={mostRecentIOUReportActionID}
shouldHideThreadDividerLine={shouldHideThreadDividerLine}
shouldDisplayNewMarker={shouldDisplayNewMarker(reportAction, index)}
shouldDisplayReplyDivider={sortedReportActions.length > 1}
/>
),
[

Check warning on line 537 in src/pages/home/report/ReportActionsList.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

React Hook useCallback has an unnecessary dependency: 'sortedReportActions.length'. Either exclude it or remove the dependency array
Expand Down
5 changes: 0 additions & 5 deletions src/pages/home/report/ReportActionsListItemRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ type ReportActionsListItemRendererProps = {

/** Linked report action ID */
linkedReportActionID?: string;

/** Whether we should display "Replies" divider */
shouldDisplayReplyDivider: boolean;
};

function ReportActionsListItemRenderer({
Expand All @@ -57,7 +54,6 @@ function ReportActionsListItemRenderer({
shouldHideThreadDividerLine,
shouldDisplayNewMarker,
linkedReportActionID = '',
shouldDisplayReplyDivider,
}: ReportActionsListItemRendererProps) {
const shouldDisplayParentAction =
reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED && ReportUtils.isChatThread(report) && !ReportActionsUtils.isTransactionThread(parentReportAction);
Expand Down Expand Up @@ -131,7 +127,6 @@ function ReportActionsListItemRenderer({
return shouldDisplayParentAction ? (
<ReportActionItemParentAction
shouldHideThreadDividerLine={shouldDisplayParentAction && shouldHideThreadDividerLine}
shouldDisplayReplyDivider={shouldDisplayReplyDivider}
parentReportAction={parentReportAction}
reportID={report.reportID}
report={report}
Expand Down
48 changes: 0 additions & 48 deletions src/pages/home/report/ThreadDivider.tsx

This file was deleted.

10 changes: 2 additions & 8 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,7 @@ const styles = (theme: ThemeColors) =>
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE,
lineHeight: variables.lineHeightXLarge,
maxWidth: '100%',
...cursor.cursorAuto,
...whiteSpace.preWrap,
...wordBreak.breakWord,
},
Expand Down Expand Up @@ -2742,8 +2743,7 @@ const styles = (theme: ThemeColors) =>
height: 1,
backgroundColor: theme.border,
flexGrow: 1,
marginLeft: 8,
marginRight: 20,
marginHorizontal: 20,
},

unreadIndicatorText: {
Expand All @@ -2754,12 +2754,6 @@ const styles = (theme: ThemeColors) =>
textTransform: 'capitalize',
},

threadDividerText: {
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE,
fontSize: variables.fontSizeSmall,
textTransform: 'capitalize',
},

flipUpsideDown: {
transform: `rotate(180deg)`,
},
Expand Down
4 changes: 2 additions & 2 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
/**
* Generate the styles for the ReportActionItem wrapper view.
*/
getReportActionItemStyle: (isHovered = false, isClickable = false): ViewStyle =>
getReportActionItemStyle: (isHovered = false): ViewStyle =>
// TODO: Remove this "eslint-disable-next" once the theme switching migration is done and styles are fully typed (GH Issue: https://github.com/Expensify/App/issues/27337)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
({
Expand All @@ -1462,7 +1462,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
: // Warning: Setting this to a non-transparent color will cause unread indicator to break on Android
theme.transparent,
opacity: 1,
...(isClickable ? styles.cursorPointer : styles.cursorInitial),
...styles.cursorInitial,
}),

/**
Expand Down
Loading

0 comments on commit 6a85f5a

Please sign in to comment.