Skip to content

Commit

Permalink
Get recovery onto a custom group
Browse files Browse the repository at this point in the history
- Renamed it to be less scary
- Added better icon
- Moved to a custom group "recovery"
- Feature is now disabled by default for this login type
  • Loading branch information
elboletaire committed Mar 8, 2024
1 parent c03c164 commit 0a9cc9a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/constants/rainbow.ts
Expand Up @@ -23,6 +23,7 @@ import {
zora,
} from 'wagmi/chains'
import { publicProvider } from 'wagmi/providers/public'
import i18n from '~i18n'

export const { chains, publicClient } = configureChains(
[
Expand Down Expand Up @@ -63,7 +64,6 @@ const featuredConnectors = () => {
rainbowWallet({ projectId, chains }),
coinbaseWallet({ chains, appName }),
walletConnectWallet({ chains, projectId }),
privateKeyWallet({ chains }),
],
}

Expand Down Expand Up @@ -100,11 +100,21 @@ const featuredConnectors = () => {
oAuthServiceProvider: 'facebook',
},
}),
privateKeyWallet({ chains }),
],
}

const connectors: { [key: string]: WalletGroup } = { web2, web3 }
const recovery: WalletGroup = {
groupName: i18n.t('rainbow.group.recovery'),
wallets: [
privateKeyWallet({
name: i18n.t('rainbow.recovery'),
iconUrl: 'https://www.svgrepo.com/show/525392/key-minimalistic-square-3.svg',
chains,
}),
],
}

const connectors: { [key: string]: WalletGroup } = { web2, web3, recovery }
const wallets: WalletList = []
for (const connector of import.meta.env.features.login) {
wallets.push(connectors[connector])
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/ca.json
Expand Up @@ -520,6 +520,12 @@
"accuracy": "PrecisiΓ³ dels Saldos de Cens AnΓ²nims: "
}
},
"rainbow": {
"group": {
"recovery": "RecuperaciΓ³"
},
"recovery": "Recuperar compte"
},
"retry": "Reintenta",
"roadmap": {
"census_description": "Crear un cens descentralitzat fora de la cadena i compatible amb zk a partir d'una instantΓ nia de blocs d'Ethereum, amb verificaciΓ³ a la cadena.",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/en.json
Expand Up @@ -511,6 +511,12 @@
"accuracy": "Anonymous Census Balance Accuracy: "
}
},
"rainbow": {
"group": {
"recovery": "Recovery"
},
"recovery": "Account recovery"
},
"retry": "Retry",
"roadmap": {
"census_description": "Create a trust-less off-chain zk-friendly census from an Ethereum block snapshot, with on-chain verification.",
Expand Down
6 changes: 6 additions & 0 deletions src/i18n/locales/es.json
Expand Up @@ -520,6 +520,12 @@
"accuracy": "PrecisiΓ³n de los Saldos de Censo AnΓ³nimo: "
}
},
"rainbow": {
"group": {
"recovery": "RecuperaciΓ³n"
},
"recovery": "Recuperar cuenta"
},
"retry": "Reintentar",
"roadmap": {
"census_description": "Crear un censo descentralizado fuera de la cadena y compatible con zk a partir de una instantΓ‘nea de bloques de Ethereum, con verificaciΓ³n en cadena.",
Expand Down
7 changes: 7 additions & 0 deletions vite/features.ts
Expand Up @@ -23,6 +23,13 @@ const features = () => {
if (!features.languages.length) {
features.languages = ['en']
}
// verify login options are valid
const validLogins = ['web2', 'web3', 'recovery']
features.login.forEach((login) => {
if (!validLogins.includes(login)) {
throw new Error(`Invalid login option: ${login}`)
}
})
// We need pure booleans in order to ensure rollup tree-shakes non enabled features.
// Using functions like `.includes()` would prevent such tree-shaking, resulting in a bigger bundle.
features._census = {
Expand Down

3 comments on commit 0a9cc9a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://onvote-stg.netlify.app as production
πŸš€ Deployed on https://65eb0568bee8ec8957fca012--onvote-stg.netlify.app

Please sign in to comment.