Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Expensify/App into perunt/r…
Browse files Browse the repository at this point in the history
…eaction-list-on-secondary-interaction
  • Loading branch information
perunt committed Apr 28, 2023
2 parents cb14807 + 4fc09b9 commit 5dada1a
Show file tree
Hide file tree
Showing 361 changed files with 23,125 additions and 3,369 deletions.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ This is a checklist for PR authors. Please make sure to complete all tasks and c
- [ ] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [ ] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
- [ ] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
- [ ] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. `myBool && <MyComponent />`.
- [ ] I verified that comments were added to code that is not self explanatory
- [ ] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- [ ] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60)
- [ ] If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
- [ ] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60-L68)
- [ ] I verified any copy / text that was added to the app is correct English and approved by marketing by adding the `Waiting for Copy` label for a copy review on the original GH to get the correct copy.
- [ ] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the `Waiting for Copy` label for a copy review on the original GH to get the correct copy.
- [ ] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- [ ] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [ ] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
Expand Down
92 changes: 92 additions & 0 deletions .github/scripts/createDocsRoutes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
const yaml = require('js-yaml');
const fs = require('fs');
const _ = require('underscore');

const warn = 'Number of hubs in _routes.yml does not match number of hubs in docs/articles. Please update _routes.yml with hub info.';
const disclaimer = '# This file is auto-generated. Do not edit it directly. Use npm run createDocsRoutes instead.\n';
const docsDir = `${process.cwd()}/docs`;
const routes = yaml.load(fs.readFileSync(`${docsDir}/_data/_routes.yml`, 'utf8'));

/**
* @param {String} str - The string to convert to title case
* @returns {String}
*/
function toTitleCase(str) {
return str.replace(/\w\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
}

/**
* @param {String} filename - The name of the file
* @returns {Object}
*/
function getArticleObj(filename) {
const href = filename.replace('.md', '');
return {
href,
title: toTitleCase(href.replaceAll('-', ' ')),
};
}

/**
* If the articlea / sections exist in the hub, then push the entry to the array.
* Otherwise, create the array and push the entry to it.
* @param {*} hubs - The hubs array
* @param {*} hub - The hub we are iterating
* @param {*} key - If we want to push sections / articles
* @param {*} entry - The article / section to push
*/
function pushOrCreateEntry(hubs, hub, key, entry) {
const hubObj = _.find(hubs, obj => obj.href === hub);
if (hubObj[key]) {
hubObj[key].push(entry);
} else {
hubObj[key] = [entry];
}
}

function run() {
const hubs = fs.readdirSync(`${docsDir}/articles`);
if (hubs.length !== routes.hubs.length) {
// If new hubs have been added without metadata addition to _routes.yml
console.error(warn);
process.exit(1);
}
_.each(hubs, (hub) => {
// Iterate through each directory in articles
fs.readdirSync(`${docsDir}/articles/${hub}`).forEach((fileOrFolder) => {
// If the directory content is a markdown file, then it is an article
if (fileOrFolder.endsWith('.md')) {
const articleObj = getArticleObj(fileOrFolder);
pushOrCreateEntry(routes.hubs, hub, 'articles', articleObj);
return;
}

// For readability, we will use the term section to refer to subfolders
const section = fileOrFolder;
const articles = [];

// Each subfolder will be a section containing articles
fs.readdirSync(`${docsDir}/articles/${hub}/${section}`).forEach((subArticle) => {
articles.push(getArticleObj(subArticle));
});

pushOrCreateEntry(routes.hubs, hub, 'sections', {
href: section,
title: toTitleCase(section.replaceAll('-', ' ')),
articles,
});
});
});

// Convert the object to YAML and write it to the file
let yamlString = yaml.dump(routes);
yamlString = disclaimer + yamlString;
fs.writeFileSync(`${docsDir}/_data/routes.yml`, yamlString);
}

try {
run();
} catch (error) {
console.error('A problem occurred while trying to read the directories.', error);
process.exit(1);
}
19 changes: 19 additions & 0 deletions .github/scripts/createDocsRoutes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
#
# Re-compiles the routes.yml required by the docs and verifies that there is no diff,
# because that would indicate that the PR author forgot to run `npm run createDocsRoutes`
# and commit the updated routes file.

declare -r GREEN='\033[0;32m'
declare -r NC='\033[0m'

printf '\nRebuilding docs/routes.yml...\n'
npm run createDocsRoutes
SCRIPT_EXIT_CODE=$?

if [[ SCRIPT_EXIT_CODE -eq 1 ]]; then
exit 1
else
echo -e "${GREEN}The docs routes files is up to date!${NC}"
exit 0
fi
58 changes: 58 additions & 0 deletions .github/workflows/deployExpensifyHelp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Deploying the ExpensifyHelp Jekyll site by dynamically generating routes file
name: Deploy ExpensifyHelp

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup NodeJS
uses: Expensify/App/.github/actions/composite/setupNode@main
- name: Setup Pages
uses: actions/configure-pages@f156874f8191504dae5b037505266ed5dda6c382
- name: Create docs routes file
run: ./.github/scripts/createDocsRoutes.sh
- name: Build with Jekyll
uses: actions/jekyll-build-pages@0143c158f4fa0c5dcd99499a5d00859d79f70b0e
with:
source: ./docs/
destination: ./docs/_site
- name: Upload artifact
uses: actions/upload-pages-artifact@64bcae551a7b18bcb9a09042ddf1960979799187
with:
path: ./docs/_site


# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@af48cf94a42f2c634308b1c9dc0151830b6f190a
38 changes: 32 additions & 6 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
Expand Down Expand Up @@ -121,6 +127,12 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7
Expand Down Expand Up @@ -178,6 +190,12 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}
fetch-depth: 0

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i '' 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Decrypt Developer ID Certificate
Expand All @@ -192,7 +210,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Build desktop app for testing
run: npm run desktop-build-internal -- --publish always
run: npm run desktop-build-adhoc -- --publish always
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
Expand All @@ -214,6 +232,12 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || needs.getBranchRef.outputs.REF }}

