Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add offline feedback for pending chats #12150

Merged
merged 2 commits into from
Oct 28, 2022
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
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function createOption(logins, personalDetails, report, reportActions = {}, {
result.shouldShowSubscript = result.isPolicyExpenseChat && !report.isOwnPolicyExpenseChat && !result.isArchivedRoom;
result.allReportErrors = getAllReportErrors(report, reportActions);
result.brickRoadIndicator = !_.isEmpty(result.allReportErrors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
result.pendingAction = report.pendingFields ? report.pendingFields.addWorkspaceRoom : null;
result.pendingAction = report.pendingFields ? (report.pendingFields.addWorkspaceRoom || report.pendingFields.createChat) : null;
result.ownerEmail = report.ownerEmail;
result.reportID = report.reportID;
result.isUnread = ReportUtils.isUnread(report);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function getOptionData(reportID) {
result.isArchivedRoom = ReportUtils.isArchivedRoom(report);
result.isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
result.shouldShowSubscript = result.isPolicyExpenseChat && !report.isOwnPolicyExpenseChat && !result.isArchivedRoom;
result.pendingAction = report.pendingFields ? report.pendingFields.addWorkspaceRoom : null;
result.pendingAction = report.pendingFields ? (report.pendingFields.addWorkspaceRoom || report.pendingFields.createChat) : null;
result.allReportErrors = OptionsListUtils.getAllReportErrors(report, reportActions);
result.brickRoadIndicator = !_.isEmpty(result.allReportErrors) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : '';
result.ownerEmail = report.ownerEmail;
Expand Down
9 changes: 7 additions & 2 deletions src/stories/OptionRow.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import OptionRow from '../components/OptionRow';
import * as Expensicons from '../components/Icon/Expensicons';
import OnyxProvider from '../components/OnyxProvider';
/* eslint-disable react/jsx-props-no-spreading */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking about this, why do we move it here? It's kind of odd to have a comment after the code instead of before, but maybe these are new style rules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I wrapped the OptionRow in the OnyxProvider I couldn't put the 'eslint-disable-next-line' comment in the jsx, so I just disable it for the whole file and I put it at the top because that made sense to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: (if we want to) we could do something like this

<OptionRow
    // eslint-disable-next-line react/jsx-props-no-spreading
    {...args}
/>


/**
* We use the Component Story Format for writing stories. Follow the docs here:
Expand Down Expand Up @@ -43,8 +45,11 @@ export default {
},
};

// eslint-disable-next-line react/jsx-props-no-spreading
const Template = args => <OptionRow {...args} />;
const Template = args => (
<OnyxProvider>
<OptionRow {...args} />
</OnyxProvider>
);

// Arguments can be passed to the component by binding
// See: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
Expand Down