Skip to content

Commit

Permalink
feat: fingerprint changed
Browse files Browse the repository at this point in the history
  • Loading branch information
nachomazzara committed Feb 25, 2019
1 parent b9341f9 commit a71288c
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 24 deletions.
2 changes: 1 addition & 1 deletion shared/bid.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function isAssetBid(bid, assetId, assetType) {
}

export function fingerprintHasChanged(bid) {
return bid.status === LISTING_STATUS.fingerprintChanged
return bid && bid.status === LISTING_STATUS.fingerprintChanged
}

export function isActive(bid) {
Expand Down
2 changes: 1 addition & 1 deletion src/Translation/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"expiration": "Expiration",
"expiration_placeholder": "Expiration date for this publication",
"fingerprint_changed":
"This {asset_name} has been modified. You can only cancel the bid.",
"This {asset_name} has been modified. Plase update or cancel the bid.",
"insufficient_funds":
"The bidder has insufficient funds to pay for the bid",
"list_asset": "Place a bid for the {asset_name}",
Expand Down
5 changes: 3 additions & 2 deletions src/Translation/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@
},
"expiration": "Vencimiento",
"expiration_placeholder": "Fecha de expiración de esta publicación.",
"fingerprint_changed": "Este {asset_name} ha sido modificado. ",
"fingerprint_changed":
"Este {asset_name} ha sido modificado. Por favor modifica o cancela la oferta.",
"insufficient_funds":
"El ofertante no tiene fondos suficientes para pagar la oferta.",
"list_asset": "Haz una oferta por el {asset_name}",
"not_enough": "No tienes suficiente MANA en tu cuenta",
"please_authorize":
"Debe ir a {settings_link} y autorizar el contrato de la Oferta para utilizar MANA en su nombre antes de poder realizar una oferta.",
"Debe ir a {settings_link} y autorizar el contrato de la oferta para utilizar MANA en su nombre antes de poder realizar una oferta.",
"price_placeholder": "Precio en MANA para este {asset_name}.",
"set_asset_price":
"Establecer un precio y una fecha de vencimiento para {asset_name}.",
Expand Down
3 changes: 2 additions & 1 deletion src/Translation/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
},
"expiration": "Expiration",
"expiration_placeholder": "Date d'expiration pour cette publication",
"fingerprint_changed": "Ce {asset_name} a été modifié. ",
"fingerprint_changed":
"Ce {asset_name} a été modifié. Veuillez mettre à jour ou annuler l'offre.",
"insufficient_funds":
"Le soumissionnaire n'a pas suffisamment de fonds pour payer pour la soumission",
"list_asset": "Placer une offre pour le {asset_name}",
Expand Down
3 changes: 2 additions & 1 deletion src/Translation/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"expiration": "有効期限",
"expiration_placeholder": "この出版物の有効期限",
"fingerprint_changed": "この{asset_name}は修正されました。",
"fingerprint_changed":
"この{asset_name}は修正されました。入札を更新またはキャンセルしてください。",
"insufficient_funds": "入札者が入札のために支払うには資金が足りない",
"list_asset": "{asset_name}に入札する",
"not_enough": "あなたのアカウントに十分なMANAがありません",
Expand Down
3 changes: 2 additions & 1 deletion src/Translation/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"expiration": "만료",
"expiration_placeholder": "이 발행물의 만료일",
"fingerprint_changed": "이 {asset_name}가 수정되었습니다. ",
"fingerprint_changed":
"이 {asset_name}가 수정되었습니다. 입찰가를 업데이트하거나 취소하십시오.",
"insufficient_funds": "입찰자가 입찰 비용을 지불하기에 부족합니다.",
"list_asset": "{asset_name}에 입찰하기",
"not_enough": "계정에 MANA가 충분하지 않습니다.",
Expand Down
2 changes: 1 addition & 1 deletion src/Translation/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"expiration": "呼气",
"expiration_placeholder": "本出版物的截止日期",
"fingerprint_changed": "此{asset_name}已被修改。",
"fingerprint_changed": "此{asset_name}已被修改。 请更新或取消出价。",
"insufficient_funds": "投标人没有足够的资金来支付投标费用",
"list_asset": "对{asset_name}进行出价",
"not_enough": "您的帐户中没有足够的MANA",
Expand Down
3 changes: 1 addition & 2 deletions webapp/src/components/Bid/Bid.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ export default class Bid extends React.PureComponent {
: t('global.accept')}
</Button>
{!isOwner &&
!hasSameSellerAndBidder &&
!fingerprintChanged && (
!hasSameSellerAndBidder && (
<Button
className="primary"
onClick={preventDefault(onUpdate)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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 { isActive } from 'shared/bid'
import BidAssetForm from '../BidAssetForm'
import { authorizationType, bidType, walletType } from 'components/types'
import Estate from 'components/Estate'
Expand All @@ -29,7 +29,7 @@ export default class BidEstatePage extends React.PureComponent {
render() {
const { id, bid, isTxIdle, onBid, onCancel, isAllowed, wallet } = this.props

const isBidOpen = isOpen(bid)
const isBidActive = isActive(bid)

return (
<Estate id={id} ownerNotAllowed>
Expand Down Expand Up @@ -60,7 +60,7 @@ export default class BidEstatePage extends React.PureComponent {
title={
<T
id={
isBidOpen
isBidActive
? 'asset_bid.update_asset'
: 'asset_bid.list_asset'
}
Expand All @@ -70,7 +70,7 @@ export default class BidEstatePage extends React.PureComponent {
subtitle={
<T
id={
isBidOpen
isBidActive
? 'asset_bid.set_new_asset_price'
: 'asset_bid.set_asset_price'
}
Expand All @@ -82,7 +82,7 @@ export default class BidEstatePage extends React.PureComponent {
<BidAssetForm
asset={estate}
assetName={t('name.estate')}
bid={isBidOpen ? bid : null}
bid={isBidActive ? bid : null}
isTxIdle={isTxIdle}
onBid={onBid}
onCancel={onCancel}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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 { isActive } from 'shared/bid'
import { splitCoordinate } from 'shared/coordinates'
import BidAssetForm from '../BidAssetForm'
import { authorizationType, bidType, walletType } from 'components/types'
Expand All @@ -32,7 +32,7 @@ export default class BidParcelPage extends React.PureComponent {
const { id, bid, isTxIdle, onBid, onCancel, isAllowed, wallet } = this.props

const [x, y] = splitCoordinate(id)
const isBidOpen = isOpen(bid)
const isBidActive = isActive(bid)

return (
<Parcel x={x} y={y} ownerNotAllowed>
Expand Down Expand Up @@ -64,7 +64,7 @@ export default class BidParcelPage extends React.PureComponent {
title={
<T
id={
isBidOpen
isBidActive
? 'asset_bid.update_asset'
: 'asset_bid.list_asset'
}
Expand All @@ -74,7 +74,7 @@ export default class BidParcelPage extends React.PureComponent {
subtitle={
<T
id={
isBidOpen
isBidActive
? 'asset_bid.set_new_asset_price'
: 'asset_bid.set_asset_price'
}
Expand All @@ -88,7 +88,7 @@ export default class BidParcelPage extends React.PureComponent {
<BidAssetForm
asset={parcel}
assetName={t('name.parcel')}
bid={isBidOpen ? bid : null}
bid={isBidActive ? bid : null}
isTxIdle={isTxIdle}
onBid={onBid}
onCancel={onCancel}
Expand Down
12 changes: 9 additions & 3 deletions webapp/src/components/ParcelDetailPage/ParcelDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
import { getOpenPublication, ASSET_TYPES } from 'shared/asset'
import { getDistrict } from 'shared/district'
import { hasTags } from 'shared/parcel'
import { isOpen, isActive } from 'shared/listing'
import ParcelOwner from './ParcelOwner'
import ParcelActions from './ParcelActions'
import ParcelDescription from './ParcelDescription'
Expand Down Expand Up @@ -135,9 +136,14 @@ export default class ParcelDetailPage extends React.PureComponent {
<Grid.Row>
<Grid.Column>
<h3>{t('asset_detail.bid.title')}</h3>
{bids.map(bid => (
<Bid key={bid.id} bid={bid} isOwner={isOwner} />
))}
{bids
.filter(
bid =>
(isOwner && isOpen(bid)) || (!isOwner && isActive(bid))
)
.map(bid => (
<Bid key={bid.id} bid={bid} isOwner={isOwner} />
))}
</Grid.Column>
</Grid.Row>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/modules/bid/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getWalletBidsByAsset = (state, asset, assetType) => {

if (
isAssetBid(bid, asset.id, assetType) &&
bid.status === LISTING_STATUS.open &&
isActive(bid) &&
isBidderOrSeller
) {
return [...bids, bid]
Expand Down

0 comments on commit a71288c

Please sign in to comment.