fix(place-order): Uses global currency

This commit is contained in:
sovanna 2019-11-06 11:20:06 +09:00 committed by Sebastien Bourdeauducq
parent be59ae8032
commit 7a294c4cc3
2 changed files with 13 additions and 21 deletions

View File

@ -801,6 +801,7 @@ class OrderSumary extends React.PureComponent {
static get propTypes() { static get propTypes() {
return { return {
currency: PropTypes.string,
modes: PropTypes.array, modes: PropTypes.array,
currentMode: PropTypes.string, currentMode: PropTypes.string,
summary: PropTypes.array, summary: PropTypes.array,
@ -861,6 +862,7 @@ class OrderSumary extends React.PureComponent {
render() { render() {
const { const {
currency,
modes, modes,
currentMode, currentMode,
summary, summary,
@ -889,7 +891,7 @@ class OrderSumary extends React.PureComponent {
<tr> <tr>
<td className="item-card-name">{mode.name}</td> <td className="item-card-name">{mode.name}</td>
<td className="price"> <td className="price">
{`${mode.currency} ${mode.price}`} {`${currency} ${mode.price}`}
<button style={{'opacity': '0', 'cursor': 'initial'}}> <button style={{'opacity': '0', 'cursor': 'initial'}}>
<img src="/images/shop/icon-remove.svg" /> <img src="/images/shop/icon-remove.svg" />
@ -925,7 +927,7 @@ class OrderSumary extends React.PureComponent {
<td className="price"> <td className="price">
<div> <div>
{`${item.currency} ${item.price}`} {`${currency} ${item.price}`}
<button onClick={this.handleOnDeleteItem.bind(this, index)}> <button onClick={this.handleOnDeleteItem.bind(this, index)}>
<img src="/images/shop/icon-remove.svg" /> <img src="/images/shop/icon-remove.svg" />
@ -950,13 +952,13 @@ class OrderSumary extends React.PureComponent {
<td className="item-card-name">Price estimate</td> <td className="item-card-name">Price estimate</td>
<td className="price"> <td className="price">
{summary.length ? ( {summary.length ? (
`${summary[0].currency} ${summary.reduce( `${currency} ${summary.reduce(
(prev, next) => { (prev, next) => {
return prev + next.price; return prev + next.price;
}, 0 }, 0
) + mode.price}` ) + mode.price}`
) : ( ) : (
`${mode.currency} ${mode.price}` `${currency} ${mode.price}`
)} )}
<button style={{'opacity': '0', 'cursor': 'initial'}}> <button style={{'opacity': '0', 'cursor': 'initial'}}>
@ -981,6 +983,7 @@ class Backlog extends React.PureComponent {
static get propTypes() { static get propTypes() {
return { return {
currency: PropTypes.string,
data: PropTypes.object.isRequired, data: PropTypes.object.isRequired,
items: PropTypes.object, items: PropTypes.object,
onClickAddItem: PropTypes.func, onClickAddItem: PropTypes.func,
@ -995,6 +998,7 @@ class Backlog extends React.PureComponent {
render() { render() {
const { const {
currency,
data, data,
items, items,
onClickAddItem, onClickAddItem,
@ -1009,7 +1013,7 @@ class Backlog extends React.PureComponent {
index={index} index={index}
name={item.name} name={item.name}
price={item.price} price={item.price}
currency={item.currency} currency={currency}
image={`/images/${item.image}`} image={`/images/${item.image}`}
specs={item.specs} specs={item.specs}
onClickAddItem={onClickAddItem} onClickAddItem={onClickAddItem}
@ -1632,6 +1636,7 @@ class Shop extends React.PureComponent {
render() { render() {
const { const {
currency,
currentItemHovered, currentItemHovered,
currentMode, currentMode,
crateModeSlots, crateModeSlots,
@ -1648,6 +1653,7 @@ class Shop extends React.PureComponent {
className="shop" className="shop"
aside={ aside={
<Backlog <Backlog
currency={currency}
items={items} items={items}
data={columns['backlog']} data={columns['backlog']}
onClickAddItem={this.handleClickAddItem}> onClickAddItem={this.handleClickAddItem}>
@ -1684,6 +1690,7 @@ class Shop extends React.PureComponent {
} }
summaryPrice={ summaryPrice={
<OrderSumary <OrderSumary
currency={currency}
currentMode={currentMode} currentMode={currentMode}
modes={crateModeItems} modes={crateModeItems}
summary={columns['cart'].items} summary={columns['cart'].items}

View File

@ -2,6 +2,7 @@ const shop_data = {
currentItemHovered: null, currentItemHovered: null,
currentMode: 'rack', currentMode: 'rack',
currency: 'EUR',
crateModeSlots: { crateModeSlots: {
rack: 21, rack: 21,
@ -22,12 +23,10 @@ const shop_data = {
id: 'rack', id: 'rack',
name: 'Rack mountable crate', name: 'Rack mountable crate',
price: 1000, price: 1000,
currency: 'USD',
}, { }, {
id: 'desktop', id: 'desktop',
name: 'Desktop crate', name: 'Desktop crate',
price: 2000, price: 2000,
currency: 'USD',
}], }],
items: { items: {
@ -36,7 +35,6 @@ const shop_data = {
id: 'kasli', id: 'kasli',
name: 'Kasli', name: 'Kasli',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_kasli.svg', image: '/shop/graphic-02_kasli.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -98,7 +96,6 @@ const shop_data = {
id: 'kasli-backplane', id: 'kasli-backplane',
name: 'Kasli', name: 'Kasli',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_kasli-with-backplane.svg', image: '/shop/graphic-02_kasli-with-backplane.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -160,7 +157,6 @@ const shop_data = {
id: 'bnc-dio', id: 'bnc-dio',
name: 'BNC-DIO', name: 'BNC-DIO',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_BNC-DIO.svg', image: '/shop/graphic-02_BNC-DIO.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -196,7 +192,6 @@ const shop_data = {
id: 'eem-octal', id: 'eem-octal',
name: 'SMA-DIO', name: 'SMA-DIO',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_EEM-Octal.svg', image: '/shop/graphic-02_EEM-Octal.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -232,7 +227,6 @@ const shop_data = {
id: 'eem-16x', id: 'eem-16x',
name: 'RJ45-DIO', name: 'RJ45-DIO',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_EEM-16x.svg', image: '/shop/graphic-02_EEM-16x.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -268,7 +262,6 @@ const shop_data = {
id: 'urukul', id: 'urukul',
name: 'Urukul', name: 'Urukul',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_Urukul.svg', image: '/shop/graphic-02_Urukul.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -310,7 +303,6 @@ const shop_data = {
id: 'zotino', id: 'zotino',
name: 'Zotino', name: 'Zotino',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_zotino.svg', image: '/shop/graphic-02_zotino.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -366,7 +358,6 @@ const shop_data = {
id: 'idc-bnc-adapter', id: 'idc-bnc-adapter',
name: 'IDC-BNC', name: 'IDC-BNC',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_IDC-BNC-adapter.svg', image: '/shop/graphic-02_IDC-BNC-adapter.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -395,7 +386,6 @@ const shop_data = {
id:'hd68-idc-adapter', id:'hd68-idc-adapter',
name: 'HD68-IDC', name: 'HD68-IDC',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_HD68.svg', image: '/shop/graphic-02_HD68.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -444,7 +434,6 @@ const shop_data = {
id: 'novo', id: 'novo',
name: 'Novo', name: 'Novo',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_Novo.svg', image: '/shop/graphic-02_Novo.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -486,7 +475,6 @@ const shop_data = {
id: 'koster', id: 'koster',
name: 'Koster', name: 'Koster',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_Koster.svg', image: '/shop/graphic-02_Koster.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -528,7 +516,6 @@ const shop_data = {
id: 'clocker', id: 'clocker',
name: 'Clocker', name: 'Clocker',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_Clocker.svg', image: '/shop/graphic-02_Clocker.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -570,7 +557,6 @@ const shop_data = {
id: 'stabiliser', id: 'stabiliser',
name: 'Stabilizer', name: 'Stabilizer',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_Stabiliser.svg', image: '/shop/graphic-02_Stabiliser.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',
@ -598,7 +584,6 @@ const shop_data = {
id: 'mirny', id: 'mirny',
name: 'Mirny', name: 'Mirny',
price: 1000, price: 1000,
currency: 'USD',
image: '/shop/graphic-02_Mirny.svg', image: '/shop/graphic-02_Mirny.svg',
specs: [ specs: [
'Artix 7 100T FPGA', 'Artix 7 100T FPGA',