Fix #87 -- reverse direction and also fix counter offer messages
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
9d4596c50a
commit
f2fabcfd20
@ -50,18 +50,18 @@ const Trade = ({table}) => {
|
||||
|
||||
const createTransfer = useCallback(resource => {
|
||||
return <div key={resource} className="Transfer">
|
||||
<Resource
|
||||
onClick={() => transfer(resource, 'get')}
|
||||
label={true}
|
||||
type={resource}
|
||||
count={gets[resource]}/>
|
||||
<div className="Direction">{ gets[resource] === gives[resource] ? '' : (gets[resource] > gives[resource] ? <ArrowDownwardIcon/> : <ArrowUpwardIcon/>)}</div>
|
||||
<Resource
|
||||
onClick={() => transfer(resource, 'give')}
|
||||
label={true}
|
||||
type={resource}
|
||||
count={gives[resource]}/>
|
||||
<div className="Direction">{ gets[resource] === gives[resource] ? '' : (gets[resource] > gives[resource] ? <ArrowDownwardIcon/> : <ArrowUpwardIcon/>)}</div>
|
||||
<Resource
|
||||
onClick={() => transfer(resource, 'get')}
|
||||
label={true}
|
||||
available={player ? player[resource] - gives[resource] : undefined}
|
||||
type={resource}
|
||||
count={gets[resource]}/>
|
||||
count={gives[resource]}/>
|
||||
</div>;
|
||||
}, [ gives, gets, transfer, player]);
|
||||
|
||||
@ -338,7 +338,8 @@ const Trade = ({table}) => {
|
||||
const isBank = (item.name === 'The bank');
|
||||
|
||||
if (isTurn) {
|
||||
isSameOffer = isCompatibleOffer(player, item);
|
||||
isSameOffer = isCompatibleOffer(trade,
|
||||
{ gets: item.gives, gives: item.gets });
|
||||
} else {
|
||||
isSameOffer = table.game.turn.offer &&
|
||||
isCompatibleOffer(player, table.game.turn.offer);
|
||||
@ -462,7 +463,7 @@ const Trade = ({table}) => {
|
||||
|
||||
{ player.haveResources &&
|
||||
<div className="Transfers">
|
||||
<div className="GiveGet"><div>Give</div><div>Get</div><div>Have</div></div>
|
||||
<div className="GiveGet"><div>Get</div><div>Give</div><div>Have</div></div>
|
||||
{ transfers }
|
||||
</div>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user