Skip to content

Commit 652967c

Browse files
committed
Merge branch 'feat/#Expensify#23220-bidirectional-pagination' of https://github.com/margelo/expensify-app-fork into feat/#Expensify#23220-bidirectional-pagination
2 parents bde5a21 + 821adb8 commit 652967c

File tree

205 files changed

+1361
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+1361
-302
lines changed

.eslintrc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const restrictedImportPatterns = [
2424
];
2525

2626
module.exports = {
27-
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'prettier', 'plugin:react-native-a11y/basic'],
27+
extends: ['expensify', 'plugin:storybook/recommended', 'plugin:react-hooks/recommended', 'plugin:react-native-a11y/basic', 'prettier'],
2828
plugins: ['react-hooks', 'react-native-a11y'],
2929
parser: 'babel-eslint',
3030
ignorePatterns: ['!.*', 'src/vendor', '.github/actions/**/index.js', 'desktop/dist/*.js', 'dist/*.js', 'node_modules/.bin/**', 'node_modules/.cache/**', '.git/**'],
@@ -46,7 +46,6 @@ module.exports = {
4646
touchables: ['PressableWithoutFeedback', 'PressableWithFeedback'],
4747
},
4848
],
49-
curly: 'error',
5049
},
5150
},
5251
{
@@ -76,6 +75,7 @@ module.exports = {
7675
patterns: restrictedImportPatterns,
7776
},
7877
],
78+
curly: 'error',
7979
},
8080
},
8181
{
@@ -162,6 +162,7 @@ module.exports = {
162162
patterns: restrictedImportPatterns,
163163
},
164164
],
165+
curly: 'error',
165166
},
166167
},
167168
{

.github/scripts/createDocsRoutes.js

+38-13
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ const yaml = require('js-yaml');
22
const fs = require('fs');
33
const _ = require('underscore');
44

5-
const warn = 'Number of hubs in _routes.yml does not match number of hubs in docs/articles. Please update _routes.yml with hub info.';
5+
const warnMessage = (platform) => `Number of hubs in _routes.yml does not match number of hubs in docs/${platform}/articles. Please update _routes.yml with hub info.`;
66
const disclaimer = '# This file is auto-generated. Do not edit it directly. Use npm run createDocsRoutes instead.\n';
77
const docsDir = `${process.cwd()}/docs`;
88
const routes = yaml.load(fs.readFileSync(`${docsDir}/_data/_routes.yml`, 'utf8'));
9+
const platformNames = {
10+
expensifyClassic: 'expensify-classic',
11+
newExpensify: 'new-expensify',
12+
};
913

1014
/**
1115
* @param {String} str - The string to convert to title case
@@ -28,7 +32,7 @@ function getArticleObj(filename) {
2832
}
2933

3034
/**
31-
* If the articlea / sections exist in the hub, then push the entry to the array.
35+
* If the article / sections exist in the hub, then push the entry to the array.
3236
* Otherwise, create the array and push the entry to it.
3337
* @param {*} hubs - The hubs array
3438
* @param {*} hub - The hub we are iterating
@@ -44,20 +48,20 @@ function pushOrCreateEntry(hubs, hub, key, entry) {
4448
}
4549
}
4650

47-
function run() {
48-
const hubs = fs.readdirSync(`${docsDir}/articles`);
49-
if (hubs.length !== routes.hubs.length) {
50-
// If new hubs have been added without metadata addition to _routes.yml
51-
console.error(warn);
52-
process.exit(1);
53-
}
51+
/**
52+
* Add articles and sections to hubs
53+
* @param {Array} hubs - The hubs inside docs/articles/ for a platform
54+
* @param {String} platformName - Expensify Classic or New Expensify
55+
* @param {Array} routeHubs - The hubs insude docs/data/_routes.yml for a platform
56+
*/
57+
function createHubsWithArticles(hubs, platformName, routeHubs) {
5458
_.each(hubs, (hub) => {
5559
// Iterate through each directory in articles
56-
fs.readdirSync(`${docsDir}/articles/${hub}`).forEach((fileOrFolder) => {
60+
fs.readdirSync(`${docsDir}/articles/${platformName}/${hub}`).forEach((fileOrFolder) => {
5761
// If the directory content is a markdown file, then it is an article
5862
if (fileOrFolder.endsWith('.md')) {
5963
const articleObj = getArticleObj(fileOrFolder);
60-
pushOrCreateEntry(routes.hubs, hub, 'articles', articleObj);
64+
pushOrCreateEntry(routeHubs, hub, 'articles', articleObj);
6165
return;
6266
}
6367

@@ -66,17 +70,38 @@ function run() {
6670
const articles = [];
6771

6872
// Each subfolder will be a section containing articles
69-
fs.readdirSync(`${docsDir}/articles/${hub}/${section}`).forEach((subArticle) => {
73+
fs.readdirSync(`${docsDir}/articles/${platformName}/${hub}/${section}`).forEach((subArticle) => {
7074
articles.push(getArticleObj(subArticle));
7175
});
7276

73-
pushOrCreateEntry(routes.hubs, hub, 'sections', {
77+
pushOrCreateEntry(routeHubs, hub, 'sections', {
7478
href: section,
7579
title: toTitleCase(section.replaceAll('-', ' ')),
7680
articles,
7781
});
7882
});
7983
});
84+
}
85+
86+
function run() {
87+
const expensifyClassicArticleHubs = fs.readdirSync(`${docsDir}/articles/${platformNames.expensifyClassic}`);
88+
const newExpensifyArticleHubs = fs.readdirSync(`${docsDir}/articles/${platformNames.newExpensify}`);
89+
90+
const expensifyClassicRoute = _.find(routes.platforms, (platform) => platform.href === platformNames.expensifyClassic);
91+
const newExpensifyRoute = _.find(routes.platforms, (platform) => platform.href === platformNames.newExpensify);
92+
93+
if (expensifyClassicArticleHubs.length !== expensifyClassicRoute.hubs.length) {
94+
console.error(warnMessage(platformNames.expensifyClassic));
95+
process.exit(1);
96+
}
97+
98+
if (newExpensifyArticleHubs.length !== newExpensifyRoute.hubs.length) {
99+
console.error(warnMessage(platformNames.newExpensify));
100+
process.exit(1);
101+
}
102+
103+
createHubsWithArticles(expensifyClassicArticleHubs, platformNames.expensifyClassic, expensifyClassicRoute.hubs);
104+
createHubsWithArticles(newExpensifyArticleHubs, platformNames.newExpensify, newExpensifyRoute.hubs);
80105

81106
// Convert the object to YAML and write it to the file
82107
let yamlString = yaml.dump(routes);

contributingGuides/STYLE.md

+13
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,19 @@ When writing a function component you must ALWAYS add a `displayName` property a
491491
export default Avatar;
492492
```
493493
494+
## Forwarding refs
495+
496+
When forwarding a ref define named component and pass it directly to the `forwardRef`. By doing this we remove potential extra layer in React tree in form of anonymous component.
497+
498+
```javascript
499+
function FancyInput(props, ref) {
500+
...
501+
return <input {...props} ref={ref} />
502+
}
503+
504+
export default React.forwardRef(FancyInput)
505+
```
506+
494507
## Stateless components vs Pure Components vs Class based components vs Render Props - When to use what?
495508
496509
Class components are DEPRECATED. Use function components and React hooks.

contributingGuides/TS_CHEATSHEET.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,28 @@
4343
- [1.2](#forwardRef) **`forwardRef`**
4444

4545
```ts
46-
import { forwardRef, useRef, ReactNode } from "react";
46+
// CustomTextInput.tsx
47+
48+
import { forwardRef, useRef, ReactNode, ForwardedRef } from "react";
4749
import { TextInput, View } from "react-native";
4850

4951
export type CustomTextInputProps = {
5052
label: string;
5153
children?: ReactNode;
5254
};
5355

54-
const CustomTextInput = forwardRef<TextInput, CustomTextInputProps>(
55-
(props, ref) => {
56-
return (
57-
<View>
58-
<TextInput ref={ref} />
59-
{props.children}
60-
</View>
61-
);
62-
}
63-
);
56+
function CustomTextInput(props: CustomTextInputProps, ref: ForwardedRef<TextInput>) {
57+
return (
58+
<View>
59+
<TextInput ref={ref} />
60+
{props.children}
61+
</View>
62+
);
63+
};
64+
65+
export default forwardRef(CustomTextInput);
66+
67+
// ParentComponent.tsx
6468

6569
function ParentComponent() {
6670
const ref = useRef<TextInput>();

docs/_data/_routes.yml

+139-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,142 @@
11
home:
22
href: home
33
title: Welcome to ExpensifyHelp!
4-
description: Find the answers to all of your questions about receipts, expenses, corporate cards, or anything else in the spend management universe.
5-
6-
# Hubs are comprised of sections and articles. Sections contain multiple related articles, but there can be standalone articles as well
7-
hubs:
8-
- href: split-bills
9-
title: Split bills
10-
description: With only a couple of clicks, split bills with your friends or coworkers.
11-
icon: /assets/images/paper-airplane.svg
12-
13-
- href: request-money
14-
title: Request money
15-
icon: /assets/images/money-case.svg
16-
description: Request money for work expenses, bills, or a night out with friends.
17-
18-
- href: playbooks
19-
title: Playbooks
20-
icon: /assets/images/playbook.svg
21-
description: Best practices for how to best deploy Expensify for your business
22-
23-
- href: other
24-
title: Other
25-
description: Everything else you're looking for is right here.
26-
icon: /assets/images/lightbulb.svg
4+
description: Questions? Find the answers by clicking a Category or using the search bar located in the left-hand menu.
5+
6+
platforms:
7+
- href: expensify-classic
8+
title: Expensify Classic
9+
hub-title: Expensify Classic - Help & Resources
10+
url: expensify.com
11+
description: Your account settings will look something like this
12+
image: /assets/images/paper-airplane.svg
13+
14+
# Hubs are comprised of sections and articles. Sections contain multiple related articles, but there can be standalone articles as well
15+
hubs:
16+
- href: account-settings
17+
title: Account Settings
18+
icon: /assets/images/gears.svg
19+
description: With only a couple of clicks, split bills with your friends or coworkers.
20+
21+
- href: bank-accounts-and-credit-cards
22+
title: Bank Accounts & Credit Cards
23+
icon: /assets/images/bank-card.svg
24+
description: Request money for work expenses, bills, or a night out with friends.
25+
26+
- href: billing-and-subscriptions
27+
title: Billing & Subscriptions
28+
icon: /assets/images/money-wings.svg
29+
description: Best practices for how to best deploy Expensify for your business
30+
31+
- href: expense-and-report-features
32+
title: Expense & Report Features
33+
icon: /assets/images/money-receipt.svg
34+
description: Everything else you're looking for is right here.
35+
36+
- href: expensify-card
37+
title: Expensify Card
38+
icon: /assets/images/hand-card.svg
39+
description: Request money for work expenses, bills, or a night out with friends.
40+
41+
- href: exports
42+
title: Exports
43+
icon: /assets/images/monitor.svg
44+
description: Best practices for how to best deploy Expensify for your business
45+
46+
- href: get-paid-back
47+
title: Get Paid Back
48+
description: Everything else you're looking for is right here.
49+
icon: /assets/images/money-into-wallet.svg
50+
51+
- href: getting-started
52+
title: Getting Started
53+
description: Everything else you're looking for is right here.
54+
icon: /assets/images/accounting.svg
55+
56+
- href: integrations
57+
title: Integrations
58+
description: Everything else you're looking for is right here.
59+
icon: /assets/images/workflow.svg
60+
61+
- href: manage-employees-and-report-approvals
62+
title: Manage Employees & Report Approvals
63+
icon: /assets/images/envelope-receipt.svg
64+
description: Everything else you're looking for is right here.
65+
66+
- href: policy-and-domain-settings
67+
title: Policy & Domain Setting
68+
icon: /assets/images/shield.svg
69+
description: Everything else you're looking for is right here.
70+
71+
- href: send-payments
72+
title: Send Payments
73+
icon: /assets/images/money-wings.svg
74+
description: Everything else you're looking for is right here.
75+
76+
- href: new-expensify
77+
title: New Expensify
78+
hub-title: New Expensify - Help & Resources
79+
url: new.expensify.com
80+
description: Your account settings will look something like this
81+
image: /assets/images/paper-airplane.svg
82+
83+
hubs:
84+
- href: account-settings
85+
title: Account Settings
86+
icon: /assets/images/gears.svg
87+
description: With only a couple of clicks, split bills with your friends or coworkers.
88+
89+
- href: bank-accounts-and-credit-cards
90+
title: Bank Accounts & Credit Cards
91+
icon: /assets/images/bank-card.svg
92+
description: description
93+
94+
- href: billing-and-plan-types
95+
title: Billing & Plan Types
96+
icon: /assets/images/money-wings.svg
97+
description: description
98+
99+
- href: expense-and-report-features
100+
title: Expense & Report Features
101+
icon: /assets/images/money-receipt.svg
102+
description: description
103+
104+
- href: expensify-card
105+
title: Expensify Card
106+
icon: /assets/images/hand-card.svg
107+
description: description
108+
109+
- href: exports
110+
title: Exports
111+
icon: /assets/images/monitor.svg
112+
description: description
113+
114+
- href: get-paid-back
115+
title: Get Paid Back
116+
icon: /assets/images/money-into-wallet.svg
117+
description: description
118+
119+
- href: getting-started
120+
title: Getting Started
121+
icon: /assets/images/accounting.svg
122+
description: description
123+
124+
- href: integrations
125+
title: Integrations
126+
icon: /assets/images/workflow.svg
127+
description: description
128+
129+
- href: manage-employees-and-report-approvals
130+
title: Manage Employees & Report Approvals
131+
icon: /assets/images/envelope-receipt.svg
132+
description: description
133+
134+
- href: send-payments
135+
title: Send Payments
136+
icon: /assets/images/money-wings.svg
137+
description: description.
138+
139+
- href: workspace-and-domain-settings
140+
title: Workspace & Domain Settings
141+
icon: /assets/images/shield.svg
142+
description: description.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Account Access
3+
description: Account Access
4+
---
5+
## Resources Coming Soon!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Close Account
3+
description: Close Account
4+
---
5+
## Resources Coming Soon!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Merge Accounts
3+
description: Merge Accounts
4+
---
5+
## Resources Coming Soon!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Preferences
3+
description: Preferences
4+
---
5+
## Resources Coming Soon!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Profile Settings
3+
description: Profile Settings
4+
---
5+
## Resources Coming Soon!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Business Bank Accounts - AUS
3+
description: Business Bank Accounts - AUS
4+
---
5+
## Resources Coming Soon!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Business Bank Accounts - USD
3+
description: Business Bank Accounts - USD
4+
---
5+
## Resources Coming Soon!

0 commit comments

Comments
 (0)