Skip to content

Commit

Permalink
Merge branch 'feat/locales-fr' of github.com:jzu/core-extension into …
Browse files Browse the repository at this point in the history
…feat/locales-fr
  • Loading branch information
jzu committed Aug 10, 2024
2 parents ae90eee + faf1111 commit 9dc0172
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 53 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/e2e_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ on:
types: [opened, reopened, 'synchronize', 'ready_for_review']
jobs:
build:
runs-on: ubuntu-latest-16-cores
runs-on: ubuntu-latest-16-cores-core-extension
if: ${{ !github.event.pull_request.draft }}
environment: alpha
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Checkout extension
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Create .npmrc
run: echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}' >> .npmrc
- name: Create env file
Expand Down Expand Up @@ -57,6 +57,9 @@ jobs:
- name: Remove onboarding video
run: |
rm -fv ./dist/images/core-ext-hero-hq.webm
- name: Add extension key to manifest file
run: |
echo $(cat ./dist/manifest.json | jq '.key = "${{ secrets.EXTENSION_PUBLIC_KEY }}"') > ./dist/manifest.json
- name: Generate a zip
run: yarn zip
- name: Output extension file version before renaming
Expand All @@ -71,9 +74,9 @@ jobs:
name: extension
path: extension.zip
e2e:
runs-on: ubuntu-latest-16-cores-core-extension
needs: build
name: Run E2E Smoke Tests
runs-on: ubuntu-latest-16-cores
environment: e2e
env:
RUNNER: CI
Expand Down
2 changes: 1 addition & 1 deletion src/background/services/balances/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export interface Balances {
};
}

export const CLOUDFLARE_IPFS_URL = 'https://cloudflare-ipfs.com';
export const IPFS_URL = 'https://ipfs.io';

