forked from saucelabs/sample-app-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinventory-data.js
60 lines (52 loc) · 1.71 KB
/
inventory-data.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
import I18n from '../config/I18n';
export class InventoryData {}
InventoryData.ITEMS = [
{
name: I18n.t('products.backpack.name'),
desc: I18n.t('products.backpack.desc'),
price: I18n.t('products.backpack.price'),
image_url: require('../../img/sauce-backpack.jpg'),
},
{
name: I18n.t('products.bikeLight.name'),
desc: I18n.t('products.bikeLight.desc'),
price: I18n.t('products.bikeLight.price'),
image_url: require('../../img/bike-light.jpg'),
},
{
name: I18n.t('products.boltShirt.name'),
desc: I18n.t('products.boltShirt.desc'),
price: I18n.t('products.boltShirt.price'),
image_url: require('../../img/bolt-shirt.jpg'),
},
{
name: I18n.t('products.fleeceJacket.name'),
desc: I18n.t('products.fleeceJacket.desc'),
price: I18n.t('products.fleeceJacket.price'),
image_url: require('../../img/sauce-pullover.jpg'),
},
{
name: I18n.t('products.onesie.name'),
desc: I18n.t('products.onesie.desc'),
price: I18n.t('products.onesie.price'),
image_url: require('../../img/red-onesie.jpg'),
},
{
name: I18n.t('products.tattRed.name'),
desc: I18n.t('products.tattRed.desc'),
price: I18n.t('products.tattRed.price'),
image_url: require('../../img/red-tatt.jpg'),
},
];
InventoryData.ITEMS.map((item, i) => {
// Dynamically map our item IDs based on their positions in the item array
item.id = i;
});
InventoryData.ITEMS_NAME_AZ = InventoryData.ITEMS.slice().sort(function (a, b) {
return a.name.localeCompare(b.name);
});
InventoryData.ITEMS_NAME_ZA = InventoryData.ITEMS_NAME_AZ.slice().reverse();
InventoryData.ITEMS_PRICE_LOHI = InventoryData.ITEMS.slice().sort(function (a, b) {
return a.price - b.price;
});
InventoryData.ITEMS_PRICE_HILO = InventoryData.ITEMS_PRICE_LOHI.slice().reverse();