Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll fixes, Revert "UI for Reset Crypto Wallets feature" #127

Merged
merged 1 commit into from Feb 28, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -41,21 +41,6 @@
"passWarningOne": {
"message": "This password protects your private key. Nobody can reset it if you forget it, not even Brave!"
},
"resetButtonText": {
"message": "Erase & Reset"
},
"resetConfirmationPhrase": {
"message": "delete my crypto"
},
"resetCryptoWallets": {
"message": "Reset Crypto Wallets"
},
"resetDisclaimer": {
"message": "This will delete all of your Crypto Wallets data. Your crypto will be destroyed unless you have saved the recovery words for this account. This action cannot be undone."
},
"resetPlaceholder": {
"message": "Type \"delete my crypto\" to continue."
},
"restore": {
"message": "Restore"
},
@@ -21,6 +21,14 @@ const BraveHome = class BraveHome extends Home {
this.props.setHardwareConnect(false)
this.props.history.push(CONNECT_HARDWARE_ROUTE)
}

const appContent = document.querySelector('#app-content')
const mainContainer = document.querySelector('.main-container')

if (appContent && mainContainer) {
appContent.setAttribute('style', 'overflow-y: hidden')
mainContainer.setAttribute('style', 'overflow-y: scroll')
}
}
}

This file was deleted.

@@ -1,20 +1,6 @@
import React from 'react'
import Button from '@material-ui/core/Button'
import TextField from '../../../../../ui/app/components/ui/text-field'
import UnlockPage from '../../../../../ui/app/pages/unlock-page/unlock-page.component'

module.exports = class BraveUnlockPage extends UnlockPage {
constructor (props) {
super(props)
this.state = {
...this.state,
resetErr: false,
canReset: false,
isResetting: false,
confirmationPhrase: '',
}
}

componentDidMount () {
const {
isInitialized,
@@ -25,159 +11,5 @@ module.exports = class BraveUnlockPage extends UnlockPage {
if (isInitialized && !completedOnboarding) {
setCompletedOnboarding()
}

window.addEventListener('beforeunload', (_e) => {
if (this.state.isResetting) {
chrome.braveWallet.resetWallet()
}
})
}

onResetPrompt = () => {
this.setState({ isResetting: true })
}

handleReset = (event) => {
event.preventDefault()
event.stopPropagation()
chrome.tabs.getCurrent(({ id }) => {
chrome.tabs.remove(id, () => {})
})
}

cancelReset = () => {
this.setState({ isResetting: false })
}

handleInputUpdate = ({ target }) => {
const confirmationPhrase = target.value
const canReset = confirmationPhrase === this.context.t('resetConfirmationPhrase')
this.setState({ canReset, confirmationPhrase })
}

renderResetView () {
const { t } = this.context
const { canReset, confirmationPhrase } = this.state

return (
<div>
<span className="reset-title">
{ t('resetCryptoWallets') }
</span>
<div className="reset-disclaimer">
<p>{ t('resetDisclaimer') }</p>
</div>
<div className="reset-form">
<form
className="unlock-page__form"
onSubmit={this.handleReset}
>
<TextField
id="reset-confirmation"
label={t('resetPlaceholder')}
type="text"
value={confirmationPhrase}
onChange={event => this.handleInputUpdate(event)}
error={''}
autoFocus
material
fullWidth
/>
</form>
<Button
type="submit"
className="reset-button"
disabled={!canReset}
fullWidth
variant="raised"
size="large"
onClick={this.handleReset}
disableRipple
>
{ this.context.t('resetButtonText') }
</Button>
<div className="reset-cancel">
<span onClick={this.cancelReset}>
{ t('cancel') }
</span>
</div>
</div>
</div>
)
}

renderUnlockView () {
const { t } = this.context
const { onImport, onRestore } = this.props
const { password, error } = this.state
const resetSupported = chrome.braveWallet.hasOwnProperty('resetWallet')

return (
<div>
<h1 className="unlock-page__title">
{ t('welcomeBack') }
</h1>
<div>{ t('unlockMessage') }</div>
<form
className="unlock-page__form"
onSubmit={this.handleSubmit}
>
<TextField
id="password"
label={t('password')}
type="password"
value={password}
onChange={event => this.handleInputChange(event)}
error={error}
autoFocus
autoComplete="current-password"
material
fullWidth
/>
</form>
{ this.renderSubmitButton() }
<div className="unlock-page__links">
<div
className="unlock-page__link"
onClick={() => onRestore()}
>
{ t('restoreFromSeed') }
</div>
<div
className="unlock-page__link unlock-page__link--import"
onClick={() => onImport()}
>
{ t('importUsingSeed') }
</div>
{
resetSupported
? <div
className="unlock-page__link unlock-page__link--import"
onClick={this.onResetPrompt}
>
{ t('resetCryptoWallets') }
</div>
: null
}
</div>
</div>
)
}

render () {
const isResetting = this.state.isResetting
const className = `unlock-page ${isResetting ? 'reset': ''}`

return (
<div className="unlock-page__container">
<div className={className}>
{
isResetting
? this.renderResetView()
: this.renderUnlockView()
}
</div>
</div>
)
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.