diff --git a/src/app/build/shop/preview/item-bundle.ts b/src/app/build/shop/preview/item-bundle.ts
new file mode 100644
index 0000000..8ca0e63
--- /dev/null
+++ b/src/app/build/shop/preview/item-bundle.ts
@@ -0,0 +1,4 @@
+export interface ItemBundle {
+ item: Object;
+ children?: Array
;
+}
diff --git a/src/app/build/shop/preview/item.component.ts b/src/app/build/shop/preview/item.component.ts
new file mode 100644
index 0000000..1d735fd
--- /dev/null
+++ b/src/app/build/shop/preview/item.component.ts
@@ -0,0 +1,15 @@
+import {Component, Input, Inject, forwardRef} from 'angular2/core';
+
+import {DDragonDirective} from '../../../misc/ddragon.directive';
+
+@Component({
+ selector: 'item',
+ directives: [DDragonDirective],
+ template: `
+
+ {{item.gold.total ? item.gold.total : ''}}
`
+})
+
+export class ItemComponent {
+ @Input() item: Object;
+}
diff --git a/src/app/build/shop/preview/items-from.component.ts b/src/app/build/shop/preview/items-from.component.ts
new file mode 100644
index 0000000..39bef57
--- /dev/null
+++ b/src/app/build/shop/preview/items-from.component.ts
@@ -0,0 +1,25 @@
+import {Component, Input, Output, EventEmitter} from 'angular2/core';
+
+import {ItemComponent} from './item.component';
+import {ItemBundle} from './item-bundle';
+
+@Component({
+ selector: 'items-from',
+ directives: [ItemComponent, ItemsFromComponent],
+ template: `
+
+
+
+
+
+ `
+})
+
+export class ItemsFromComponent {
+ @Input() items: Array;
+ @Output() itemPicked: EventEmitter = new EventEmitter();
+
+ leftClick(item: Object) {
+ this.itemPicked.next(item);
+ }
+}
diff --git a/src/app/build/shop/preview/preview.component.ts b/src/app/build/shop/preview/preview.component.ts
new file mode 100644
index 0000000..ff26566
--- /dev/null
+++ b/src/app/build/shop/preview/preview.component.ts
@@ -0,0 +1,99 @@
+import {Component, Input, OnChanges} from 'angular2/core';
+import {NgIf} from 'angular2/common';
+
+import {DDragonDirective} from '../../../misc/ddragon.directive';
+
+import {ItemComponent} from './item.component';
+import {ItemsFromComponent} from './items-from.component';
+import {ItemBundle} from './item-bundle';
+
+@Component({
+ selector: 'preview',
+ directives: [NgIf, DDragonDirective, ItemComponent, ItemsFromComponent],
+ template: `
+
+
+
+
+
+
+
+
{{item.name}}
+
+
+
+
+
+
{{item?.gold?.total ? item?.gold?.total : ''}}
+
{{item?.description}}
+
`
+})
+
+export class PreviewComponent implements OnChanges {
+ @Input() item;
+ @Input() items;
+
+ private itemsFrom: Array = new Array();
+ private itemsInto: Array
-
-
+
+
-
`
})
export class ShopComponent {
- @Input() pickedItems: Array
;
+ @Output() itemPicked: EventEmitter = new EventEmitter();
private items: Object;
private loading: boolean = true;
private error: boolean = false;
private tags: Array = [];
+ private pickedItem: Object;
constructor(private lolApi: LolApiService) {
this.getData();
@@ -97,44 +106,46 @@ export class ShopComponent {
}
}
- private itemPicked(pickedItem: Object) {
- if (this.MaxOwnableExceeded(this.pickedItems, pickedItem)) {
- // replace the first item in the pickedGroup with the new pickedItem
- this.pickedItems.forEach((item, index) => {
- if (item['group'] === pickedItem['group']) {
- this.pickedItems[index] = pickedItem;
- return;
- }
- });
- } else {
- this.pickedItems.push(pickedItem);
- }
+ private leftClick(pickedItem: Object) {
+ this.pickedItem = pickedItem;
+ this.itemPicked.next(pickedItem);
+ // if (this.MaxOwnableExceeded(this.pickedItems, pickedItem)) {
+ // // replace the first item in the pickedGroup with the new pickedItem
+ // this.pickedItems.forEach((item, index) => {
+ // if (item['group'] === pickedItem['group']) {
+ // this.pickedItems[index] = pickedItem;
+ // return;
+ // }
+ // });
+ // } else {
+ // this.pickedItems.push(pickedItem);
+ // }
}
- private MaxOwnableExceeded(pickedItems: Array, pickedItem: Object) {
- let pickedGroup = pickedItem['group'];
- if (!pickedGroup) {
- return false;
- }
-
- let pickedGroupCount = 0;
- this.pickedItems.forEach((item) => {
- if (item['group'] === pickedGroup) {
- pickedGroupCount++;
- }
- });
-
- let pickedGroupMaxOwnable = 0;
- this.items['groups'].forEach((group) => {
- if (pickedGroup.indexOf(group['key']) !== -1) {
- pickedGroupMaxOwnable = group['MaxGroupOwnable'];
- }
- });
-
- if (pickedGroupCount >= pickedGroupMaxOwnable && pickedGroupMaxOwnable >= 0) {
- return true;
- } else {
- return false;
- }
- }
+ // private MaxOwnableExceeded(pickedItems: Array, pickedItem: Object) {
+ // let pickedGroup = pickedItem['group'];
+ // if (!pickedGroup) {
+ // return false;
+ // }
+
+ // let pickedGroupCount = 0;
+ // this.pickedItems.forEach((item) => {
+ // if (item['group'] === pickedGroup) {
+ // pickedGroupCount++;
+ // }
+ // });
+
+ // let pickedGroupMaxOwnable = 0;
+ // this.items['groups'].forEach((group) => {
+ // if (pickedGroup.indexOf(group['key']) !== -1) {
+ // pickedGroupMaxOwnable = group['MaxGroupOwnable'];
+ // }
+ // });
+
+ // if (pickedGroupCount >= pickedGroupMaxOwnable && pickedGroupMaxOwnable >= 0) {
+ // return true;
+ // } else {
+ // return false;
+ // }
+ // }
}
diff --git a/src/app/misc/lolapi.service.ts b/src/app/misc/lolapi.service.ts
index 99abc2f..3b5ab7f 100644
--- a/src/app/misc/lolapi.service.ts
+++ b/src/app/misc/lolapi.service.ts
@@ -37,7 +37,7 @@ export class LolApiService {
}
public getItems() {
- return this.http.get(this.linkStaticData() + '/item?itemListData=gold,groups,hideFromAll,image,inStore,maps,requiredChampion,tags,tree')
+ return this.http.get(this.linkStaticData() + '/item?itemListData=all')
.map(res => res.json());
}
diff --git a/src/app/routes/build.component.ts b/src/app/routes/build.component.ts
index 5faab3b..776546b 100644
--- a/src/app/routes/build.component.ts
+++ b/src/app/routes/build.component.ts
@@ -31,8 +31,8 @@ import {Config} from '../build/config';
-
-
+
+
`
})
@@ -44,7 +44,6 @@ export class BuildComponent {
private error: boolean = false;
private config: Config = new Config();
- private pickedItems: Array
= new Array();
constructor(params: RouteParams, private lolApi: LolApiService) {
this.championKey = params.get('champion');
diff --git a/src/assets/css/base.css b/src/assets/css/base.css
index a26eeea..d1724d0 100644
--- a/src/assets/css/base.css
+++ b/src/assets/css/base.css
@@ -12,7 +12,7 @@ h1 {
}
h2 {
- font-size: 1.2em;
+ font-size: 1.5em;
}
p {
diff --git a/src/assets/css/build.css b/src/assets/css/build.css
index b5f7e10..48c2310 100644
--- a/src/assets/css/build.css
+++ b/src/assets/css/build.css
@@ -259,8 +259,16 @@ shop .left label:hover {
display: block;
}
+shop .right-container {
+ display: flex;
+}
+
+shop .middle {
+ width: 70%;
+}
+
shop .right {
- width: 100%;
+ width: 30%;
}
@@ -304,40 +312,32 @@ shop .items {
min-height: 1000px;
}
+shop .items item {
+ width: 32%;
+}
+
/* items */
items {
- position: relative;
- height: 155px;
+ display: block;
+ height: 300px;
}
items item {
+ display: inline-block;
position: relative;
- width: 45px;
}
items item > img {
position: absolute;
}
-items item p {
- position: absolute;
- background-color: rgba(0,0,0,0.7);
-}
-
-items item .gold {
- margin: 30px 0px 0px 0px;
- padding: 0px 2px;
- min-width: 0;
- border-bottom-left-radius: 5px;
- border-top-right-radius: 5px;
-}
-
items item .bundle {
+ position: absolute;
font-size: 0.8em;
color: #866B00;
- margin: 0px 0px 0px 27px;
- padding: 0px 2px;
+ margin: 0 0 0 27px;
+ padding: 0 2px;
border-bottom-left-radius: 5px;
border-top-right-radius: 5px;
}
@@ -351,9 +351,8 @@ item {
-o-user-select: none;
user-select: none;
height: 45px;
- width: 24%;
display: flex;
- margin: 3px;
+ margin: 2.5px;
background-color: #EEE;
border-radius: 5px;
cursor: pointer;
@@ -372,7 +371,7 @@ item > div {
}
item > div > p {
- margin: 0px;
+ margin: 0;
font-size: 1em;
display: inline;
font-family: sans-serif;
@@ -402,6 +401,87 @@ item:hover {
background-color: #CCC;
}
+preview item p.gold,
+item-slot item p.gold {
+ position: absolute;
+ margin: 30px 0 0 0;
+ padding: 0 2px;
+ background-color: rgba(0,0,0,0.7);
+ min-width: 0;
+ border-bottom-left-radius: 5px;
+ border-top-right-radius: 5px;
+}
+
+/* item-slot */
+
+item-slot {
+ display: block;
+ height: 50px;
+}
+
+/* preview */
+
+preview {
+ display: block;
+ border: 1px solid #CCC;
+ background-color: cadetblue;
+ margin: 5px 0;
+ min-height: 1100px;
+}
+
+preview h2 {
+ text-align: center;
+}
+
+preview .into {
+ display: flex;
+ overflow-x: scroll;
+ overflow-y: hidden;
+ height: 70px;
+ padding: 2.5px 5px 0 5px;
+}
+
+preview .tree {
+ padding: 5px;
+}
+
+preview item {
+ position: relative;
+ display: inline-block;
+ width: 45px;
+}
+
+preview item p.gold {
+ margin: -19px 0 0 0;
+}
+
+preview .item img {
+ display: block;
+ border-radius: 8px;
+ margin: 0 auto;
+}
+
+/* items-from */
+
+items-from {
+ display: flex;
+ justify-content: center;
+}
+
+items-from div {
+ padding-top: 14px;
+}
+
+items-from item {
+ display: block;
+ margin: 0 auto;
+ padding: 0 8px;
+ background-color: cadetblue;
+}
+
+items-from item:hover {
+ background-color: cadetblue;
+}
/* media */