Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"devDependencies": {
"react-scripts": "0.9.0"
},
"compilerOptions": {
"baseUrl": "src"
},
"dependencies": {
"bootstrap": "^3.3.7",
"clipboard": "^1.6.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Component } from 'react';

import './LyricsPane.css';
import '../lyrics.css';

import {CustomVerse} from './verse.js';
import {CustomVerse} from '../../../utils/verse.js';

class LyricsEditor extends Component {

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/LyricsPane.js → src/components/lyrics/pane/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Component } from 'react';

import './LyricsPane.css';
import '../lyrics.css';

import Word from './Word.js';
import { NOINDEX } from './constants.js';
import Word from '../../word/';
import { NOINDEX } from '../../../constants';

/** Shows the entire current verse in a big multi-column block. Not responsible
* for the editing view. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';

import './LyricsPorthole.css';
import './style.css';


class LyricsPorthole extends Component {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';

import './Matrix.css';
import './style.css';

class DummyMatrix extends Component {

Expand Down
6 changes: 3 additions & 3 deletions src/Matrix.js → src/components/matrix/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, { Component } from 'react';
import { hsluvToHex } from 'hsluv';
import { saveAs } from 'file-saver';

import './Matrix.css';
import './style.css';

import {STOPWORDS, NOINDEX, MODE} from './constants.js';
import config from './config.js';
import {STOPWORDS, NOINDEX, MODE} from '../../constants.js';
import config from '../../config.js';

// TODO: colormap docs (https://www.npmjs.com/package/colormap) say that n>10
// should be enough divisions for any colormap, but using the 'warm' colormap
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/SongSelector.js → src/components/song-selector/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { Component } from 'react';
import {hashHistory} from 'react-router';

import './SongSelector.css';
import './style.css';

import {CUSTOM_SLUG} from './constants.js';
import { GROUPED_CANS } from './canned.js';
import CANNED_SONGS, { ORDERED_CATEGORIES } from './canned-data.js';
import {CannedVerse} from './verse.js';
import {CUSTOM_SLUG} from '../../constants';
import { GROUPED_CANS } from '../../utils/canned';
import CANNED_SONGS, { ORDERED_CATEGORIES } from '../../utils/canned.data';
import {CannedVerse} from '../../utils/verse';


class SongSelector extends Component {
Expand Down
File renamed without changes.
32 changes: 16 additions & 16 deletions src/Songsim.js → src/components/songsim/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import JSZip from 'jszip';
import { hashHistory } from 'react-router';
import browser from 'detect-browser';

import './Songsim.css';
import './style.css';

import LyricsPorthole from './LyricsPorthole.js';
import Toolbox from './Toolbox';
import Matrix from './Matrix.js';
import { Diagonal } from './utils.js';
import DummyMatrix from './DummyMatrix.js';
import LyricsPane from './LyricsPane.js';
import SongSelector from './SongSelector.js';
import LyricsEditor from './LyricsEditor.js';
import {CustomVerse, CannedVerse} from './verse.js';
import { MODE, CUSTOM_SLUG, NOINDEX } from './constants.js';
import { LANDING_CANNED } from './canned.js';
import LANDING_LYRICS from './landing_lyrics.js';
import config from './config.js';
import DBHelper from './firebasehelper.js';
import CANNED_SONGS from './canned-data.js';
import LyricsPorthole from '../lyrics/porthole';
import Toolbox from '../toolbox';
import Matrix from '../matrix';
import { Diagonal } from '../../utils';
import DummyMatrix from '../matrix/DummyMatrix';
import LyricsPane from '../lyrics/pane';
import SongSelector from '../song-selector';
import LyricsEditor from '../lyrics/editor';
import {CustomVerse, CannedVerse} from '../../utils/verse';
import { MODE, CUSTOM_SLUG, NOINDEX } from '../../constants';
import { LANDING_CANNED } from '../../utils/canned';
import LANDING_LYRICS from '../../utils/landing-lyrics';
import config from '../../config';
import DBHelper from '../../utils/firebasehelper';
import CANNED_SONGS from '../../utils/canned.data';

const MOBILE_THRESH = 768;

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/Toolbox.js → src/components/toolbox/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { Component } from 'react';
import Clipboard from 'clipboard';

import './Toolbox.css';
import './style.css';

import config from './config.js';
import {MODE, MODE_TOOLTIPS} from './constants.js';
import config from '../../config';
import {MODE, MODE_TOOLTIPS} from '../../constants';

// TODO: is this really the orthodox way to do this? :/
new Clipboard('#perma');
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/Word.js → src/components/word/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Component } from 'react';

import {NOINDEX} from './constants.js';
import {NOINDEX} from '../../constants';

import './Word.css';
import './style.css';


class Word extends Component {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {MODE} from './constants.js';

var config = {
const config = {
alleys: true,
default_mode: MODE.vanilla,
debug: false,
debug: true,
exportSVGEnabled: true,
checkerboard: true,
rect_saturation: 100, // range [0-100]
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import About from './About.js';
import Gallery from './Gallery.js';
import Songsim from './Songsim.js';
import Home from './routes/home';
import About from './routes/about';
import Gallery from './routes/gallery';
import Songsim from './components/songsim';
import { IndexRoute, Router, Route, hashHistory } from 'react-router';
import './index.css';

Expand All @@ -13,7 +13,7 @@ import 'bootstrap/dist/css/bootstrap.css';

ReactDOM.render(
(<Router history={hashHistory}>
<Route path="/" component={App} >
<Route path="/" component={Home} >
<Route path="about(/:chapter)" component={About} />
<Route path="gallery(/:cat)" component={Gallery} />
<Route path="custom(/:customKey)" component={Songsim} />
Expand Down
11 changes: 6 additions & 5 deletions src/About.js → src/routes/about/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { Link } from 'react-router';

import './About.css';
import './style.css';

const IMG_DIR = '/img/about/';

Expand All @@ -28,7 +28,7 @@ class About extends Component {
return p(i);
});
}
var panelClass = SECTION_METADATA[chapter] ?
let panelClass = SECTION_METADATA[chapter] ?
SECTION_METADATA[chapter].panelClass
: "col-lg-10 col-lg-offset-1 col-xs-12";
panelClass += " abtPanel";
Expand All @@ -51,9 +51,9 @@ class About extends Component {
}

render() {
var chapter = this.props.params.chapter || 'default';
var sections = SECTIONS[chapter].map((sect) => (this.renderSection(sect, chapter)));
var chapter_preamble;
const chapter = this.props.params.chapter || 'default';
const sections = SECTIONS[chapter].map((sect) => (this.renderSection(sect, chapter)));
let chapter_preamble;
if (this.props.params.chapter === 'advanced') {
chapter_preamble = (
<p>Below are some common patterns to look out for.</p>
Expand Down Expand Up @@ -81,6 +81,7 @@ class About extends Component {
}
}

// TODO: check what that do (seems like its hardcoded)
const SECTIONS =
{
'default': [
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/Gallery.js → src/routes/gallery/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, { Component } from 'react';
import { Link } from 'react-router';
import Lightbox from 'react-image-lightbox';

import './Gallery.css';
import './style.css';

import { Canned, GROUPED_CANS } from './canned.js';
import CANNED_SONGS, { ORDERED_CATEGORIES } from './canned-data.js';
import { Canned, GROUPED_CANS } from '../../utils/canned';
import CANNED_SONGS, { ORDERED_CATEGORIES } from '../../utils/canned.data';

const GALLERY_FILE_PATH = '/img/gallery/';

Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/App.js → src/routes/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { Component } from 'react';
import { Link } from 'react-router';
import './App.css';
import octocat from './octocat.svg';
import './style.css';
import octocat from '../../octocat.svg';

const LINKS = [
{path: "/", name: "SongSim"},
{path: "/about", name: "About"},
{path: "/gallery", name: "Gallery"}
];

class App extends Component {
class Home extends Component {
renderNavLink = (link) => {
// I'm sure there's a better way to do this...
let active = link.path === "/" ?
const active = link.path === "/" ?
!LINKS.some((l) =>
( l.path !== "/" && this.props.location.pathname.startsWith(l.path))
)
Expand All @@ -25,7 +25,7 @@ class App extends Component {
<Link to={link.path}>{link.name}</Link></li>);
}
render() {
var links = LINKS.map(this.renderNavLink);
const links = LINKS.map(this.renderNavLink);
return (
<div className="App">
<nav className="navbar navbar-default">
Expand All @@ -51,4 +51,4 @@ class App extends Component {
}
}

export default App;
export default Home;
4 changes: 2 additions & 2 deletions src/App.test.js → src/routes/home/index.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import Home from './index';

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.render(<Home />, div);
});
File renamed without changes.
22 changes: 11 additions & 11 deletions src/canned-data.js → src/utils/canned.data.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
var POETRY = {label: 'Poetry', slug: 'poetry'};
var NR = {label: "Nursery Rhymes", slug: "nursery_rhymes"};
var MISC = {label: "Misc", slug: "misc"};
var SIXTIES = {label: "60's", slug: "60s"};
var SEVENTIES = {label: "70's", slug: "70s"};
var EIGHTIES = {label: "80's", slug: "80s"};
var NINETIES = {label: "90's", slug: "90s"};
var NAUGHTS = {label: "00's", slug: "00s"};
var CONTEMP = {label: "Contemporary", slug: "contemp"};
const POETRY = {label: 'Poetry', slug: 'poetry'};
const NR = {label: "Nursery Rhymes", slug: "nursery_rhymes"};
const MISC = {label: "Misc", slug: "misc"};
const SIXTIES = {label: "60's", slug: "60s"};
const SEVENTIES = {label: "70's", slug: "70s"};
const EIGHTIES = {label: "80's", slug: "80s"};
const NINETIES = {label: "90's", slug: "90s"};
const NAUGHTS = {label: "00's", slug: "00s"};
const CONTEMP = {label: "Contemporary", slug: "contemp"};

var ORDERED_CATEGORIES = [
const ORDERED_CATEGORIES = [
CONTEMP, NAUGHTS, NINETIES, EIGHTIES, SEVENTIES, SIXTIES, NR, POETRY, MISC
];

var CANNED_SONGS = [
const CANNED_SONGS = [
{slug: "12daysofxmas", artist: "", title: "The 12 Days Of Christmas", group: MISC.slug, dropdown: true},
{slug: "4thofjuly", artist: "Kelis", title: "4th Of July", group: NAUGHTS.slug, hidden: true},
{slug: "abc", artist: "Jackson 5", title: "ABC", group: SEVENTIES.slug, dropdown: true},
Expand Down
14 changes: 7 additions & 7 deletions src/canned.js → src/utils/canned.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CANNED_SONGS from './canned-data.js';
import CANNED_SONGS from './canned.data.js';

// 25 = buddy holly, 27 = callmemaybe
var LANDING_CANNED = CANNED_SONGS[27];
Expand Down Expand Up @@ -46,21 +46,21 @@ class Canned {

}

var CANNED = [];
var GROUPED_CANS = new Map();
const CANNED = [];
const GROUPED_CANS = new Map();

for (let c of CANNED_SONGS) {
var can = new Canned(c);
const can = new Canned(c);
CANNED.push(can);
if (!GROUPED_CANS.has(can.group)) {
GROUPED_CANS.set(can.group, []);
}
GROUPED_CANS.get(can.group).push(can);
}
// sort values
let cmp = (a,b) => {
var keya = a.artist || a.title;
var keyb = b.artist || b.title;
const cmp = (a,b) => {
const keya = a.artist || a.title;
const keyb = b.artist || b.title;
return keya < keyb ? -1 :
(keyb < keya ? 1 : 0)
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/verse.js → src/utils/verse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Diagonal} from './utils.js';
import {CUSTOM_SLUG} from './constants.js';
import {Diagonal} from './index.js';
import {CUSTOM_SLUG} from '../constants.js';

/** A sequence of repeated words. */
class Lala {
Expand Down
Loading