-
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
Add Share page for Workspace Profile #36907
Merged
luacmartins
merged 14 commits into
Expensify:main
from
narefyev91:add-share-page-for-workspace-profile
Feb 22, 2024
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
10d487b
Add Share page for Workspace Profile
narefyev91 21e7ef0
Update linter
narefyev91 9ce5adc
fix imports
narefyev91 8a8f56b
Update src/pages/workspace/WorkspaceProfileSharePage.tsx
narefyev91 d9b59fe
Merge branch 'main' into add-share-page-for-workspace-profile
narefyev91 4c0ea5d
updates after review
narefyev91 63ccac0
Merge branch 'main' into add-share-page-for-workspace-profile
narefyev91 e56e46d
fix imports
narefyev91 b06928d
Clean up
narefyev91 a4928b8
remove not needed imports
narefyev91 01d3c09
New prop for icon in the button
narefyev91 3e7b94b
Merge branch 'main' into add-share-page-for-workspace-profile
narefyev91 e9eeb44
rollback
narefyev91 6bffec5
remove icon
narefyev91 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type ShouldAllowDownloadQRCode from './types'; | ||
|
||
const shouldAllowDownloadQRCode: ShouldAllowDownloadQRCode = true; | ||
|
||
export default shouldAllowDownloadQRCode; |
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,5 @@ | ||
import type ShouldAllowDownloadQRCode from './types'; | ||
|
||
const shouldAllowDownloadQRCode: ShouldAllowDownloadQRCode = false; | ||
|
||
export default shouldAllowDownloadQRCode; |
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,3 @@ | ||
type ShouldAllowDownloadQRCode = boolean; | ||
|
||
export default ShouldAllowDownloadQRCode; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React, {useRef} from 'react'; | ||
import {ScrollView, View} from 'react-native'; | ||
import type {ImageSourcePropType} from 'react-native'; | ||
import expensifyLogo from '@assets/images/expensify-logo-round-transparent.png'; | ||
import ContextMenuItem from '@components/ContextMenuItem'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import MenuItem from '@components/MenuItem'; | ||
import QRShareWithDownload from '@components/QRShare/QRShareWithDownload'; | ||
import type QRShareWithDownloadHandle from '@components/QRShare/QRShareWithDownload/types'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import useEnvironment from '@hooks/useEnvironment'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
import Clipboard from '@libs/Clipboard'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import shouldAllowDownloadQRCode from '@libs/shouldAllowDownloadQRCode'; | ||
import * as Url from '@libs/Url'; | ||
import CONST from '@src/CONST'; | ||
import ROUTES from '@src/ROUTES'; | ||
import withPolicy from './withPolicy'; | ||
import type {WithPolicyProps} from './withPolicy'; | ||
|
||
function WorkspaceProfileSharePage({policy}: WithPolicyProps) { | ||
const themeStyles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const {environmentURL} = useEnvironment(); | ||
const qrCodeRef = useRef<QRShareWithDownloadHandle>(null); | ||
const {isSmallScreenWidth} = useWindowDimensions(); | ||
|
||
const policyName = policy?.name ?? ''; | ||
const id = policy?.id ?? ''; | ||
const urlWithTrailingSlash = Url.addTrailingForwardSlash(environmentURL); | ||
|
||
const url = `${urlWithTrailingSlash}${ROUTES.WORKSPACE_PROFILE.getRoute(id)}`; | ||
return ( | ||
<ScreenWrapper | ||
testID={WorkspaceProfileSharePage.displayName} | ||
shouldShowOfflineIndicatorInWideScreen | ||
> | ||
<HeaderWithBackButton | ||
title={translate('common.share')} | ||
onBackButtonPress={Navigation.goBack} | ||
/> | ||
<ScrollView style={[themeStyles.flex1, themeStyles.pt2]}> | ||
<View style={[themeStyles.flex1, isSmallScreenWidth ? themeStyles.workspaceSectionMobile : themeStyles.workspaceSection]}> | ||
<View style={[themeStyles.workspaceSectionMobile, themeStyles.ph9]}> | ||
<QRShareWithDownload | ||
ref={qrCodeRef} | ||
url={url} | ||
title={policyName} | ||
logo={(policy?.avatar ? policy.avatar : expensifyLogo) as ImageSourcePropType} | ||
logoRatio={CONST.QR.DEFAULT_LOGO_SIZE_RATIO} | ||
logoMarginRatio={CONST.QR.DEFAULT_LOGO_MARGIN_RATIO} | ||
/> | ||
</View> | ||
|
||
<View style={[themeStyles.mt3, themeStyles.ph4]}> | ||
<ContextMenuItem | ||
isAnonymousAction | ||
text={translate('qrCodes.copy')} | ||
icon={Expensicons.Copy} | ||
successIcon={Expensicons.Checkmark} | ||
successText={translate('qrCodes.copied')} | ||
onPress={() => Clipboard.setString(url)} | ||
shouldLimitWidth={false} | ||
wrapperStyle={themeStyles.sectionMenuItemTopDescription} | ||
/> | ||
{shouldAllowDownloadQRCode && ( | ||
<MenuItem | ||
isAnonymousAction | ||
title={translate('common.download')} | ||
icon={Expensicons.Download} | ||
onPress={() => qrCodeRef.current?.download?.()} | ||
wrapperStyle={themeStyles.sectionMenuItemTopDescription} | ||
/> | ||
)} | ||
</View> | ||
</View> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
WorkspaceProfileSharePage.displayName = 'WorkspaceProfileSharePage'; | ||
|
||
export default withPolicy(WorkspaceProfileSharePage); |
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.
Visual regression can happen when small button + icon because
isIconSmall
is not passedApp/src/components/Attachments/AttachmentCarousel/CarouselButtons.js
Lines 52 to 56 in f4a59a3
Please test arrow buttons in attachment carousel
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 left this comment elsewhere but I don't think we want this kind of prop here... we just want to globally change the size of icons in these buttons, I think at least... Danny will confirm!
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.
will rollback that