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

Tokens: refactor the side panel as a function component #1046

Merged
merged 5 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions apps/token-manager/app/src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from 'react'
import React, { useEffect } from 'react'
import PropTypes from 'prop-types'
import BN from 'bn.js'
import {
Button,
GU,
Header,
IconPlus,
SidePanel,
SyncIndicator,
Tag,
textStyle,
useLayout,
useTheme,
useThemeMode,
} from '@aragon/ui'
import { useAragonApi } from '@aragon/api-react'
import { IdentityProvider } from './components/IdentityManager/IdentityManager'
import TokenPanelContent from './components/Panels/TokenPanelContent'
import UpdateTokenPanel from './components/UpdateTokenPanel/UpdateTokenPanel'
import EmptyState from './screens/EmptyState'
import Holders from './screens/Holders'
import { addressesEqual } from './web3-utils'
Expand Down Expand Up @@ -179,28 +179,21 @@ class App extends React.PureComponent {
</React.Fragment>
)}

<SidePanel
title={
assignTokensConfig.mode === 'assign'
? 'Add tokens'
: 'Remove tokens'
}
opened={sidepanelOpened}
onClose={this.handleSidepanelClose}
onTransitionEnd={this.handleSidepanelTransitionEnd}
>
{appStateReady && (
<TokenPanelContent
opened={sidepanelOpened}
tokenDecimals={numData.tokenDecimals}
tokenDecimalsBase={tokenDecimalsBase}
onUpdateTokens={this.handleUpdateTokens}
getHolderBalance={this.getHolderBalance}
maxAccountTokens={maxAccountTokens}
{...assignTokensConfig}
/>
)}
</SidePanel>
{appStateReady && (
<UpdateTokenPanel
getHolderBalance={this.getHolderBalance}
holderAddress={assignTokensConfig.holderAddress}
maxAccountTokens={maxAccountTokens}
mode={assignTokensConfig.mode}
onClose={this.handleSidepanelClose}
onTransitionEnd={this.handleSidepanelTransitionEnd}
onUpdateTokens={this.handleUpdateTokens}
opened={sidepanelOpened}
tokenDecimals={numData.tokenDecimals}
tokenDecimalsBase={tokenDecimalsBase}
tokenSymbol={tokenSymbol}
/>
)}
</IdentityProvider>
)
}
Expand All @@ -211,5 +204,10 @@ export default () => {
const theme = useTheme()
const { layoutName } = useLayout()

const themeMode = useThemeMode()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove this for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops this was for a local demo, it shouldn’t have been committed :o

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 03b2aaa

useEffect(() => {
// themeMode.set('dark')
}, [themeMode])

return <App api={api} layoutName={layoutName} theme={theme} {...appState} />
}
267 changes: 0 additions & 267 deletions apps/token-manager/app/src/components/Panels/TokenPanelContent.js

This file was deleted.

Loading