Merge pull request #13 from chaoticbackup/development

Development
This commit is contained in:
DanudeSandstorm 2017-10-23 00:18:56 -04:00 committed by GitHub
commit 0b3b39d990
6 changed files with 32 additions and 27 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "chaoticbackup",
"version": "0.0.2",
"version": "0.0.3",
"description": "Chaotic Backup",
"scripts": {
"start": "webpack-dev-server -d --inline --host 0.0.0.0 --history-api-fallback --progress",

View File

@ -5,21 +5,29 @@ class URLS {
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="; }
constructor() {}
// Singleton
static instance = null;
static createInstance() {
var object = new URLS();
return object;
static path(spreadsheetID) {
return URLS.base_url + spreadsheetID + URLS.data_format;
}
constructor() {
// This sets up urls
this.urls = {};
var self = this;
this.getSpreadsheet(URLS.path(URLS.base_spreadsheet), function(data) {
data.forEach(function(d) {
if (!self.urls[d.gsx$type.$t]) self.urls[d.gsx$type.$t] = {};
self.urls[d.gsx$type.$t][d.gsx$subtype.$t] = d.gsx$url.$t;
});
});
}
// Singleton
instance = null;
static getInstance() {
if (!URLS.instance) {
URLS.instance = URLS.createInstance();
}
if (!URLS.instance) { URLS.instance = new URLS(); }
return URLS.instance;
}
@ -35,11 +43,8 @@ class URLS {
});
}
static path(spreadsheetID) {
return URLS.base_url + spreadsheetID + URLS.data_format;
}
/* Creatures */
/* TODO remove legacy getters when introducing state management*/
get Creatures_Card_Data() {
return URLS.path("1fUFYhG1NLLkSTzrdbevm6ZMKNP6xLiKUZvM1sY10pVI");
}

View File

@ -2,7 +2,7 @@ import React from 'react';
import Interactive from 'react-interactive';
import { Link } from 'react-router';
import PageNotFound from '../../PageNotFound';
import API from '../../Spreadsheet';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
export default class Creatures extends React.Component {

View File

@ -3,7 +3,7 @@ import Interactive from 'react-interactive';
import { Link } from 'react-router';
import UnderConstruction from '../../UnderConstruction';
import PageNotFound from '../../PageNotFound';
import API from '../../Spreadsheet';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
export default class Mugic extends React.Component {

View File

@ -4,7 +4,7 @@ import { Link } from 'react-router';
// import {browserHistory} from 'react-router';
import PageNotFound from '../../PageNotFound';
import UnderConstruction from '../../UnderConstruction';
import API from '../../Spreadsheet';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
export default class SingleCreature extends React.Component {