Skip to content

Commit

Permalink
Merge pull request #76 from cu-mkp/main
Browse files Browse the repository at this point in the history
Deploying recent updates to GitHub Pages
  • Loading branch information
ajolipa authored Mar 6, 2024
2 parents 8f8c4dc + d28c9ec commit a1e80fb
Show file tree
Hide file tree
Showing 26 changed files with 400 additions and 105 deletions.
2 changes: 1 addition & 1 deletion editioncrafter-umd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cu-mkp/editioncrafter-umd",
"version": "0.1.0",
"version": "0.2.0",
"description": "",
"private": false,
"source": "src/index.js",
Expand Down
5 changes: 4 additions & 1 deletion editioncrafter-umd/src/EditionCrafter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ class EditionCrafter {
if (config.id) {
this.container = document.getElementById(config.id);
config.id && ReactDOM.render(
<EditionCrafterComponent config={config} />,
<EditionCrafterComponent
{...config}
/>,
this.container,
);
}
// note: once the EC react component is updated,
}

/**
Expand Down
2 changes: 1 addition & 1 deletion editioncrafter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cu-mkp/editioncrafter",
"version": "0.1.0",
"version": "0.2.0",
"description": "",
"private": false,
"main": "dist/editioncrafter.min.js",
Expand Down
13 changes: 12 additions & 1 deletion editioncrafter/src/action/DocumentActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ function parseAnnotationURLs(canvas, transcriptionTypes) {
const MAX_THUMBNAIL_DIMENSION = 130;

function parseManifest(manifest, transcriptionTypes) {
if (manifest.type === 'variorum') {
let folios = [];
Object.keys(manifest.documentData).forEach((key) => {
folios = folios.concat(parseSingleManifest(manifest.documentData[key], transcriptionTypes[key], key));
});
return folios;
}
return parseSingleManifest(manifest, transcriptionTypes);
}

function parseSingleManifest(manifest, transcriptionTypes, document) {
const folios = [];

// make sure this is a IIIF Presentation API v3 Manifest
Expand Down Expand Up @@ -146,6 +157,7 @@ function parseManifest(manifest, transcriptionTypes) {

const folio = {
id: folioID,
doc_id: document || manifest.id,
name: canvasLabel,
pageNumber: i,
image_zoom_url: imageURL,
Expand All @@ -158,7 +170,6 @@ function parseManifest(manifest, transcriptionTypes) {

folios.push(folio);
}

return folios;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
export default function documentInitalState(iiifManifest, documentName, transcriptionTypes) {
export default function documentInitalState(iiifManifest, documentName, transcriptionTypes, variorum = false, derivativeNames = null, threePanel = false) {
return {
documentName: documentName,
documentName,
derivativeNames,
manifestURL: iiifManifest,
transcriptionTypes,
variorum,
threePanel,
folios: [],
loaded: false,
folioIndex: {},
Expand Down
19 changes: 17 additions & 2 deletions editioncrafter/src/action/rootReducer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { combineReducers } from 'redux';

// eslint-disable-next-line import/no-cycle
import { createReducer } from '../model/ReduxStore';
import GlossaryActions from './GlossaryActions';
import DocumentActions from './DocumentActions';
Expand All @@ -11,11 +12,25 @@ import documentInitialState from './initialState/documentInitialState';

export default function rootReducer(config) {
const {
iiifManifest, documentName, transcriptionTypes,
documentName, documentInfo, threePanel = false
} = config;
const variorum = documentInfo && Object.keys(documentInfo).length > 1;
const transcriptionTypesInfo = {};
const manifestInfo = {};
const derivativesInfo = {};
if (variorum) {
Object.keys(config.documentInfo).forEach((key) => {
transcriptionTypesInfo[key] = config.documentInfo[key].transcriptionTypes;
manifestInfo[key] = config.documentInfo[key].iiifManifest;
derivativesInfo[key] = config.documentInfo[key].documentName;
});
}
const transcriptionTypes = variorum ? transcriptionTypesInfo : config.transcriptionTypes;
const iiifManifest = variorum ? manifestInfo : config.iiifManifest;
const derivativeNames = variorum && derivativesInfo;
return combineReducers({
diplomatic: createReducer('DiplomaticActions', DiplomaticActions, diplomaticInitialState),
document: createReducer('DocumentActions', DocumentActions, documentInitialState(iiifManifest, documentName, transcriptionTypes)),
document: createReducer('DocumentActions', DocumentActions, documentInitialState(iiifManifest, documentName, transcriptionTypes, variorum, derivativeNames, threePanel)),
glossary: createReducer('GlossaryActions', GlossaryActions, glossaryInitialState()),
});
}
1 change: 1 addition & 0 deletions editioncrafter/src/component/DiploMatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const DiploMatic = (props) => {
<RouteListener />
<div id="content">
<Routes>
<Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3" element={<DocumentView {...props} />} exact />
<Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2" element={<DocumentView {...props} />} exact />
<Route path="/ec/:folioID/:transcriptionType" element={<DocumentView {...props} />} exact />
<Route path="/ec/:folioID" element={<DocumentView {...props} />} exact />
Expand Down
Loading

0 comments on commit a1e80fb

Please sign in to comment.