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

feat: add note to clarify the workspace join link functionality #45374

Merged
merged 7 commits into from
Jul 19, 2024
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2049,6 +2049,11 @@ export default {
lineItemLevel: 'Line-item level',
reportLevel: 'Report level',
appliedOnExport: 'Not imported into Expensify, applied on export',
shareNote: {
header: 'Easily share your workspace with other members.',
content:
Copy link
Contributor

Choose a reason for hiding this comment

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

@dominictb I think it is better to divide this text into two parts:

  1. Share this QR code or copy the link below to make it easy for members to request access to your workspace. All requests to join the workspace will show up in the
  2. room for your review.

Copy link
Contributor

Choose a reason for hiding this comment

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

With this approach, we don't need to apply logic to split the content in the component

'Share this QR code or copy the link below to make it easy for members to request access to your workspace. All requests to join the workspace will show up in the #admins room for your review.',
},
},
qbo: {
importDescription: 'Choose which coding configurations to import from QuickBooks Online to Expensify.',
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,11 @@ export default {
lineItemLevel: 'Nivel de partida',
reportLevel: 'Nivel de informe',
appliedOnExport: 'No se importa en Expensify, se aplica en la exportación',
shareNote: {
header: 'Comparte fácilmente tu espacio de trabajo con otros miembros.',
content:
'Comparte este código QR o copia el enlace de abajo para facilitar que los miembros soliciten acceso a tu espacio de trabajo. Todas las solicitudes para unirse al espacio de trabajo aparecerán en la sala #admins para tu revisión.',
},
},
qbo: {
importDescription: 'Elige que configuraciónes de codificación son importadas desde QuickBooks Online a Expensify.',
Expand Down
44 changes: 43 additions & 1 deletion src/pages/workspace/WorkspaceProfileSharePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useRef} from 'react';
import React, {useMemo, useRef} from 'react';
import {View} from 'react-native';
import type {ImageSourcePropType} from 'react-native';
import expensifyLogo from '@assets/images/expensify-logo-round-transparent.png';
Expand All @@ -10,19 +10,24 @@ import QRShare from '@components/QRShare';
import type {QRShareHandle} from '@components/QRShare/types';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import TextLink from '@components/TextLink';
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 * as ReportUtils from '@libs/ReportUtils';
import * as Url from '@libs/Url';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import AccessOrNotFoundWrapper from './AccessOrNotFoundWrapper';
import withPolicy from './withPolicy';
import type {WithPolicyProps} from './withPolicy';

const adminsRoomMentionText = '#admins';

dominictb marked this conversation as resolved.
Show resolved Hide resolved
function WorkspaceProfileSharePage({policy}: WithPolicyProps) {
const themeStyles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -37,6 +42,22 @@ function WorkspaceProfileSharePage({policy}: WithPolicyProps) {
const urlWithTrailingSlash = Url.addTrailingForwardSlash(environmentURL);

const url = `${urlWithTrailingSlash}${ROUTES.WORKSPACE_JOIN_USER.getRoute(id, adminEmail)}`;
const adminRoom = useMemo(() => {
if (!policy?.id) {
return undefined;
}
return ReportUtils.getRoom(CONST.REPORT.CHAT_TYPE.POLICY_ADMINS, policy?.id);
}, [policy?.id]);

const shareNote = useMemo(() => {
const header = translate('workspace.common.shareNote.header');
const content = translate('workspace.common.shareNote.content');
const adminRoomMentionIndex = content.indexOf(adminsRoomMentionText);
return {
header,
contentParts: [content.slice(0, adminRoomMentionIndex), content.slice(adminRoomMentionIndex + adminsRoomMentionText.length)],
};
}, [translate]);

return (
<AccessOrNotFoundWrapper
Expand All @@ -53,6 +74,27 @@ function WorkspaceProfileSharePage({policy}: WithPolicyProps) {
/>
<ScrollView style={[themeStyles.flex1, themeStyles.pt2]}>
<View style={[themeStyles.flex1, isSmallScreenWidth ? themeStyles.workspaceSectionMobile : themeStyles.workspaceSection]}>
<View style={[themeStyles.mh5, themeStyles.mv1]}>
<Text style={[themeStyles.textHeadlineH1, themeStyles.mt2]}>{shareNote.header}</Text>
dominictb marked this conversation as resolved.
Show resolved Hide resolved
</View>
<View style={[themeStyles.mh5, themeStyles.mt1, themeStyles.mb9]}>
<Text style={[themeStyles.textNormal, themeStyles.mt2]}>
{shareNote.contentParts[0]}
<TextLink
style={themeStyles.link}
onPress={() => {
if (!adminRoom?.reportID) {
return;
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(adminRoom.reportID));
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

The navigation logic from this line led to the following issue:

because the RHP modal was not being closed before navigating. We fixed the issue by using Navigation.dismissModal() like so:

Navigation.dismissModal(adminRoom.reportID);

which does both, dismiss the modal and then navigate to the room.

>
#admins
</TextLink>
dominictb marked this conversation as resolved.
Show resolved Hide resolved
{shareNote.contentParts[1]}
</Text>
</View>

<View style={[themeStyles.workspaceSectionMobile, themeStyles.ph9]}>
{/*
Right now QR code download button is not shown anymore
Expand Down
Loading