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 employee and accounting page to onboarding flow #49161

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
accc8a1
feat: add employee and accounting page to onboarding flow
nkdengineer Sep 13, 2024
419f7cc
fix ts error
nkdengineer Sep 13, 2024
88dda39
Merge branch 'main' into fix/48745
nkdengineer Sep 16, 2024
6bdf7ed
add OnboadingListItem
nkdengineer Sep 16, 2024
e0bc748
fix test
nkdengineer Sep 16, 2024
de74800
add offline indicator and fix ts bug
nkdengineer Sep 16, 2024
5f75726
Merge branch 'main' into fix/48745
nkdengineer Sep 17, 2024
a37009d
fix the font-size issue
nkdengineer Sep 17, 2024
d72dec2
decrease spacing between title and description
nkdengineer Sep 17, 2024
2200305
Merge branch 'main' into fix/48745
nkdengineer Sep 18, 2024
646fc6d
Update src/pages/OnboardingEmployees/index.tsx
nkdengineer Sep 18, 2024
b7b016f
Update src/pages/OnboardingAccounting/index.tsx
nkdengineer Sep 18, 2024
6964f34
call completeOnboarding API
nkdengineer Sep 18, 2024
def4389
fix ts error
nkdengineer Sep 18, 2024
b923dab
Merge branch 'main' into fix/48745
nkdengineer Sep 18, 2024
b1e8c24
move the type to CONST
nkdengineer Sep 18, 2024
f8ff1f5
remove OnboardingListItem
nkdengineer Sep 18, 2024
a773766
remove onboardingIcon type
nkdengineer Sep 18, 2024
a50ce47
remove unused style
nkdengineer Sep 18, 2024
c9b6a0b
fix lint
nkdengineer Sep 18, 2024
0d6adac
merge main
nkdengineer Sep 19, 2024
13f4da9
add type and refactor style
nkdengineer Sep 19, 2024
944b3d3
Merge branch 'main' into fix/48745
nkdengineer Sep 20, 2024
1a67914
change firstname and lastname as optional
nkdengineer Sep 20, 2024
497a35e
migrate to useOnyx
nkdengineer Sep 20, 2024
ced0874
remove withOnyx
nkdengineer Sep 20, 2024
41de3e1
Merge branch 'main' into fix/48745
nkdengineer Sep 20, 2024
d417b6a
remove unnecessary code
nkdengineer Sep 20, 2024
c6c8cbc
Update src/SCREENS.ts
nkdengineer Sep 20, 2024
11f3a4a
Merge branch 'main' into fix/48745
nkdengineer Sep 23, 2024
465ffbc
Update src/CONST.ts
nkdengineer Sep 23, 2024
d3121d6
Update src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx
nkdengineer Sep 23, 2024
f72f134
refactor code
nkdengineer Sep 23, 2024
076d4af
Merge branch 'fix/48745' of https://github.com/nkdengineer/App into f…
nkdengineer Sep 23, 2024
ccfa4e1
fix type error
nkdengineer Sep 23, 2024
a1201d2
remove unnecessary prop
nkdengineer Sep 23, 2024
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
105 changes: 0 additions & 105 deletions src/components/SelectionList/OnboardingListItem.tsx

This file was deleted.

7 changes: 1 addition & 6 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// eslint-disable-next-line no-restricted-imports
import type CursorStyles from '@styles/utils/cursor/types';
import type CONST from '@src/CONST';
import type {OnboardingIcon} from '@src/types/onyx/Onboarding';

Check failure on line 7 in src/components/SelectionList/types.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'OnboardingIcon' is defined but never used
import type {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon';
import type {SearchPersonalDetails, SearchReport, SearchReportAction, SearchTransaction} from '@src/types/onyx/SearchResults';
import type {ReceiptErrors} from '@src/types/onyx/Transaction';
Expand All @@ -12,7 +12,6 @@
import type IconAsset from '@src/types/utils/IconAsset';
import type ChatListItem from './ChatListItem';
import type InviteMemberListItem from './InviteMemberListItem';
import type OnboardingListItem from './OnboardingListItem';
import type RadioListItem from './RadioListItem';
import type ReportListItem from './Search/ReportListItem';
import type TransactionListItem from './Search/TransactionListItem';
Expand Down Expand Up @@ -292,8 +291,6 @@
FooterComponent?: ReactElement;
};