- name: Create .env.adhoc file based on staging and add PULL_REQUEST_NUMBER env to it
run: |
cp .env.staging .env.adhoc
sed -i 's/ENVIRONMENT=staging/ENVIRONMENT=adhoc/' .env.adhoc
echo "PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER" >> .env.adhoc
- uses: Expensify/App/.github/actions/composite/setupNode@main

- name: Configure AWS Credentials
Expand All @@ -223,7 +247,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Build web for testing
run: npm run build-staging
run: npm run build-adhoc

- name: Build docs
run: npm run storybook-build
Expand Down Expand Up @@ -257,7 +281,8 @@ jobs:
content_android="${content_android//'%'/'%25'}"
content_android="${content_android//$'\n'/'%0A'}"
content_android="${content_android//$'\r'/'%0D'}"
echo "android_paths=$content_android" >> "$GITHUB_OUTPUT"
android_path=$(echo "$content_android" | jq -r '.html_path')
echo "android_path=$android_path" >> "$GITHUB_OUTPUT"
- name: Read JSONs with iOS paths
id: get_ios_path
Expand All @@ -267,7 +292,8 @@ jobs:
content_ios="${content_ios//'%'/'%25'}"
content_ios="${content_ios//$'\n'/'%0A'}"
content_ios="${content_ios//$'\r'/'%0D'}"
echo "ios_paths=$content_ios" >> "$GITHUB_OUTPUT"
ios_path=$(echo "$content_ios" | jq -r '.html_path')
echo "ios_path=$ios_path" >> "$GITHUB_OUTPUT"
# This step removes previous comments with links connected to the PR
- name: maintain-comment
Expand All @@ -289,7 +315,7 @@ jobs:
DESKTOP: ${{ needs.desktop.result }}
IOS: ${{ needs.iOS.result }}
WEB: ${{ needs.web.result }}
ANDROID_LINK: ${{fromJson(steps.get_android_path.outputs.android_paths).html_path}}
ANDROID_LINK: ${{steps.get_android_path.outputs.android_path}}
DESKTOP_LINK: https://ad-hoc-expensify-cash.s3.amazonaws.com/desktop/${{ env.PULL_REQUEST_NUMBER }}/NewExpensify.dmg
IOS_LINK: ${{ fromJson(steps.get_ios_path.outputs.ios_paths).html_path }}
IOS_LINK: ${{steps.get_ios_path.outputs.ios_path}}
WEB_LINK: https://${{ env.PULL_REQUEST_NUMBER }}.pr-testing.expensify.com
23 changes: 23 additions & 0 deletions .github/workflows/validateDocsRoutes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Validate Docs Routes File

on:
pull_request:
types: [opened, synchronize]
paths:
- docs/**

jobs:
verify:
if: github.actor != 'OSBotify'
runs-on: ubuntu-latest
steps:
# This action checks-out the repository, so the workflow can access it.
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
fetch-depth: 0

- uses: Expensify/App/.github/actions/composite/setupNode@main

# Verify that no new hubs were created without adding their metadata to _routes.yml
- name: Validate Docs Routes File
run: ./.github/scripts/createDocsRoutes.sh
2 changes: 2 additions & 0 deletions .github/workflows/validateGithubActions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
pull_request:
types: [opened, synchronize]
branches-ignore: [staging, production]
paths:
- .github/**

jobs:
verify:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/verifyPodfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
types: [opened, synchronize]
branches-ignore: [staging, production]
paths:
- ios/**
- "package.json"
- "package-lock.json"

jobs:
verify:
Expand Down
2 changes: 2 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import Onyx from 'react-native-onyx';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import './fonts.css';
import ComposeProviders from '../src/components/ComposeProviders';
import HTMLEngineProvider from '../src/components/HTMLEngineProvider';
Expand All @@ -18,6 +19,7 @@ const decorators = [
OnyxProvider,
LocaleContextProvider,
HTMLEngineProvider,
SafeAreaProvider,
]}
>
<Story />
Expand Down
16 changes: 10 additions & 6 deletions .storybook/public/index.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
.search-field *, .sidebar-item, .search-result-item--label {
color: #fff !important;
color: #E7ECE9 !important;
}

.sidebar-subheading *, .search-result-item {
color: #fff;
color: #E7ECE9;
}

a.sidebar-item > svg {
color: #03d47c;
}

a.sidebar-item[data-selected="true"], a.sidebar-item[data-selected="true"]:focus, a.sidebar-item[data-selected="true"]:hover {
background: #1A3D32;
}

.search-result-item--label span {
color: #ffffffaa !important;
color: #E7ECE9aa !important;
}

#panel-tab-content :is(input:checked ~ span:last-of-type, input:not(:checked) ~ span:first-of-type) {
background: #ff7101;
color: #fff;
background: #03D47C;
color: #E7ECE9;
}

.sidebar-container {
background: #0b1b34;
background: #07271f;
}
Binary file modified .storybook/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5dada1a

Please sign in to comment.