Ver código fonte

tooltips fix

master
peter 5 anos atrás
pai
commit
3b7de5cf2d

+ 2
- 1
src/frontend/src/app/frontcraft/pages/armory/armory.component.ts Ver arquivo

35
         itemname: item.name,
35
         itemname: item.name,
36
         iconname: item.icon.replace('.jpg', ''),
36
         iconname: item.icon.replace('.jpg', ''),
37
         quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
37
         quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
38
-        url: "https://classic.wowhead.com/item="+item.id
38
+        url: "https://classic.wowhead.com/item="+item.id,
39
+        tooltip: "unavailable"
39
       }})
40
       }})
40
     }))
41
     }))
41
   }
42
   }

+ 18
- 10
src/frontend/src/app/frontcraft/pages/character/character.component.ts Ver arquivo

25
     gear1:string[] = []
25
     gear1:string[] = []
26
     
26
     
27
     boss2= {}
27
     boss2= {}
28
-    gear2:Item[] = []
28
+    gear2:string[] = []
29
 
29
 
30
     constructor(
30
     constructor(
31
       private api: ApiService,
31
       private api: ApiService,
50
 
50
 
51
           
51
           
52
 
52
 
53
-          fetch(this.dataLink).then(raw => raw.json().then(async (json) => {
53
+          fetch(this.dataLink).then(raw => raw.json().then((json) => {
54
             if(json.length < 1) return
54
             if(json.length < 1) return
55
             const data = json[0]
55
             const data = json[0]
56
 
56
 
58
               name: data.encounterName,
58
               name: data.encounterName,
59
               date: data.startTime
59
               date: data.startTime
60
             }
60
             }
61
-
62
-            this.gear2 = await Promise.all(data.gear.map(i => i.name).map(itemName => this.api.get('ItemManager').getItem(itemName)))
63
-            this.gear2 = this.gear2.filter(i => i!=null)            
64
-          
61
+            this.gear2 = data.gear.map(item => {return <Item>{
62
+              itemname: item.name,
63
+              iconname: item.icon.replace('.jpg', ''),
64
+              quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
65
+              url: "https://classic.wowhead.com/item="+item.id,
66
+              tooltip: "unavailable"
67
+            }}).filter(item => item.itemname != "Unknown Item")
65
           }))
68
           }))
66
 
69
 
67
-          fetch(this.dataLink).then(raw => raw.json().then(async (json) => {
70
+          fetch(this.dataLink).then(raw => raw.json().then((json) => {
68
             if(json.length < 2) return
71
             if(json.length < 2) return
72
+
69
             const data = json[1]
73
             const data = json[1]
70
 
74
 
71
             this.boss1 = {
75
             this.boss1 = {
73
               date: data.startTime
77
               date: data.startTime
74
             }
78
             }
75
 
79
 
76
-            
77
-            this.gear1 = await Promise.all(data.gear.map(i => i.name).map(itemName => this.api.get('ItemManager').getItem(itemName)))
78
-            this.gear1 = this.gear1.filter(i => i!=null)            
80
+            this.gear1 = data.gear.map(item => {return <Item>{
81
+              itemname: item.name,
82
+              iconname: item.icon.replace('.jpg', ''),
83
+              quality: item.quality.replace(/^\w/, c => c.toUpperCase()),
84
+              url: "https://classic.wowhead.com/item="+item.id,
85
+              tooltip: "unavailable"
86
+            }}).filter(item => item.itemname != "Unknown Item")
79
           }))
87
           }))
80
         }
88
         }
81
       })
89
       })

Carregando…
Cancelar
Salvar