Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6550,6 +6550,7 @@ const CONST = {
RHP_HOME_PAGE: 'rhpHomePage',
CONTROL: 'control',
},
ONBOARDING_JOINABLE_WORKSPACES_LIMIT: 5,
ACTIONABLE_TRACK_EXPENSE_WHISPER_MESSAGE: 'What would you like to do with this expense?',
ONBOARDING_ACCOUNTING_MAPPING,

Expand Down
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,7 @@ ${amount} für ${merchant} – ${date}`,
`Jemand von ${domain} hat bereits einen Workspace erstellt. Bitte gib den magischen Code ein, der an ${email} gesendet wurde.`,
joinAWorkspace: 'Einem Arbeitsbereich beitreten',
listOfWorkspaces: 'Hier ist die Liste der Arbeitsbereiche, denen du beitreten kannst. Keine Sorge, du kannst ihnen auch später jederzeit beitreten, wenn du möchtest.',
skipForNow: 'Vorerst überspringen',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} Mitglied${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Wo arbeitest du?',
errorSelection: 'Wähle eine Option, um fortzufahren',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2899,6 +2899,7 @@ const translations = {
workspaceYouMayJoin: (domain: string, email: string) => `Someone from ${domain} has already created a workspace. Please enter the magic code sent to ${email}.`,
joinAWorkspace: 'Join a workspace',
listOfWorkspaces: "Here's the list of workspaces you can join. Don't worry, you can always join them later if you prefer.",
skipForNow: 'Skip for now',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} member${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Where do you work?',
errorSelection: 'Select an option to move forward',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,7 @@ ${amount} para ${merchant} - ${date}`,
workspaceYouMayJoin: (domain, email) => `Alguien de ${domain} ya ha creado un espacio de trabajo. Por favor, introduce el código mágico enviado a ${email}.`,
joinAWorkspace: 'Unirse a un espacio de trabajo',
listOfWorkspaces: 'Aquí está la lista de espacios de trabajo a los que puedes unirte. No te preocupes, siempre puedes unirte a ellos más tarde si lo prefieres.',
skipForNow: 'Omitir por ahora',
whereYouWork: '¿Dónde trabajas?',
errorSelection: 'Selecciona una opción para continuar',
purpose: {
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2873,6 +2873,7 @@ ${amount} pour ${merchant} - ${date}`,
workspaceYouMayJoin: (domain: string, email: string) => `Quelqu’un de ${domain} a déjà créé un espace de travail. Veuillez saisir le code magique envoyé à ${email}.`,
joinAWorkspace: 'Rejoindre un espace de travail',
listOfWorkspaces: 'Voici la liste des espaces de travail que vous pouvez rejoindre. Ne vous inquiétez pas, vous pourrez toujours les rejoindre plus tard si vous préférez.',
skipForNow: 'Passer pour le moment',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} membre${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Où travaillez-vous ?',
errorSelection: 'Sélectionnez une option pour continuer',
Expand Down
1 change: 1 addition & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,7 @@ ${amount} per ${merchant} - ${date}`,
workspaceYouMayJoin: (domain: string, email: string) => `Qualcuno di ${domain} ha già creato uno spazio di lavoro. Inserisci il codice magico inviato a ${email}.`,
joinAWorkspace: 'Unisciti a uno spazio di lavoro',
listOfWorkspaces: "Ecco l'elenco degli spazi di lavoro a cui puoi unirti. Non preoccuparti, potrai sempre unirti anche in un secondo momento, se preferisci.",
skipForNow: 'Salta per ora',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} membro${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Dove lavori?',
errorSelection: 'Seleziona un’opzione per procedere',
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,7 @@ ${date} の ${merchant} への ${amount}`,
workspaceYouMayJoin: (domain: string, email: string) => `${domain} のユーザーがすでにワークスペースを作成しています。${email} に送信されたマジックコードを入力してください。`,
joinAWorkspace: 'ワークスペースに参加',
listOfWorkspaces: '参加できるワークスペースの一覧です。今参加しなくても、後からいつでも参加できます。',
skipForNow: '今はスキップ',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount}人のメンバー${employeeCount > 1 ? 's' : ''}・${policyOwner}`,
whereYouWork: '勤務先はどこですか?',
errorSelection: '次に進むオプションを選択してください',
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2862,6 +2862,7 @@ ${amount} voor ${merchant} - ${date}`,
workspaceYouMayJoin: (domain: string, email: string) => `Iemand van ${domain} heeft al een workspace gemaakt. Voer de magische code in die is verzonden naar ${email}.`,
joinAWorkspace: 'Lid worden van een workspace',
listOfWorkspaces: 'Hier is de lijst met werkruimtes waaraan je kunt deelnemen. Geen zorgen, je kunt je er altijd later nog bij aansluiten als je dat liever hebt.',
skipForNow: 'Voorlopig overslaan',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} lid${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Waar werk je?',
errorSelection: 'Selecteer een optie om verder te gaan',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2854,6 +2854,7 @@ ${amount} dla ${merchant} - ${date}`,
workspaceYouMayJoin: (domain: string, email: string) => `Ktoś z domeny ${domain} utworzył już przestrzeń roboczą. Wprowadź magiczny kod wysłany na adres ${email}.`,
joinAWorkspace: 'Dołącz do przestrzeni roboczej',
listOfWorkspaces: 'Oto lista przestrzeni roboczych, do których możesz dołączyć. Nie martw się, zawsze możesz dołączyć do nich później, jeśli wolisz.',
skipForNow: 'Pomiń na razie',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} członek${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Gdzie pracujesz?',
errorSelection: 'Wybierz opcję, aby przejść dalej',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2854,6 +2854,7 @@ ${amount} para ${merchant} - ${date}`,
workspaceYouMayJoin: (domain: string, email: string) => `Alguém de ${domain} já criou um workspace. Insira o código mágico enviado para ${email}.`,
joinAWorkspace: 'Participar de um workspace',
listOfWorkspaces: 'Aqui está a lista de espaços de trabalho que você pode entrar. Não se preocupe, você sempre pode entrar neles mais tarde, se preferir.',
skipForNow: 'Pular por enquanto',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} membro${employeeCount > 1 ? 's' : ''} • ${policyOwner}`,
whereYouWork: 'Onde você trabalha?',
errorSelection: 'Selecione uma opção para continuar',
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,7 @@ ${amount},商户:${merchant} - 日期:${date}`,
workspaceYouMayJoin: (domain: string, email: string) => `${domain} 中的某位成员已经创建了一个工作区。请输入发送到 ${email} 的魔法验证码。`,
joinAWorkspace: '加入工作区',
listOfWorkspaces: '以下是你可以加入的工作空间列表。别担心,如果你愿意,你随时都可以稍后再加入。',
skipForNow: '暂时跳过',
workspaceMemberList: (employeeCount: number, policyOwner: string) => `${employeeCount} 位成员${employeeCount > 1 ? '秒' : ''} • ${policyOwner}`,
whereYouWork: '你在哪里工作?',
errorSelection: '选择一个选项以继续',
Expand Down
87 changes: 57 additions & 30 deletions src/pages/OnboardingWorkspaces/BaseOnboardingWorkspaces.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useFocusEffect} from '@react-navigation/native';
import {hasSeenTourSelector} from '@selectors/Onboarding';
import React from 'react';
import React, {useState} from 'react';
import {View} from 'react-native';
import Button from '@components/Button';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand All @@ -17,6 +17,7 @@ import useOnboardingStepCounter from '@hooks/useOnboardingStepCounter';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {navigateAfterOnboardingWithMicrotaskQueue} from '@libs/navigateAfterOnboarding';
import Navigation from '@libs/Navigation/Navigation';
Expand All @@ -34,11 +35,13 @@ import type {JoinablePolicy} from '@src/types/onyx/JoinablePolicies';
import type {BaseOnboardingWorkspacesProps} from './types';

function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboardingWorkspacesProps) {
const icons = useMemoizedLazyExpensifyIcons(['FallbackWorkspaceAvatar']);
const icons = useMemoizedLazyExpensifyIcons(['FallbackWorkspaceAvatar', 'DownArrow']);
const {isOffline} = useNetwork();
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
const {onboardingMessages} = useOnboardingMessages();
const [showAll, setShowAll] = useState(false);

// We need to use isSmallScreenWidth, see navigateAfterOnboarding function comment
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
Expand Down Expand Up @@ -99,33 +102,38 @@ function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboarding
);
};

const policyIDItems = Object.values(joinablePolicies ?? {}).map((policyInfo) => ({
text: policyInfo.policyName,
alternateText: translate('onboarding.workspaceMemberList', policyInfo.employeeCount, policyInfo.policyOwner),
keyForList: policyInfo.policyID,
isDisabled: true,
rightElement: (
<Button
isDisabled={isOffline}
success
medium
text={policyInfo.automaticJoiningEnabled ? translate('workspace.workspaceList.joinNow') : translate('workspace.workspaceList.askToJoin')}
onPress={() => {
handleJoinWorkspace(policyInfo);
}}
sentryLabel={CONST.SENTRY_LABEL.ONBOARDING.JOIN_WORKSPACE}
/>
),
icons: [
{
id: policyInfo.policyID,
source: getDefaultWorkspaceAvatar(policyInfo.policyName),
fallbackIcon: icons.FallbackWorkspaceAvatar,
name: policyInfo.policyName,
type: CONST.ICON_TYPE_WORKSPACE,
},
],
}));
const allPolicyIDItems = Object.values(joinablePolicies ?? {})
.sort((a, b) => b.employeeCount - a.employeeCount)
.map((policyInfo) => ({
text: policyInfo.policyName,
alternateText: translate('onboarding.workspaceMemberList', policyInfo.employeeCount, policyInfo.policyOwner),
keyForList: policyInfo.policyID,
isDisabled: true,
rightElement: (
<Button
isDisabled={isOffline}
success
medium
text={policyInfo.automaticJoiningEnabled ? translate('workspace.workspaceList.joinNow') : translate('workspace.workspaceList.askToJoin')}
onPress={() => {
handleJoinWorkspace(policyInfo);
}}
sentryLabel={CONST.SENTRY_LABEL.ONBOARDING.JOIN_WORKSPACE}
/>
),
icons: [
{
id: policyInfo.policyID,
source: getDefaultWorkspaceAvatar(policyInfo.policyName),
fallbackIcon: icons.FallbackWorkspaceAvatar,
name: policyInfo.policyName,
type: CONST.ICON_TYPE_WORKSPACE,
},
],
}));

const hasMoreThanLimit = allPolicyIDItems.length > CONST.ONBOARDING_JOINABLE_WORKSPACES_LIMIT;
const policyIDItems = !showAll && hasMoreThanLimit ? allPolicyIDItems.slice(0, CONST.ONBOARDING_JOINABLE_WORKSPACES_LIMIT) : allPolicyIDItems;

const wrapperPadding = onboardingIsMediumOrLargerScreenWidth ? styles.mh8 : styles.mh5;

Expand Down Expand Up @@ -184,11 +192,30 @@ function BaseOnboardingWorkspaces({route, shouldUseNativeStyles}: BaseOnboarding
<Text style={[styles.textSupporting, styles.mt3]}>{translate('onboarding.listOfWorkspaces')}</Text>
</View>
}
listFooterContent={
hasMoreThanLimit && !showAll ? (
<View style={[wrapperPadding, styles.alignItemsStart]}>
<Button
text={translate('common.showMore')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot this button should be left aligned. And there should be dropdown arrow icon next to the text.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — left-aligned the Show more button (via alignItemsStart on the wrapper) and added a down arrow icon next to the text (via iconRight).

onPress={() => setShowAll(true)}
link
shouldUseDefaultHover={false}
medium
shouldShowRightIcon
iconRight={icons.DownArrow}
iconRightFill={theme.link}
iconRightHoverFill={theme.linkHover}
innerStyles={styles.ph0}
textStyles={[styles.fontSizeNormal]}
/>
Comment on lines +198 to +210

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@MelvinBot This is not button style. See design:

Image

Also, stick to the list content, not at the bottom

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed — changed "Show more" to use the link style (matching the existing pattern in TransactionGroupListExpanded) and moved it from footerContent to listFooterContent so it renders right after the list items inside the scrollable area.

</View>
) : null
}
footerContent={
<Button
success={false}
large
text={translate('common.skip')}
text={translate('onboarding.skipForNow')}
testID="onboardingWorkSpaceSkipButton"
onPress={skipJoiningWorkspaces}
style={[styles.mt5]}
Expand Down
Loading