-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Free trial] Implement Restricted Action screen #43855
Merged
chiragsalian
merged 18 commits into
Expensify:main
from
callstack-internal:pac-guerreiro/feature/restricted-action-screen
Jun 24, 2024
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
778d9cf
feature: add workspace restricted action screen
pac-guerreiro f25f4c2
refactor: apply suggestions
pac-guerreiro b7a472a
refactor: apply suggestions
pac-guerreiro 7e9f6fb
Merge branch 'main' into pac-guerreiro/feature/restricted-action-screen
pac-guerreiro ac7a596
refactor: replace hardcoded values with variables
pac-guerreiro 2be2b5d
fix: restricted action screen styles
pac-guerreiro 0fcee2f
Merge branch 'main' into pac-guerreiro/feature/restricted-action-screen
pac-guerreiro 1bd9288
fix: linter issues
pac-guerreiro a8fbf95
fix: missing variable declaration
pac-guerreiro 9ad9f19
refactor: apply style suggestions
pac-guerreiro 5e432c1
fix: spanish translation for restricted action page
pac-guerreiro 165790c
Merge branch 'main' into pac-guerreiro/feature/restricted-action-screen
pac-guerreiro cc56a97
refactor: apply suggestions
pac-guerreiro a54eb98
refactor: apply prettier
pac-guerreiro ac679f9
refactor: rename import
pac-guerreiro f5be9ab
fix: outdated spanish translation for workspace restricted action
pac-guerreiro ffccc5e
fix: spanish translation not fitting in the UI
pac-guerreiro b27da18
Merge branch 'main' into pac-guerreiro/feature/restricted-action-screen
pac-guerreiro 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
52 changes: 52 additions & 0 deletions
52
assets/images/simple-illustrations/simple-illustration__lockclosed_orange.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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 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 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 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 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 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 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 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
74 changes: 74 additions & 0 deletions
74
src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React, {useCallback} from 'react'; | ||
import {View} from 'react-native'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import Button from '@components/Button'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import ImageSVG from '@components/ImageSVG'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import ScrollView from '@components/ScrollView'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as Report from '@libs/actions/Report'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import * as PolicyUtils from '@libs/PolicyUtils'; | ||
import variables from '@styles/variables'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
||
type WorkspaceAdminRestrictedActionProps = { | ||
policyID: string; | ||
}; | ||
|
||
function WorkspaceAdminRestrictedAction({policyID}: WorkspaceAdminRestrictedActionProps) { | ||
const {translate} = useLocalize(); | ||
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); | ||
const styles = useThemeStyles(); | ||
|
||
const openAdminsReport = useCallback(() => { | ||
const reportID = `${PolicyUtils.getPolicy(policyID)?.chatReportIDAdmins}` ?? '-1'; | ||
Report.openReport(reportID); | ||
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(reportID)); | ||
}, [policyID]); | ||
|
||
return ( | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom | ||
testID={WorkspaceAdminRestrictedAction.displayName} | ||
> | ||
<HeaderWithBackButton | ||
title={translate('workspace.restrictedAction.restricted')} | ||
onBackButtonPress={Navigation.goBack} | ||
/> | ||
<ScrollView | ||
style={[styles.p5, styles.pt0]} | ||
contentContainerStyle={styles.flexGrow1} | ||
> | ||
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter, styles.mb15]}> | ||
<ImageSVG | ||
src={Illustrations.LockClosedOrange} | ||
width={variables.restrictedActionIllustrationHeight} | ||
height={variables.restrictedActionIllustrationHeight} | ||
/> | ||
<Text style={[styles.textHeadlineH1, styles.textAlignCenter]}> | ||
{translate('workspace.restrictedAction.actionsAreCurrentlyRestricted', {workspaceName: policy?.name})} | ||
</Text> | ||
<Text style={[styles.textLabelSupportingEmptyValue, styles.textAlignCenter, styles.lh20, styles.mt2]}> | ||
{translate('workspace.restrictedAction.workspaceOwnerWillNeedToAddOrUpdatePaymentCard', {workspaceOwnerName: policy?.owner})} | ||
</Text> | ||
</View> | ||
<Button | ||
text={translate('workspace.restrictedAction.chatInAdmins')} | ||
onPress={openAdminsReport} | ||
success | ||
large | ||
/> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
WorkspaceAdminRestrictedAction.displayName = 'WorkspaceAdminRestrictedAction'; | ||
|
||
export default WorkspaceAdminRestrictedAction; |
66 changes: 66 additions & 0 deletions
66
src/pages/RestrictedAction/Workspace/WorkspaceOwnerRestrictedAction.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import Badge from '@components/Badge'; | ||
import Button from '@components/Button'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import Icon from '@components/Icon'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import ScrollView from '@components/ScrollView'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import variables from '@styles/variables'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
||
function WorkspaceOwnerRestrictedAction() { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
const addPaymentCard = () => { | ||
Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION); | ||
}; | ||
|
||
return ( | ||
<ScreenWrapper | ||
includeSafeAreaPaddingBottom | ||
testID={WorkspaceOwnerRestrictedAction.displayName} | ||
> | ||
<HeaderWithBackButton | ||
title={translate('workspace.restrictedAction.restricted')} | ||
onBackButtonPress={Navigation.goBack} | ||
/> | ||
<ScrollView contentContainerStyle={[styles.ph5, styles.pt3]}> | ||
<View style={[styles.cardSectionContainer, styles.p5, styles.mb0, styles.mh0]}> | ||
<View style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsStart, styles.mb3]}> | ||
<Icon | ||
src={Illustrations.LockClosedOrange} | ||
height={variables.iconHeader} | ||
width={variables.iconHeader} | ||
/> | ||
<Badge | ||
icon={Expensicons.Unlock} | ||
success | ||
text={translate('workspace.restrictedAction.addPaymentCardToUnlock')} | ||
badgeStyles={styles.alignSelfStart} | ||
/> | ||
</View> | ||
<Text style={[styles.textHeadlineH1, styles.mb4]}>{translate('workspace.restrictedAction.addPaymentCardToContinueUsingWorkspace')}</Text> | ||
<Text style={[styles.textLabelSupportingEmptyValue, styles.mb5]}>{translate('workspace.restrictedAction.youWillNeedToAddOrUpdatePaymentCard')}</Text> | ||
<Button | ||
pac-guerreiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
text={translate('workspace.restrictedAction.addPaymentCard')} | ||
onPress={addPaymentCard} | ||
success | ||
large | ||
/> | ||
</View> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
WorkspaceOwnerRestrictedAction.displayName = 'WorkspaceOwnerRestrictedAction'; | ||
|
||
export default WorkspaceOwnerRestrictedAction; |
Oops, something went wrong.
Oops, something went wrong.
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.
I find this weird to read
current user is an user
. Maybe making it more verbose like so would be easier to read,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.
@chiragsalian
Thank you for the suggestion!
I applied it here - https://github.com/Expensify/App/pull/44371/files#diff-89601c1d4ab7d6fb789ea45b8f8e16ead0f925cf0db25d9b5c3561816d7a94c1R157