-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Add row to workspace chat in Workspace #52449
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
Merged
+53
−7
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f88a717
Add row to workspace chat in Workspace
nkdengineer 29ade25
Merge branch 'main' into fix/51851
nkdengineer 46e39a7
fix: workspace init page style
nkdengineer e18dc37
only subscribe policyExpense chat report
nkdengineer 8629c81
fix lint
nkdengineer 31ea888
Merge branch 'main' into fix/51851
nkdengineer 6ec4a0f
grey out policy expense chat row when creating it offline
nkdengineer 9ed82ac
Merge branch 'main' into fix/51851
nkdengineer a1d4cdd
update padding left
nkdengineer fa9aa9b
Merge branch 'main' into fix/51851
nkdengineer 2bce254
move the expense row to inside ScrollView and update the padding style
nkdengineer f46c736
update background color for hover style
nkdengineer 5eb3d10
merge main
nkdengineer 001fb0b
update margin style
nkdengineer 4170aa4
reduce margin
nkdengineer 5c450e4
update correct background color
nkdengineer 522bb76
fix background color if the item is pressed
nkdengineer 572034c
fix lint
nkdengineer ef84e97
rename variable
nkdengineer 0669d0c
move the function to outside
nkdengineer 22300ac
Merge branch 'main' into fix/51851
nkdengineer ac0b229
merge main
nkdengineer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,9 +9,11 @@ import ConfirmModal from '@components/ConfirmModal'; | |
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import HighlightableMenuItem from '@components/HighlightableMenuItem'; | ||
| import * as Expensicons from '@components/Icon/Expensicons'; | ||
| import MenuItem from '@components/MenuItem'; | ||
| import OfflineWithFeedback from '@components/OfflineWithFeedback'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import ScrollView from '@components/ScrollView'; | ||
| import Text from '@components/Text'; | ||
| import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useNetwork from '@hooks/useNetwork'; | ||
|
|
@@ -25,7 +27,7 @@ import * as CurrencyUtils from '@libs/CurrencyUtils'; | |
| import getTopmostRouteName from '@libs/Navigation/getTopmostRouteName'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import * as PolicyUtils from '@libs/PolicyUtils'; | ||
| import {getDefaultWorkspaceAvatar} from '@libs/ReportUtils'; | ||
| import {getDefaultWorkspaceAvatar, getIcons, getPolicyExpenseChat, getReportName, getReportOfflinePendingActionAndErrors} from '@libs/ReportUtils'; | ||
| import type {FullScreenNavigatorParamList} from '@navigation/types'; | ||
| import * as App from '@userActions/App'; | ||
| import * as Policy from '@userActions/Policy/Policy'; | ||
|
|
@@ -93,13 +95,18 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac | |
| const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policy?.id}`); | ||
| const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email}); | ||
| const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${route.params?.policyID ?? '-1'}`); | ||
| const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); | ||
| const {login, accountID} = useCurrentUserPersonalDetails(); | ||
| const hasSyncError = PolicyUtils.shouldShowSyncError(policy, isConnectionInProgress(connectionSyncProgress, policy)); | ||
| const waitForNavigate = useWaitForNavigation(); | ||
| const {singleExecution, isExecuting} = useSingleExecution(); | ||
| const activeRoute = useNavigationState(getTopmostRouteName); | ||
| const {translate} = useLocalize(); | ||
| const {isOffline} = useNetwork(); | ||
| const wasRendered = useRef(false); | ||
| const currentUserPolicyExpenseChatReportID = getPolicyExpenseChat(accountID, policy?.id ?? '-1')?.reportID ?? '-1'; | ||
| const [currentUserPolicyExpenseChat] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentUserPolicyExpenseChatReportID}`); | ||
| const {reportPendingAction} = getReportOfflinePendingActionAndErrors(currentUserPolicyExpenseChat); | ||
|
|
||
| const prevPendingFields = usePrevious(policy?.pendingFields); | ||
| const policyFeatureStates = useMemo( | ||
|
|
@@ -159,7 +166,6 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac | |
| !isEmptyObject(policy?.errorFields?.avatarURL ?? {}) || | ||
| !isEmptyObject(policy?.errorFields?.ouputCurrency ?? {}) || | ||
| !isEmptyObject(policy?.errorFields?.address ?? {}); | ||
| const {login} = useCurrentUserPersonalDetails(); | ||
| const shouldShowProtectedItems = PolicyUtils.isPolicyAdmin(policy, login); | ||
| const isPaidGroupPolicy = PolicyUtils.isPaidGroupPolicy(policy); | ||
| const [featureStates, setFeatureStates] = useState(policyFeatureStates); | ||
|
|
@@ -408,7 +414,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac | |
| style={styles.headerBarDesktopHeight} | ||
| /> | ||
|
|
||
| <ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexColumn, styles.justifyContentBetween]}> | ||
| <ScrollView contentContainerStyle={[styles.flexColumn]}> | ||
| <OfflineWithFeedback | ||
| pendingAction={policy?.pendingAction} | ||
| onClose={() => dismissError(policyID, policy?.pendingAction)} | ||
|
|
@@ -440,6 +446,20 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac | |
| ))} | ||
| </View> | ||
| </OfflineWithFeedback> | ||
| <View style={[styles.pb4, styles.mh3, styles.mt3]}> | ||
| <Text style={[styles.textSupporting, styles.fontSizeLabel, styles.ph2]}>{translate('workspace.common.submitExpense')}</Text> | ||
| <OfflineWithFeedback pendingAction={reportPendingAction}> | ||
| <MenuItem | ||
| title={getReportName(currentUserPolicyExpenseChat)} | ||
| description={translate('workspace.common.workspace')} | ||
| icon={getIcons(currentUserPolicyExpenseChat, personalDetails)} | ||
| onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(currentUserPolicyExpenseChat?.reportID ?? '-1'))} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming from #53665, we should add |
||
| shouldShowRightIcon | ||
| wrapperStyle={[styles.br2, styles.pl2, styles.pr0, styles.pv3, styles.mt1, styles.alignItemsCenter]} | ||
| shouldShowSubscriptAvatar | ||
| /> | ||
| </OfflineWithFeedback> | ||
| </View> | ||
| </ScrollView> | ||
| <ConfirmModal | ||
| title={translate('workspace.bankAccount.workspaceCurrency')} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the workspace does not have workspace chats enabled, i dont see a check to not show the button in such case @nkdengineer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mountiny This case will happen if
isPolicyExpenseChatEnabledisfalseright?