From 9fcfc017be85753370974c783042e6e86d81df79 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 7 Nov 2018 08:53:12 +0100 Subject: [PATCH] Images Showing in Products Pannel --- Dashboard.js | 15 +++++++++------ ProductCard.js | 8 +++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Dashboard.js b/Dashboard.js index 6ab33d3d5..4e458f675 100644 --- a/Dashboard.js +++ b/Dashboard.js @@ -274,18 +274,21 @@ function newDashboard() { let teamProfileImages = new Map(); let fbProfileImages = new Map(); - for (let i = 0; i < teams.edges.lenght; i++) { + for (let i = 0; i < teams.edges.length; i++) { let team = teams.edges[i].node; - teamProfileImages.set(team.slug, team.profile.avatar) - fbProfileImages.set(team.fb[0].slug, team.fb[0].avatar) + teamProfileImages.set(team.slug, team.profile.avatar); + console.log("TEAM SET", team.slug, team.profile.avatar); + if (team.fb.length > 0) { + + fbProfileImages.set(team.slug + "-" + team.fb[0].slug, team.fb[0].avatar); + console.log("BOT SET", team.slug + "-" + team.fb[0].slug, team.fb[0].avatar); + + } } - console.log("TEAM PROFILES", JSON.stringify(teamProfileImages)); - console.log("FB PROFILES", JSON.stringify(fbProfileImages)); - window.canvasApp.context.teamProfileImages = teamProfileImages; window.canvasApp.context.fbProfileImages = fbProfileImages; diff --git a/ProductCard.js b/ProductCard.js index 6ee8de1d3..ff1f517be 100644 --- a/ProductCard.js +++ b/ProductCard.js @@ -240,8 +240,9 @@ imageLoaded(); } - teamAvatar.src = STORAGE_URL + "/" + TEAM + "/" + TEAM + "-" + "avatar.jpg"; + teamAvatar.src = window.canvasApp.context.teamProfileImages.get(TEAM); console.log("TEAM NAME", TEAM); + console.log("TEAM AVATAR", window.canvasApp.context.teamProfileImages.get(TEAM)); /* TODO Temporary code: Here we will temporary download the images of bots uploaded at the Teams Module. */ @@ -254,8 +255,9 @@ thisObject.bot.avatar = botAvatar; imageLoaded(); } - - botAvatar.src = STORAGE_URL + "/" + TEAM + "/" + BOT + "-fb-" + "avatar.jpg"; + console.log("BOT NAME", BOT); + console.log("BOT AVATAR", window.canvasApp.context.fbProfileImages.get(TEAM + "-" + BOT)); + botAvatar.src = window.canvasApp.context.fbProfileImages.get(TEAM + "-" + BOT); }