type OnboardingListItemProps<TItem extends ListItem> = ListItemProps<TItem & {onboardingIcon?: OnboardingIcon}>;

type InviteMemberListItemProps<TItem extends ListItem> = UserListItemProps<TItem>;

type RadioListItemProps<TItem extends ListItem> = ListItemProps<TItem>;
Expand All @@ -313,8 +310,7 @@
| typeof InviteMemberListItem
| typeof TransactionListItem
| typeof ReportListItem
| typeof ChatListItem
| typeof OnboardingListItem;
| typeof ChatListItem;

type Section<TItem extends ListItem> = {
/** Title of the section */
Expand Down Expand Up @@ -598,5 +594,4 @@
ValidListItem,
ReportActionListItemType,
ChatListItemProps,
OnboardingListItemProps,
};
78 changes: 36 additions & 42 deletions src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, {useMemo, useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import Button from '@components/Button';
import FormHelpMessage from '@components/FormHelpMessage';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import OfflineIndicator from '@components/OfflineIndicator';
import ScreenWrapper from '@components/ScreenWrapper';
import SelectionList from '@components/SelectionList';
import OnboardingListItem from '@components/SelectionList/OnboardingListItem';
import type {ListItem} from '@components/SelectionList/types';
import RadioListItem from '@components/SelectionList/RadioListItem';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand All @@ -26,13 +25,8 @@
import type {OnboardingAccountingType} from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {} from '@src/types/onyx/Bank';
import type {OnboardingIcon} from '@src/types/onyx/Onboarding';
import type {BaseOnboardingAccountingProps} from './types';

type OnboardingListItemData = ListItem & {
keyForList: OnboardingAccountingType;
onboardingIcon: OnboardingIcon;
};
function BaseOnboardingAccounting({shouldUseNativeStyles, route}: BaseOnboardingAccountingProps) {
const styles = useThemeStyles();
const theme = useTheme();
Expand All @@ -47,68 +41,68 @@
const [userReportedIntegration, setUserReportedIntegration] = useState<OnboardingAccountingType | undefined>(undefined);
const [error, setError] = useState('');

const accountingOptions: OnboardingListItemData[] = useMemo(() => {
const policyAccountingOptions: OnboardingListItemData[] = Object.values(CONST.POLICY.CONNECTIONS.NAME).map((connectionName): OnboardingListItemData => {
const accountingOptions = useMemo(() => {
const policyAccountingOptions = Object.values(CONST.POLICY.CONNECTIONS.NAME).map((connectionName) => {
let text;
let onboardingIcon: OnboardingIcon;
let accountingIcon;
switch (connectionName) {
case CONST.POLICY.CONNECTIONS.NAME.QBO: {
text = translate('workspace.accounting.qbo');
onboardingIcon = {
icon: Expensicons.QBOCircle,
iconWidth: 40,
iconHeight: 40,
};
accountingIcon = Expensicons.QBOCircle;
break;
}
case CONST.POLICY.CONNECTIONS.NAME.XERO: {
text = translate('workspace.accounting.xero');
onboardingIcon = {
icon: Expensicons.XeroCircle,
iconWidth: 40,
iconHeight: 40,
};
accountingIcon = Expensicons.XeroCircle;
break;
}
case CONST.POLICY.CONNECTIONS.NAME.NETSUITE: {
text = translate('workspace.accounting.netsuite');
onboardingIcon = {
icon: Expensicons.NetSuiteSquare,
iconWidth: 40,
iconHeight: 40,
iconStyles: [StyleUtils.getAvatarBorderStyle(CONST.AVATAR_SIZE.DEFAULT, CONST.ICON_TYPE_AVATAR)],
};
accountingIcon = Expensicons.NetSuiteSquare;
break;
}
default: {
text = translate('workspace.accounting.intacct');
onboardingIcon = {
icon: Expensicons.IntacctSquare,
iconWidth: 40,
iconHeight: 40,
iconStyles: [StyleUtils.getAvatarBorderStyle(CONST.AVATAR_SIZE.DEFAULT, CONST.ICON_TYPE_AVATAR)],
};
accountingIcon = Expensicons.IntacctSquare;
break;
}
}
return {
keyForList: connectionName,
text,
onboardingIcon,
leftElement: (
<View style={[styles.mr3, onboardingIsMediumOrLargerScreenWidth ? styles.ml3 : styles.ml0, styles.onboardingIconWrapper]}>
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
<Icon
src={accountingIcon}
width={40}
height={40}
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
additionalStyles={[StyleUtils.getAvatarBorderStyle(CONST.AVATAR_SIZE.DEFAULT, CONST.ICON_TYPE_AVATAR)]}
/>
</View>
),
rightElement: onboardingIsMediumOrLargerScreenWidth ? <View style={styles.mr3} /> : null,
isSelected: userReportedIntegration === connectionName,
};
});
const noneAccountingOption: OnboardingListItemData = {
text: translate('onboarding.accounting.noneOfAbove'),
const noneAccountingOption = {
keyForList: null,
onboardingIcon: {
icon: Expensicons.Clear,
iconFill: theme.success,
},
text: translate('onboarding.accounting.noneOfAbove'),
leftElement: (
<View style={[styles.mr3, onboardingIsMediumOrLargerScreenWidth ? styles.ml3 : styles.ml0, styles.onboardingIconWrapper]}>
<Icon
src={Expensicons.Clear}
width={20}
height={20}
fill={theme.success}
additionalStyles={[StyleUtils.getAvatarBorderStyle(CONST.AVATAR_SIZE.DEFAULT, CONST.ICON_TYPE_AVATAR)]}
/>
</View>
),
rightElement: onboardingIsMediumOrLargerScreenWidth ? <View style={styles.mr3} /> : null,
isSelected: userReportedIntegration === null,
};
return [...policyAccountingOptions, noneAccountingOption];
}, [StyleUtils, theme.success, translate, userReportedIntegration]);
}, [StyleUtils, onboardingIsMediumOrLargerScreenWidth, styles.ml0, styles.ml3, styles.mr0, styles.mr3, styles.onboardingIconWrapper, theme.success, translate, userReportedIntegration]);

Check warning on line 105 in src/pages/OnboardingAccounting/BaseOnboardingAccounting.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useMemo has an unnecessary dependency: 'styles.mr0'. Either exclude it or remove the dependency array

const footerContent = (
<>
Expand Down Expand Up @@ -197,7 +191,7 @@
setError('');
}}
shouldUpdateFocusedIndex
ListItem={OnboardingListItem}
ListItem={RadioListItem}
footerContent={footerContent}
shouldShowTooltips={false}
/>
Expand Down
11 changes: 6 additions & 5 deletions src/pages/OnboardingEmployees/BaseOnboardingEmployees.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import OfflineIndicator from '@components/OfflineIndicator';
import ScreenWrapper from '@components/ScreenWrapper';
import SelectionList from '@components/SelectionList';
import OnboardingListItem from '@components/SelectionList/OnboardingListItem';
import type {ListItem} from '@components/SelectionList/types';
import RadioListItem from '@components/SelectionList/RadioListItem';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand All @@ -30,15 +29,17 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE
const [selectedCompanySize, setSelectedCompanySize] = useState<OnboardingCompanySizeType | null | undefined>(null);
const [error, setError] = useState('');

const companySizeOptions: ListItem[] = useMemo(() => {
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
const companySizeOptions = useMemo(() => {
return Object.values(CONST.ONBOARDING_COMPANY_SIZE).map((companySize) => {
return {
text: translate(`onboarding.employees.${companySize}`),
keyForList: companySize,
isSelected: companySize === selectedCompanySize,
leftElement: onboardingIsMediumOrLargerScreenWidth ? <View style={styles.ml3} /> : null,
rightElement: onboardingIsMediumOrLargerScreenWidth ? <View style={styles.mr3} /> : null,
Comment on lines +43 to +44
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we apply margin/padding to the main element instead of these fake spacers? Also currently the checkbox goes beyond the intended area

Screenshot 2024-09-20 at 5 24 57 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I mentioned, SelectionList doesn't have a prop to add style to ListItem. Then if we want to do that, we need to introduce a new prop.

};
});
}, [translate, selectedCompanySize]);
}, [translate, selectedCompanySize, onboardingIsMediumOrLargerScreenWidth, styles.ml3, styles.mr3]);

const footerContent = (
<>
Expand Down Expand Up @@ -91,7 +92,7 @@ function BaseOnboardingEmployees({shouldUseNativeStyles, route}: BaseOnboardingE
setError('');
}}
shouldUpdateFocusedIndex
ListItem={OnboardingListItem}
ListItem={RadioListItem}
footerContent={footerContent}
/>
{shouldUseNarrowLayout && <OfflineIndicator />}
Expand Down
Loading