forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#43855 from callstack-internal/pac-guerre…
…iro/feature/restricted-action-screen [Free trial] Implement Restricted Action screen
- Loading branch information
Showing
17 changed files
with
378 additions
and
0 deletions.
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 | ||
text={translate('workspace.restrictedAction.addPaymentCard')} | ||
onPress={addPaymentCard} | ||
success | ||
large | ||
/> | ||
</View> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
WorkspaceOwnerRestrictedAction.displayName = 'WorkspaceOwnerRestrictedAction'; | ||
|
||
export default WorkspaceOwnerRestrictedAction; |
Oops, something went wrong.