Commit 25402113 authored by Technoboy10's avatar Technoboy10

tweak a few things before WIP PR

parent ae9c15f6
var keyMirror = require('keymirror');
var pickBy = require('lodash.pickBy');
var Types = {
SET_STATE: 'splash/activity/SET_LAYOUT',
SET_ERROR: 'splash/activity/SET_ERROR'
};
function reducer (state, action) {
if (typeof state === 'undefined') {
state = reducer.getInitialState();
}
switch (action.type) {
case Types.SET_STATE:
return action.layout;
case Types.SET_ERROR:
return state;
default:
return state;
}
}
reducer.Layouts = keyMirror({
COLS4: null,
COLS6: null,
COLS8: null,
COLS12: null
});
reducer.mediaQueries = {
COLS4: window.matchMedia('screen and (max-width: 479px)'),
COLS6: window.matchMedia('screen and (min-width: 480px) and (max-width: 639px)'),
COLS8: window.matchMedia('screen and (min-width: 640px) and (max-width: 941px)'),
COLS12: window.matchMedia('screen and (min-width: 942px)')
};
reducer.getInitialState = function () {
return reducer.Layouts.COLS12;
};
reducer.setLayout = function (layout) {
return {
type: Types.SET_STATE,
layout: layout
};
};
reducer.setLayoutError = function (error) {
return {
type: Types.SET_ERROR,
error: error
};
};
reducer.getLayout = function () {
return function (dispatch) {
var matched = pickBy(reducer.mediaQueries, function (value, key) { //eslint-disable-line
return value.matches;
});
dispatch(reducer.setLayout(Object.keys(matched)[0]));
};
};
module.exports = reducer;
......@@ -5,7 +5,6 @@ var detailsReducer = require('./conference-details.js').detailsReducer;
var permissionsReducer = require('./permissions.js').permissionsReducer;
var sessionReducer = require('./session.js').sessionReducer;
var tokenReducer = require('./token.js').tokenReducer;
// var layout = require('./layout.js');
var appReducer = combineReducers({
session: sessionReducer,
......
{ "user": { "id": 36977, "username": "technoboy10", "thumbnailUrl": "//cdn2.scratch.mit.edu/get_image/user/36977_32x32.png?v=1459545234.83", "dateJoined": "2007-08-25T16:43:03" }, "permissions": { "admin": false, "social": true, "educator": false, "student": false }, "flags": { "has_outstanding_email_confirmation": false, "show_welcome": true, "confirm_email_banner": true, "unsupported_browser_banner": true } }
......@@ -21,20 +21,6 @@
"view": "guidelines/guidelines",
"title": "Scratch Community Guidelines"
},
{
"name": "student-complete-registration",
"pattern": "^/classes/complete_registration",
"routeAlias": "/classes/(complete_registration|.+/register/.+)",
"view": "studentcompleteregistration/studentcompleteregistration",
"title": "Complete your Registration"
},
{
"name": "student-registration",
"pattern": "^/classes/:id/register/:token",
"routeAlias": "/classes/(complete_registration|.+/register/.+)",
"view": "studentregistration/studentregistration",
"title": "Class Registration"
},
{
"name": "conference-index",
"pattern": "^/conference/?$",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment