WA-238 Using NoRights component on safe route layout

This commit is contained in:
apanizo 2018-05-22 10:48:38 +02:00
parent 26c4d8ffda
commit bb3c5127f6
3 changed files with 53 additions and 5 deletions

View File

@ -0,0 +1,31 @@
// @flow
import * as React from 'react'
import Bold from '~/components/layout/Bold'
import Button from '~/components/layout/Button'
import Link from '~/components/layout/Link'
import Col from '~/components/layout/Col'
import Row from '~/components/layout/Row'
import Paragraph from '~/components/layout/Paragraph/index'
import { SAFELIST_ADDRESS } from '~/routes/routes'
const NoRights = () => (
<Row>
<Col xs={12} center="xs" sm={10} smOffset={2} start="sm" margin="md">
<Paragraph size="lg">
<Bold>You do not have rights to operate with this safe. Pleave visit the Safe List.</Bold>
</Paragraph>
</Col>
<Col xs={12} center="xs" sm={10} smOffset={2} start="sm" margin="md">
<Button
component={Link}
to={SAFELIST_ADDRESS}
variant="raised"
color="primary"
>
Safe List
</Button>
</Col>
</Row>
)
export default NoRights

View File

@ -0,0 +1,17 @@
// @flow
import { storiesOf } from '@storybook/react'
import * as React from 'react'
import styles from '~/components/layout/PageFrame/index.scss'
import Component from './index.jsx'
const FrameDecorator = story => (
<div className={styles.frame}>
{ story() }
</div>
)
storiesOf('Components', module)
.addDecorator(FrameDecorator)
.add('NoRights', () => (
<Component />
))

View File

@ -3,6 +3,7 @@ import * as React from 'react'
import { connect } from 'react-redux'
import Page from '~/components/layout/Page'
import Layout from '~/routes/safe/component/Layout'
import NoRights from '~/routes/safe/component/NoRights'
import selector, { type SelectorProps } from './selector'
import actions, { type Actions } from './actions'
@ -39,11 +40,10 @@ class SafeView extends React.PureComponent<Props> {
return (
<Page>
{ granted && <Layout
balance={balance}
provider={provider}
safe={safe}
/> }
{ granted
? <Layout balance={balance} provider={provider} safe={safe} />
: <NoRights />
}
</Page>
)
}