-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
253 changed files
with
32,358 additions
and
194 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Chromatic deploy packages/nami | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- packages/nami/** | ||
push: | ||
paths: | ||
- packages/nami/** | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
chromatic-deployment: | ||
name: Chromatic Nami | ||
if: github.event.pull_request.draft == false | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node.js and install dependencies | ||
uses: ./.github/actions/install | ||
with: | ||
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD_TESTNET }} | ||
|
||
- name: Build | ||
run: yarn workspaces foreach -Rpt -v --from '@lace/nami' run build | ||
|
||
- name: Chromatic packages-nami | ||
uses: ./.github/actions/chromatic | ||
with: | ||
DIR: packages/nami | ||
NAME: packages-nami | ||
TOKEN: ${{ secrets.CHROMATIC_LACE_NAMI_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ result | |
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
yalc.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
apps/browser-extension-wallet/src/assets/icons/browser-view/warning-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
apps/browser-extension-wallet/src/features/nami-migration/Activating.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useEffect } from 'react'; | ||
|
||
import { NamiMigrationUpdatingYourWallet } from '@lace/core'; | ||
import { consumeRemoteApi, RemoteApiPropertyType } from '@cardano-sdk/web-extension'; | ||
import { NamiMigrationAPI, NamiMigrationChannels } from '@lib/scripts/background/nami-migration'; | ||
import { runtime } from 'webextension-polyfill'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { walletRoutePaths as routes } from '@routes/wallet-paths'; | ||
import { useCurrencyStore } from '@providers/currency'; | ||
import { MigrationState } from '@xsy/nami-migration-tool/dist/migrator/migration-state.data'; | ||
import { useTheme } from '@providers/ThemeProvider/context'; | ||
|
||
const namiMigrationRemoteApi = consumeRemoteApi<Pick<NamiMigrationAPI, 'startMigration' | 'checkMigrationStatus'>>( | ||
{ | ||
baseChannel: NamiMigrationChannels.MIGRATION, | ||
properties: { | ||
startMigration: RemoteApiPropertyType.MethodReturningPromise, | ||
checkMigrationStatus: RemoteApiPropertyType.MethodReturningPromise | ||
} | ||
}, | ||
{ | ||
logger: console, | ||
runtime | ||
} | ||
); | ||
|
||
export const Activating = (): JSX.Element => { | ||
const history = useHistory(); | ||
const { setFiatCurrency } = useCurrencyStore(); | ||
const { setTheme } = useTheme(); | ||
|
||
useEffect(() => { | ||
const startMigration = async () => { | ||
const migrationStatus = await namiMigrationRemoteApi.checkMigrationStatus(); | ||
|
||
if (migrationStatus !== MigrationState.InProgress && migrationStatus !== MigrationState.Completed) { | ||
history.push(routes.namiMigration.welcome); | ||
return; | ||
} | ||
|
||
const result = await namiMigrationRemoteApi.startMigration(); | ||
const namiTheme = result.themeColor === 'light' ? 'light' : 'dark'; | ||
|
||
setTheme(namiTheme); | ||
setFiatCurrency(result.currency); | ||
history.push(routes.namiMigration.welcome); | ||
}; | ||
|
||
startMigration(); | ||
}, [setFiatCurrency, history, setTheme]); | ||
|
||
return <NamiMigrationUpdatingYourWallet />; | ||
}; |
11 changes: 11 additions & 0 deletions
11
apps/browser-extension-wallet/src/features/nami-migration/AllDone.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react'; | ||
|
||
import { AllDone as View } from '@lace/core'; | ||
|
||
export const AllDone = (): JSX.Element => ( | ||
<View | ||
onClose={() => { | ||
window.close(); | ||
}} | ||
/> | ||
); |
60 changes: 60 additions & 0 deletions
60
apps/browser-extension-wallet/src/features/nami-migration/Customize.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React, { useEffect } from 'react'; | ||
|
||
import { Customize as View } from '@lace/core'; | ||
import nami from '@assets/videos/nami.mp4'; | ||
import lace from '@assets/videos/lace.mp4'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { walletRoutePaths } from '@routes'; | ||
import { setBackgroundStorage } from '@lib/scripts/background/storage'; | ||
import { useAnalyticsContext } from '@providers'; | ||
import { postHogNamiMigrationActions } from '@providers/AnalyticsProvider/analyticsTracker'; | ||
|
||
export const Customize = (): JSX.Element => { | ||
const history = useHistory(); | ||
const analytics = useAnalyticsContext(); | ||
|
||
useEffect(() => { | ||
analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.CUSTOMIZE_STEP); | ||
}, [analytics]); | ||
|
||
const completeMigrationAndRedirect = async (mode: 'lace' | 'nami') => { | ||
await (mode === 'lace' | ||
? analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.CUSTOMIZE_STEP_LACE_MODE_CLICK) | ||
: analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.CUSTOMIZE_STEP_NAMI_MODE_CLICK)); | ||
await analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.MIGRATION_COMPLETE); | ||
|
||
// Actually complete migration | ||
await setBackgroundStorage({ | ||
namiMigration: { | ||
completed: true, | ||
mode | ||
} | ||
}); | ||
|
||
if (mode === 'lace') { | ||
history.push(walletRoutePaths.assets); | ||
} else { | ||
history.push(walletRoutePaths.namiMigration.allDone); | ||
} | ||
}; | ||
|
||
const onModeChange = (mode: 'lace' | 'nami') => { | ||
if (mode === 'lace') { | ||
analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.CUSTOMIZE_STEP_LACE_TAB_CLICK); | ||
} else { | ||
analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.CUSTOMIZE_STEP_NAMI_TAB_CLICK); | ||
} | ||
}; | ||
|
||
return ( | ||
<View | ||
onChange={onModeChange} | ||
onBack={() => history.goBack()} | ||
onDone={completeMigrationAndRedirect} | ||
videosURL={{ | ||
lace, | ||
nami | ||
}} | ||
/> | ||
); | ||
}; |
36 changes: 36 additions & 0 deletions
36
apps/browser-extension-wallet/src/features/nami-migration/NamiMigration.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useEffect } from 'react'; | ||
import { walletRoutePaths } from '@routes'; | ||
import { Route, Switch } from 'react-router-dom'; | ||
import { Activating } from './Activating'; | ||
import { Welcome } from './Welcome'; | ||
import { Customize } from './Customize'; | ||
import { AllDone } from './AllDone'; | ||
import { WalletSetupLayout } from '@views/browser/components'; | ||
import { Portal } from '@views/browser/features/wallet-setup/components/Portal'; | ||
import { useAnalyticsContext } from '@providers'; | ||
import { postHogNamiMigrationActions } from '@providers/AnalyticsProvider/analyticsTracker'; | ||
|
||
const urlPath = walletRoutePaths.namiMigration; | ||
|
||
export const NamiMigration = (): JSX.Element => { | ||
const analytics = useAnalyticsContext(); | ||
|
||
useEffect(() => { | ||
analytics.sendEventToPostHog(postHogNamiMigrationActions.onboarding.OPEN); | ||
}, [analytics]); | ||
|
||
return ( | ||
<Portal> | ||
<WalletSetupLayout> | ||
<Switch> | ||
<> | ||
<Route path={urlPath.activating} component={Activating} /> | ||
<Route path={urlPath.welcome} component={Welcome} /> | ||
<Route path={urlPath.customize} component={Customize} /> | ||
<Route path={urlPath.allDone} component={AllDone} /> | ||
</> | ||
</Switch> | ||
</WalletSetupLayout> | ||
</Portal> | ||
); | ||
}; |
Oops, something went wrong.