localized meta_spreadsheet data to decrease load time

This commit is contained in:
Daniel 2018-12-08 13:00:14 -05:00
parent cddbef2581
commit a2c9769e43
5 changed files with 66 additions and 10 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -32,7 +32,7 @@
"devDependencies": {
"babel-core": "^6.21.0",
"babel-eslint": "^10.0.0",
"babel-loader": "^8.0.4",
"babel-loader": "^7.1.5",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
@ -46,7 +46,7 @@
"eslint-plugin-react": "^7.0.0",
"extract-text-webpack-plugin": "^3.0.2",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "4.8.3",
"node-sass": "^4.10.0",
"sass-loader": "^7.0.x",
"style-loader": "^0.23.1",
"webpack": "^3.11",

View File

@ -116,7 +116,6 @@ class API {
static base_url = "https://spreadsheets.google.com/feeds/list/";
static data_format = "/od6/public/values?alt=json";
// + "/od6/public/basic?alt=json"; // Alternate data format
static base_spreadsheet = "1cUNmwV693zl2zqbH_IG4Wz8o9Va_sOHe7pAZF6M59Es";
get base_image() { return "https://drive.google.com/uc?id="; }
get thumb_missing() { return "1JYjPzkv74IhzlHTyVh2niTDyui73HSfp"; }
get card_back() { return "1_MgWDPsPGf-gPBArn2v6ideJcqOPsSYC"; }
@ -154,17 +153,19 @@ class API {
// This sets up urls and kicks off db
setupDB() {
let urls = {};
this.getSpreadsheet(API.path(API.base_spreadsheet), (data) => {
if (data == null) return;
// let base_spreadsheet = "1cUNmwV693zl2zqbH_IG4Wz8o9Va_sOHe7pAZF6M59Es";
try {
let urls = {};
let data = require('./meta_spreadsheet.json');
// this.getSpreadsheet(API.path(API.base_spreadsheet), (data) => {
// if (data == null) throw "no data from base_spreadsheet";
data.forEach((d) => {
if (!urls[d.gsx$type.$t]) urls[d.gsx$type.$t] = {};
urls[d.gsx$type.$t][d.gsx$subtype.$t] = API.path(d.gsx$url.$t);
});
this.urls = urls;
});
// });
try {
this.portal = new CollectionDB(this, 'portal');
this.cards = new CollectionDB(this, 'cards');
}

View File

@ -0,0 +1,52 @@
[
{
"gsx$type": {"$t": "Creatures"},
"gsx$subtype": {"$t": "cards"},
"gsx$url": {"$t": "1fUFYhG1NLLkSTzrdbevm6ZMKNP6xLiKUZvM1sY10pVI"}
},
{
"gsx$type": {"$t": "Creatures"},
"gsx$subtype": {"$t": "portal"},
"gsx$url": {"$t": "1eGQsy2kYk7HfnQetsjobMqank4bg6iWOOaSYykg3Yec"}
},
{
"gsx$type": {"$t": "Mugic"},
"gsx$subtype": {"$t": "cards"},
"gsx$url": {"$t": "1rOMFKnWaz6XmhD43YFpcemWGzEok9IgtKCoiPMwA35s"}
},
{
"gsx$type": {"$t": "Mugic"},
"gsx$subtype": {"$t": "portal"},
"gsx$url": {"$t": "1tEuwPGixJH2A03YtYL6Ar-MSFvtfrlaveT98GwJhw1g"}
},
{
"gsx$type": {"$t": "Attacks"},
"gsx$subtype": {"$t": "cards"},
"gsx$url": {"$t": "1yXFijC2hN1vybU3ejdINYoTOTG62qCkpPLPsiYUEEyo"}
},
{
"gsx$type": {"$t": "Attacks"},
"gsx$subtype": {"$t": "portal"},
"gsx$url": {"$t": "1KUk5J-3ZeMlEBXOfDb2h4GUUJK_0_yOq0EUDitQgNa8"}
},
{
"gsx$type": {"$t": "Battlegear"},
"gsx$subtype": {"$t": "cards"},
"gsx$url": {"$t": "1UUEPAEHZwmH52AJj2Jtskf6d4z5XIFEBb3HT-FTAcgs"}
},
{
"gsx$type": {"$t": "Battlegear"},
"gsx$subtype": {"$t": "portal"},
"gsx$url": {"$t": "1S5AVw-E_sFO257uzajauP31bOI0LPmrbTcUzSpa2i60"}
},
{
"gsx$type": {"$t": "Locations"},
"gsx$subtype": {"$t": "cards"},
"gsx$url": {"$t": "15QPS08iq6pkyMFsYuDsKIXX8LQmQ8MUoJeeNtjU54Xo"}
},
{
"gsx$type": {"$t": "Locations"},
"gsx$subtype": {"$t": "portal"},
"gsx$url": {"$t": "1U07n2keHNxL-6y5zUcHlb220zT9A_MrVEansOAMQFCA"}
}
]