export interface CachedBalancesInfo {
totalBalance?: TotalBalance;
Expand Down
13 changes: 11 additions & 2 deletions src/background/services/network/NetworkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ export class NetworkService implements OnLock, OnStorageReady {
// At this point the chainlist from Glacier should already be available,
// as it is fetched when service worker starts (so before extension is unlocked).
// If it isn't available yet, we'll use the list cached in the storage.
const chainlist = await Promise.race([

const chainlist = await Promise.any([
this._chainListFetched.promisify(),
this._getCachedChainList(),
]);
Expand Down Expand Up @@ -358,7 +359,15 @@ export class NetworkService implements OnLock, OnStorageReady {
}

private async _getCachedChainList(): Promise<ChainList | undefined> {
return this.storageService.load<ChainList>(NETWORK_LIST_STORAGE_KEY);
const networkList = await this.storageService.load<ChainList>(
NETWORK_LIST_STORAGE_KEY
);

if (!networkList) {
throw new Error('No networks cached');
}

return networkList;
}

private _getPchainNetwork(isTestnet: boolean): Network {
Expand Down
5 changes: 4 additions & 1 deletion src/localization/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
"Connect the Ledger device to your computer.": "Connect the Ledger device to your computer.",
"Connect your Ledger": "Connect your Ledger",
"Connect your Ledger device and open the <bold>Avalanche App</bold> to approve this transaction": "Connect your Ledger device and open the <bold>Avalanche App</bold> to approve this transaction",
"Connect your Ledger device and open the Avalanche App to approve this transaction": "Connect your Ledger device and open the Avalanche App to approve this transaction",
"Connect your Wallet": "Connect your Wallet",
"Connect your wallet via the <br /> \"Connect Wallet\" button on the site": "Connect your wallet via the <br /> \"Connect Wallet\" button on the site",
"Connected": "Connected",
Expand Down Expand Up @@ -212,6 +211,7 @@
"Core estimates the maximum gas (maxFeePerGas) a transaction could consume based on network conditions. This transaction will likely consume less gas than estimated.": "Core estimates the maximum gas (maxFeePerGas) a transaction could consume based on network conditions. This transaction will likely consume less gas than estimated.",
"Core functionality may be unstable with custom RPC URLs.": "Core functionality may be unstable with custom RPC URLs.",
"Core is committed to protecting your privacy. We will <b>never</b> sell or share your data. If you wish, you can disable this at any time in the settings menu.": "Core is committed to protecting your privacy. We will <b>never</b> sell or share your data. If you wish, you can disable this at any time in the settings menu.",
"Core is no longer connected to your Ledger device. Reconnect your Ledger to continue.": "Core is no longer connected to your Ledger device. Reconnect your Ledger to continue.",
"Core supports Bitcoin via Fireblocks with a few extra steps. If you choose to skip, you will not be able to bridge or use the Bitcoin Network.": "Core supports Bitcoin via Fireblocks with a few extra steps. If you choose to skip, you will not be able to bridge or use the Bitcoin Network.",
"Core will <b>never</b> sell or share data.": "Core will <b>never</b> sell or share data.",
"Core would like to gather data using local storage and similar technologies to help us understand how our users interact with Core.": "Core would like to gather data using local storage and similar technologies to help us understand how our users interact with Core.",
Expand Down Expand Up @@ -647,6 +647,7 @@
"Recents": "Recents",
"Recipient": "Recipient",
"Recipients": "Recipients",
"Reconnect": "Reconnect",
"Recovery Methods": "Recovery Methods",
"Recovery Phrase": "Recovery Phrase",
"Recovery Phrase {{number}}": "Recovery Phrase {{number}}",
Expand Down Expand Up @@ -768,6 +769,7 @@
"Subnet ID": "Subnet ID",
"Success!": "Success!",
"Successfully imported the keystore file.": "Successfully imported the keystore file.",
"Successfully reconnected!": "Successfully reconnected!",
"Successfully swapped {{srcAmount}} {{srcToken}} to {{destAmount}} {{destToken}}": "Successfully swapped {{srcAmount}} {{srcToken}} to {{destAmount}} {{destToken}}",
"Suggested slippage – your transaction will fail if the price changes unfavorably more than this percentage": "Suggested slippage – your transaction will fail if the price changes unfavorably more than this percentage",
"Supplied": "Supplied",
Expand Down Expand Up @@ -883,6 +885,7 @@
"Turkish": "Turkish",
"URI": "URI",
"Unable to connect. View the troubleshoot guide <linkText>here</linkText>": "Unable to connect. View the troubleshoot guide <linkText>here</linkText>",
"Unable to connect?": "Unable to connect?",
"Unable to set TOTP configuration": "Unable to set TOTP configuration",
"Unauthorized": "Unauthorized",
"Unavailable": "Unavailable",
Expand Down
21 changes: 20 additions & 1 deletion src/pages/Ledger/LedgerDisconnected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@ import {
Box,
Stack,
CircularProgress,
Button,
} from '@avalabs/core-k2-components';
import { Trans } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import { useCallback } from 'react';
import { tabs } from 'webextension-polyfill';

export const LedgerDisconnected = () => {
const { t } = useTranslation();
const openTroubleshootingPopup = useCallback(() => {
// Open in a full screen tab to avoid popup hell
tabs.create({
url: '/fullscreen.html#/ledger/troubleshooting',
});
}, []);

return (
<>
<Typography
Expand All @@ -27,6 +38,14 @@ export const LedgerDisconnected = () => {
<Stack sx={{ mt: '48px', mb: '16px', alignItems: 'center' }}>
<CircularProgress size={48} />
</Stack>
<Button
variant="text"
color="primary"
onClick={openTroubleshootingPopup}
sx={{ mt: 2 }}
>
{t('Unable to connect?')}
</Button>
</>
);
};
70 changes: 70 additions & 0 deletions src/pages/Ledger/LedgerTroubleshooting.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { useTranslation } from 'react-i18next';
import { Button, Stack, Typography } from '@avalabs/core-k2-components';

import { Overlay } from '@src/components/common/Overlay';
import { useLedgerContext } from '@src/contexts/LedgerProvider';
import { useState } from 'react';

export const LedgerTroubleshooting = () => {
const { t } = useTranslation();
const { popDeviceSelection } = useLedgerContext();

const [isConnected, setIsConnected] = useState(false);

return (
<Overlay isBackgroundFilled>
<Stack
sx={{
width: 375,
p: 3,
gap: 2,
alignSelf: 'center',
backgroundColor: 'grey.900',
borderRadius: 1,
textAlign: 'center',
}}
>
{isConnected && (
<>
<Typography variant="h5">
{t('Successfully reconnected!')}
</Typography>
<Button
color="primary"
size="large"
sx={{ mt: 3 }}
onClick={window.close}
>
{t('Close')}
</Button>
</>
)}
{!isConnected && (
<>
<Typography variant="h5">{t('Ledger Disconnected')}</Typography>
<Typography variant="body2">
{t(
'Core is no longer connected to your Ledger device. Reconnect your Ledger to continue.'
)}
</Typography>
<Button
color="primary"
size="large"
onClick={async () => {
try {
await popDeviceSelection();
setIsConnected(true);
} catch {
setIsConnected(false);
}
}}
sx={{ mt: 3 }}
>
{t('Reconnect')}
</Button>
</>
)}
</Stack>
</Overlay>
);
};
39 changes: 0 additions & 39 deletions src/pages/SignTransaction/components/LedgerDisconnectDialog.tsx

This file was deleted.

11 changes: 11 additions & 0 deletions src/popup/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,19 @@ const DefiProtocolDetails = lazy(() => {
}));
});

const LedgerTroubleshootingPopup = lazy(() => {
return import('../pages/Ledger/LedgerTroubleshooting').then((m) => ({
default: m.LedgerTroubleshooting,
}));
});

export const AppRoutes = () => (
<Switch>
<Route path="/ledger/troubleshooting">
<Suspense fallback={<CircularProgress />}>
<LedgerTroubleshootingPopup />
</Suspense>
</Route>
<Route path="/token/add">
<Suspense fallback={<CircularProgress />}>
<AddToken />
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ipsfResolverWithFallback.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ipfsResolver } from '@avalabs/core-utils-sdk';
import { CLOUDFLARE_IPFS_URL } from '@src/background/services/balances/models';
import { IPFS_URL } from '@src/background/services/balances/models';
export function ipfsResolverWithFallback(
sourceUrl: string | undefined,
desiredGatewayPrefix: string = CLOUDFLARE_IPFS_URL
desiredGatewayPrefix: string = IPFS_URL
) {
if (!sourceUrl) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"sourceMap": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"lib": ["es2015", "dom"],
"lib": ["es2015", "es2021", "dom"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowSyntheticDefaultImports": true,
Expand Down

0 comments on commit 9dc0172

Please sign in to comment.