Skip to content
Snippets Groups Projects
Commit cf520c28 authored by Jack Reed's avatar Jack Reed
Browse files

Merge branch 'master' of ../research-and-demos into update-from-poc

parents 7188cdec 40b41854
No related branches found
No related tags found
No related merge requests found
import manifesto from 'manifesto.js';
import ActionTypes from '../action-types';
/**
* manifestsReducer
*/
const manifestsReducer = (state = {}, action) => {
switch (action.type) {
case ActionTypes.REQUEST_MANIFEST:
return Object.assign({}, state, {
[action.manifestId]: {
isFetching: true,
},
});
case ActionTypes.RECEIVE_MANIFEST:
return Object.assign({}, state, {
[action.manifestId]: {
manifestation: manifesto.create(action.manifestJson),
isFetching: false,
},
});
case ActionTypes.RECEIVE_MANIFEST_FAILURE:
return Object.assign({}, state, {
[action.manifestId]: {
error: action.error,
isFetching: false,
},
});
case ActionTypes.REMOVE_MANIFEST:
return Object.keys(state).reduce((object, key) => {
if (key !== action.manifestId) {
object[key] = state[key]; // eslint-disable-line no-param-reassign
}
return object;
}, {});
default: return state;
}
};
export default manifestsReducer;
import ActionTypes from '../action-types';
/**
* windowsReducer
*/
const windowsReducer = (state = [], action) => {
switch (action.type) {
case ActionTypes.ADD_WINDOW:
return state.concat(Object.assign({}, action.payload));
case ActionTypes.REMOVE_WINDOW:
return state.filter(window => window.id !== action.windowId);
case ActionTypes.NEXT_CANVAS:
return state.map((window) => {
if (window.id === action.windowId) {
return Object.assign({}, window, { canvasIndex: window.canvasIndex + 1 });
}
return window;
});
case ActionTypes.PREVIOUS_CANVAS:
return state.map((window) => {
if (window.id === action.windowId) {
return Object.assign({}, window, { canvasIndex: window.canvasIndex - 1 });
}
return window;
});
default:
return state;
}
};
export default windowsReducer;
import ActionTypes from '../action-types';
/**
* workspaceReducer
*/
const workspaceReducer = (state = {}, action) => {
switch (action.type) {
case ActionTypes.FOCUS_WINDOW:
return Object.assign({}, state, { focusedWindowId: action.windowId });
default:
return state;
}
};
export { workspaceReducer as default };
// Topics for understanding
// redux modules for nested stores
// state normalisation
// (normalizer library)
import thunkMiddleware from 'redux-thunk';
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import rootReducer from './reducers/index';
import * as ActionCreators from './actions';
// Create a Redux store holding the state of your app.
// Its API is { subscribe, dispatch, getState }.
export const store = createStore(
rootReducer,
composeWithDevTools(applyMiddleware(thunkMiddleware)),
);
export const actions = ActionCreators;
export default { actions, store };
body {
background: white;
height: 100%;
}
.mirador {
&-control-panel {
position: absolute;
box-sizing: border-box;
padding: 15px;
margin:0px;
left:0;
top:0;
bottom:0;
width: 300px;
border-right: 2px solid black;
}
&-workspace {
position: absolute;
box-sizing: border-box;
margin: 0;
padding-left: 300px;
top:0;
right:0;
bottom:0;
left:0;
overflow: scroll;
}
&-window {
border: 1px solid black;
overflow: hidden;
position: relative;
}
&-window-top-bar {
background: linear-gradient(to bottom, rgba(0, 0, 0, .65) 0%, rgba(0, 0, 0, 0) 100%);
color: white;
position: absolute;
z-index: 10;
h3 {
margin: 0;
}
}
&-osd-container {
background: gray;
bottom: 0;
height: 100%;
position: absolute;
top: 0;
width: 100%;
}
&-osd-navigation {
bottom: 10px;
left: 0;
position: absolute;
right: 0;
text-align: center;
}
}
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const paths = require('./config/paths');
const eslintLoaderConfig = {
test: /\.(js|mjs|jsx)$/,
enforce: 'pre',
use: [
{
options: {
formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
};
const babelLoaderConfig = {
test: /\.(js|mjs|jsx)$/,
include: paths.appSrc, // CRL
loader: require.resolve('babel-loader'),
options: {
plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
{
loaderMap: {
svg: {
ReactComponent: '@svgr/webpack?-prettier,-svgo![path]',
},
},
},
],
],
cacheDirectory: true,
// Save disk space when time isn't as important
cacheCompression: true,
compact: true,
},
};
module.exports = [
{
entry: './src/store.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'm3core.umd.js',
libraryTarget: 'umd',
library: 'm3core',
},
module: {
rules: [
eslintLoaderConfig,
babelLoaderConfig,
],
},
},
{
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'mirador.min.js',
libraryTarget: 'umd',
library: 'Mirador',
libraryExport: 'default',
},
resolve: { extensions: ['.js'] },
module: {
rules: [
eslintLoaderConfig,
babelLoaderConfig,
{
test: /\.scss$/,
use: [
'style-loader', // creates style nodes from JS strings
'css-loader', // translates CSS into CommonJS
'sass-loader', // compiles Sass to CSS, using Node Sass by default
],
}],
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
mangle: false,
},
}),
],
},
},
];
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment