From 6d7f2ae8613eaa27524243a43da3030dee69be80 Mon Sep 17 00:00:00 2001 From: Anmol Varma Date: Tue, 31 Mar 2020 18:29:45 +0530 Subject: [PATCH] add data in player list --- getTeamLogoMapping.js | 64 ++++----- src/jsons/team-logo.json | 18 +++ src/jsons/transfer.json | 272 +++++++++++++++++++++++++++++++++++- src/styles/index.module.css | 2 +- 4 files changed, 321 insertions(+), 35 deletions(-) diff --git a/getTeamLogoMapping.js b/getTeamLogoMapping.js index 2659965..5f7a94e 100644 --- a/getTeamLogoMapping.js +++ b/getTeamLogoMapping.js @@ -1,34 +1,32 @@ -// const axios = require('axios'); - -// const leagueId = [ -// 4328, // English Premier League -// 4331, // German Bundesliga -// 4332, // Italian Serie A -// 4334, // French Ligue 1 -// 4335, // Spanish La Liga -// 4344, // Portuguese Primeira Liga -// 4346, // American Major League Soccer -// 4351, // Brazilian Brasileirao -// 4359 // Chinese Super League -// ] - -// const API_KEY = 1 - -// Promise.all( -// leagueId.map(async lid => { -// const { data: { teams: teamList } } = await axios.get(`https://www.thesportsdb.com/api/v1/json/${API_KEY}/lookup_all_teams.php?id=${lid}`); -// return teamList.map(({ strTeam, strTeamBadge }) => ({ -// name: strTeam.toLowerCase(), -// logo: strTeamBadge -// })) -// }) -// ).then(parsedTeamList => console.log(JSON.stringify(Array.prototype.concat.apply([], parsedTeamList)))) - -const abc = require("./src/data/team-logo.json") - -const ans = {}; - -abc.map(({ name, logo }) => ans[name] = logo); - -console.log(JSON.stringify(ans)); +const axios = require('axios'); + +const leagueId = [ + 4328, // English Premier League + 4331, // German Bundesliga + 4332, // Italian Serie A + 4334, // French Ligue 1 + 4335, // Spanish La Liga + 4337, // Dutch Eredivisie + 4344, // Portuguese Primeira Liga + 4346, // American Major League Soccer + 4351, // Brazilian Brasileirao + 4359 // Chinese Super League +] + +const API_KEY = 1 +let abc; +Promise.all( + leagueId.map(async lid => { + const { data: { teams: teamList } } = await axios.get(`https://www.thesportsdb.com/api/v1/json/${API_KEY}/lookup_all_teams.php?id=${lid}`); + return teamList.map(({ strTeam, strTeamBadge }) => ({ + name: strTeam.toLowerCase(), + logo: strTeamBadge + })) + }) +).then(parsedTeamList => { + abc = Array.prototype.concat.apply([], parsedTeamList) + const ans = {}; + abc.map(({ name, logo }) => ans[name] = logo); + console.log(JSON.stringify(ans)); +}) diff --git a/src/jsons/team-logo.json b/src/jsons/team-logo.json index c86d491..3cd05bc 100644 --- a/src/jsons/team-logo.json +++ b/src/jsons/team-logo.json @@ -97,6 +97,24 @@ "valencia": "https://www.thesportsdb.com/images/media/team/badge/yxwsqp1473503062.png", "valladolid": "https://www.thesportsdb.com/images/media/team/badge/rvytvt1473503711.png", "villarreal": "https://www.thesportsdb.com/images/media/team/badge/vrypqy1473503073.png", + "ado den haag": "https://www.thesportsdb.com/images/media/team/badge/vpvtqt1473534732.png", + "ajax": "https://www.thesportsdb.com/images/media/team/badge/9az3yz1534798587.png", + "az alkmaar": "https://www.thesportsdb.com/images/media/team/badge/wtqwvv1473534757.png", + "fc emmen": "https://www.thesportsdb.com/images/media/team/badge/knwhs41532855745.png", + "fc groningen": "https://www.thesportsdb.com/images/media/team/badge/twtvss1473534775.png", + "fc twente": "https://www.thesportsdb.com/images/media/team/badge/rsrxrt1473534783.png", + "fc utrecht": "https://www.thesportsdb.com/images/media/team/badge/txvxrx1473534794.png", + "feyenoord": "https://www.thesportsdb.com/images/media/team/badge/uturtx1473534803.png", + "fortuna sittard": "https://www.thesportsdb.com/images/media/team/badge/6z9a051513777590.png", + "pec zwolle": "https://www.thesportsdb.com/images/media/team/badge/qpvqwy1473534822.png", + "psv eindhoven": "https://www.thesportsdb.com/images/media/team/badge/xryxrq1473534831.png", + "rkc waalwijk": "https://www.thesportsdb.com/images/media/team/badge/6mw88p1488825141.png", + "sc heerenveen": "https://www.thesportsdb.com/images/media/team/badge/surtsx1473534841.png", + "sc heracles almelo": "https://www.thesportsdb.com/images/media/team/badge/vyyvss1473534851.png", + "sparta": "https://www.thesportsdb.com/images/media/team/badge/xsvwwp1464539632.png", + "vitesse": "https://www.thesportsdb.com/images/media/team/badge/wrptxp1473534864.png", + "vvv-venlo": "https://www.thesportsdb.com/images/media/team/badge/ii0fu01566053253.png", + "willem ii": "https://www.thesportsdb.com/images/media/team/badge/yqqrps1473534873.png", "aves": "https://www.thesportsdb.com/images/media/team/badge/9yw8301512996625.png", "belenenses": "https://www.thesportsdb.com/images/media/team/badge/7po4e21563652867.png", "benfica": "https://www.thesportsdb.com/images/media/team/badge/7t684j1520879174.png", diff --git a/src/jsons/transfer.json b/src/jsons/transfer.json index ead3caf..d16436d 100644 --- a/src/jsons/transfer.json +++ b/src/jsons/transfer.json @@ -7,5 +7,275 @@ "real madrid", "juventus" ] + }, + { + "player_name": "alvaro morata", + "teams": [ + "real madrid", + "juventus", + "real madrid", + "chelsea", + "ath madrid" + ] + }, + { + "player_name": "antoine griezmann", + "teams": [ + "sociedad", + "ath madrid", + "barcelona" + ] + }, + { + "player_name": "gonzalo higuain", + "teams": [ + "real madrid", + "napoli", + "juventus", + "milan", + "chelsea", + "juventus" + ] + }, + { + "player_name": "mohamed salah", + "teams": [ + "chelsea", + "fiorentina", + "roma", + "liverpool" + ] + }, + { + "player_name": "toni kroos", + "teams": [ + "bayern munich", + "leverkusen", + "bayern munich", + "real madrid" + ] + }, + { + "player_name": "alexis sanchez", + "teams": [ + "udinese", + "barcelona", + "arsenal", + "man united", + "inter" + ] + }, + { + "player_name": "neymar", + "teams": [ + "santos fc", + "barcelona", + "paris sg" + ] + }, + { + "player_name": "mario balotelli", + "teams": [ + "inter", + "man city", + "milan", + "liverpool", + "milan", + "nice", + "marseille", + "brescia" + ] + }, + { + "player_name": "zlatan ibrahimovic", + "teams": [ + "ajax", + "juventus", + "inter", + "barcelona", + "milan", + "paris sg", + "man united", + "l.a. galaxy", + "milan" + ] + }, + { + "player_name": "frank lampard", + "teams": [ + "west ham", + "chelsea", + "man city", + "new york city" + ] + }, + { + "player_name": "david luiz", + "teams": [ + "benfica", + "chelsea", + "paris sg", + "chelsea", + "arsenal" + ] + }, + { + "player_name": "xabi alonso", + "teams": [ + "sociedad", + "eibar", + "liverpool", + "real madrid", + "bayern munich" + ] + }, + { + "player_name": "arjen robben", + "teams": [ + "chelsea", + "real madrid", + "bayern munich" + ] + }, + { + "player_name": "mario mandzukic", + "teams": [ + "wolfsburg", + "bayern munich", + "ath madrid", + "juventus" + ] + }, + { + "player_name": "fernando torres", + "teams": [ + "ath madrid", + "liverpool", + "chelsea", + "milan", + "ath madrid" + ] + }, + { + "player_name": "samuel eto'o", + "teams": [ + "real madrid", + "espanol", + "mallorca", + "barcelona", + "inter", + "chelsea", + "everton", + "sampdoria" + ] + }, + { + "player_name": "cesc fabregas", + "teams": [ + "arsenal", + "barcelona", + "chelsea", + "monaco" + ] + }, + { + "player_name": "mesut ozil", + "teams": [ + "schalke 04", + "werder bremen", + "real madrid", + "arsenal" + ] + }, + { + "player_name": "romelu lukaku", + "teams": [ + "chelsea", + "everton", + "man united", + "inter" + ] + }, + { + "player_name": "zinedine zidane", + "teams": [ + "bordeaux", + "juventus", + "real madrid" + ] + }, + { + "player_name": "kaka", + "teams": [ + "sao paulo", + "milan", + "real madrid", + "milan", + "sao paulo", + "orlando city" + ] + }, + { + "player_name": "javier hernandez", + "teams": [ + "man united", + "real madrid", + "leverkusen", + "west ham", + "sevilla", + "l.a. galaxy" + ] + }, + { + "player_name": "eden hazard", + "teams": [ + "lille", + "chelsea", + "real madrid" + ] + }, + { + "player_name": "thibaut courtois", + "teams": [ + "ath madrid", + "chelsea", + "real madrid" + ] + }, + { + "player_name": "mario gotze", + "teams": [ + "dortmund", + "bayern munich", + "dortmund" + ] + }, + { + "player_name": "pierre-emerick aubameyang", + "teams": [ + "milan", + "dijon", + "lille", + "monaco", + "st etienne", + "dortmund", + "arsenal" + ] + }, + { + "player_name": "henrikh mkhitaryan", + "teams": [ + "dortmund", + "man united", + "arsenal", + "roma" + ] + }, + { + "player_name": "ilkay gundogan", + "teams": [ + "dortmund", + "man city" + ] } -] \ No newline at end of file +] diff --git a/src/styles/index.module.css b/src/styles/index.module.css index 4fc449e..395fd44 100644 --- a/src/styles/index.module.css +++ b/src/styles/index.module.css @@ -1,6 +1,6 @@ .wrapperBox{ margin: auto; - transform: translateY(10%); + transform: translateY(1%); background: #fff; border-radius: 5px; box-shadow: 0 4px 8px 0 #dddddd, 0 6px 20px 0 #dddddd;