import debug from "debug";

const log = debug("app:app");

export function start() {
    log("started");
}

@@ -24,83 +24,1285 @@
 g%22;%0A
-%0Aconst log = debug(%22app:app%22);%0A%0Aexport function start() %7B%0A    log(%22started%22
+import moment from %22moment%22;%0Aimport data from %22../../data/schedule%22;%0Aimport React from %22react%22;%0Aimport %7B App %7D from %22./components/app%22;%0A%0Aconst log = debug(%22app:app%22);%0A%0Aconst initialState = %7B%0A    main: %7B%0A        view: %22default%22%0A    %7D%0A%7D;%0A%0Alet currentState = initialState;%0A%0Afunction getState() %7B%0A    return %7B ...currentState %7D;%0A%7D%0A%0Afunction updateState(branch, patch) %7B%0A    if (%22.%22 === branch) %7B%0A        currentState = %7B ...currentState, ...patch %7D;%0A    %7D else %7B%0A        currentState = %7B ...currentState, %5Bbranch%5D: patch %7D;%0A    %7D%0A%0A    return getState();%0A%7D%0A%0Afunction renderMain(props) %7B%0A    React.render(%0A        React.createElement(App, props),%0A        document.querySelector(%22body%22)%0A    );%0A%7D%0A%0Aexport function start() %7B%0A    // Wrapped update so state updates re-render the app%0A    let wrappedUpdate = (...update) =%3E %7B%0A        updateState(...update);%0A        renderMain(%7B getState, updateState: wrappedUpdate %7D);%0A    %7D;%0A%0A    // Really ugly hack to include the date in the session start time%0A    Object.keys(data.days).forEach(d =%3E %7B%0A        Object.keys(data.days%5Bd%5D.tracks).forEach(t =%3E %7B%0A            data.days%5Bd%5D.tracks%5Bt%5D.forEach(s =%3E %7B%0A                s.start = new Date(d + %22 %22 + s.start);%0A            %7D);%0A        %7D);%0A    %7D);%0A%0A    wrappedUpdate(%22.%22, %7B ...initialState, ...data %7D
 );%0A%7D

Add extremey simple state wrapper