-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathBidEstatePage.js
102 lines (97 loc) · 3.17 KB
/
BidEstatePage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import React from 'react'
import PropTypes from 'prop-types'
import { Link } from 'react-router-dom'
import { Container, Message } from 'semantic-ui-react'
import { t, T } from '@dapps/modules/translation/utils'
import { locations } from 'locations'
import { isOpen } from 'shared/listing'
import BidAssetForm from '../BidAssetForm'
import { authorizationType, bidType, walletType } from 'components/types'
import Estate from 'components/Estate'
import EstateName from 'components/EstateName'
import TxStatus from 'components/TxStatus'
import EstateModal from 'components/EditEstatePage/EditEstateMetadata/EstateModal'
export default class BidEstatePage extends React.PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
bid: bidType,
authorization: authorizationType,
isLoading: PropTypes.bool.isRequired,
isTxIdle: PropTypes.bool.isRequired,
onBid: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired,
isAllowed: PropTypes.bool.isRequired,
wallet: walletType
}
render() {
const { id, bid, isTxIdle, onBid, onCancel, isAllowed, wallet } = this.props
const isBidOpen = isOpen(bid)
return (
<Estate id={id} ownerNotAllowed>
{estate => (
<div className="PublishPage">
{!isAllowed ? (
<Container text>
<Message
warning
icon="warning sign"
header={t('global.unauthorized')}
content={
<T
id="asset_bid.please_authorize"
values={{
settings_link: (
<Link to={locations.settings()}>Settings</Link>
),
asset_name: t('name.estate')
}}
/>
}
/>
</Container>
) : null}
<EstateModal
parcels={estate.data.parcels}
title={
<T
id={
isBidOpen
? 'asset_bid.update_asset'
: 'asset_bid.list_asset'
}
values={{ asset_name: t('name.estate') }}
/>
}
subtitle={
<T
id={
isBidOpen
? 'asset_bid.set_new_asset_price'
: 'asset_bid.set_asset_price'
}
values={{ asset_name: estate.data.name }}
/>
}
hasCustomFooter
>
<BidAssetForm
asset={estate}
assetName={t('name.estate')}
bid={isBidOpen ? bid : null}
isTxIdle={isTxIdle}
onBid={onBid}
onCancel={onCancel}
isDisabled={!isAllowed}
balance={wallet.mana}
/>
<TxStatus.Asset
asset={estate}
name={<EstateName estate={estate} />}
/>
</EstateModal>
</div>
)}
</Estate>
)
}
}