Skip to content

Commit

Permalink
Merge branch 'master' of github.com:deriv-com/p2p into ako/add-produc…
Browse files Browse the repository at this point in the history
…tion-workflow
  • Loading branch information
ali-hosseini-deriv committed Jun 7, 2024
2 parents 2f550c5 + 8c70221 commit d1e5a55
Show file tree
Hide file tree
Showing 271 changed files with 6,685 additions and 18,762 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['@deriv-com/eslint-config-deriv', 'eslint:recommended', 'plugin:react/recommended'],
plugins: ['simple-import-sort','sort-destructure-keys', 'typescript-sort-keys' ],
plugins: ['simple-import-sort', 'sort-destructure-keys', 'typescript-sort-keys'],
rules: {
'global-require': 'off',
'@typescript-eslint/array-type': 'error',
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/build-and-deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build staging and Deploy to Cloudflare Pages
on:
push:
branches:
- 'main'
- 'master'

concurrency:
group: cloudflare-pages-build-staging
Expand Down Expand Up @@ -38,6 +38,11 @@ jobs:

- name: Build staging
run: npm run build
env:
VITE_PROJECT_NAME: ${{ vars.VITE_PROJECT_NAME }}
VITE_CROWDIN_BRANCH_NAME: ${{ vars.VITE_CROWDIN_BRANCH_NAME }}
VITE_TRANSLATIONS_CDN_URL: ${{ vars.VITE_TRANSLATIONS_CDN_URL }}


- name: Run tests for Eslint
run: npm run test:lint
Expand All @@ -59,10 +64,3 @@ jobs:
echo "------"
preview_url=https://$branch.$projectName.pages.dev
cat log.txt
if grep -q "Deployment complete" log.txt; then
echo "preview_url=$preview_url" >> "$GITHUB_OUTPUT"
echo $preview_url > .pr/PREVIEW_URL
else
echo "Deployment to Cloudflare Pages failed."
exit 1
fi
4 changes: 4 additions & 0 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ jobs:

- name: Build staging
run: npm run build
env:
VITE_PROJECT_NAME: ${{ vars.VITE_PROJECT_NAME }}
VITE_CROWDIN_BRANCH_NAME: ${{ vars.VITE_CROWDIN_BRANCH_NAME }}
VITE_TRANSLATIONS_CDN_URL: ${{ vars.VITE_TRANSLATIONS_CDN_URL }}

- name: Run tests for Eslint
run: npm run test:lint
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, edited]

name: Coveralls
jobs:
build:
name: Reporter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup Node.js
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8
with:
node-version: '20'
- name: Update to latest npm (temporary fix for audit below)
run: npm install --global npm
- name: Install dependencies
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Test
run: npm run test -- --coverage
- name: Coveralls
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
4 changes: 2 additions & 2 deletions .github/workflows/sync-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- name: Sync translations
uses: deriv-com/translations/.github/actions/extract_and_sync_translations@main
with:
PROJECT_NAME: ${{ secrets.VITE_PROJECT_NAME }}
CROWDIN_BRANCH_NAME: ${{ secrets.VITE_CROWDIN_BRANCH_NAME }}
PROJECT_NAME: ${{ vars.VITE_PROJECT_NAME }}
CROWDIN_BRANCH_NAME: ${{ vars.VITE_CROWDIN_BRANCH_NAME }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
Expand Down
18 changes: 9 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"endOfLine": "lf",
"singleQuote": true,
"useTabs": false,
"tabWidth": 4,
"trailingComma": "es5",
"printWidth": 120,
"jsxSingleQuote": true,
"arrowParens": "avoid",
"proseWrap": "preserve"
"endOfLine": "lf",
"singleQuote": true,
"useTabs": false,
"tabWidth": 4,
"trailingComma": "es5",
"printWidth": 120,
"jsxSingleQuote": true,
"arrowParens": "avoid",
"proseWrap": "preserve"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Deriv P2P

[![Coverage Status](https://coveralls.io/repos/github/deriv-com/p2p/badge.svg)](https://coveralls.io/github/deriv-com/p2p)

This is the new version of Deriv P2P web application. This project uses React, TypeScript, and TailwindCSS.

This template was generated using `create-deriv-v2`
Expand Down
8 changes: 6 additions & 2 deletions __mocks__/LocalizeMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ const Localize = ({ i18n_default_text, values }) => {

// Mock for useTranslations hook
const useTranslations = () => ({
localize: jest.fn(text => text),
localize: jest.fn((text, args) => {
return text.replace(/{{(.*?)}}/g, (_, match) => args[match.trim()]);
}),
});

export { Localize, useTranslations };
const localize = jest.fn(text => text);

export { Localize, localize, useTranslations };
41 changes: 41 additions & 0 deletions localstorage-sync.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!doctype html>
<html>
<head>
<title>Deriv</title>
<meta charset="utf-8" />
<meta name="referrer" content="origin" />
<script>
window.addEventListener('message', function (message) {
var allowed_origins = [
'https://deriv.app',
'https://staging.deriv.app',
'https://app.deriv.com',
'https://app.deriv.me',
'https://app.deriv.be',
'https://staging-app.deriv.com',
'https://staging-app.deriv.me',
'https://staging-app.deriv.be',
'https://test-app.deriv.com',
];

if (allowed_origins.includes(message.origin)) {
switch (message.data.key) {
case 'active_loginid': {
if (localStorage.getItem(message.data.key) !== message.data.value) {
localStorage.setItem(message.data.key, message.data.value);
}
break;
}
case 'client.accounts': {
if (localStorage.getItem(message.data.key) !== message.data.value) {
localStorage.setItem(message.data.key, message.data.value);
}
break;
}
}
}
});
</script>
</head>
<body></body>
</html>
Loading

0 comments on commit d1e5a55

Please sign in to comment.