diff --git a/.gitignore b/.gitignore index 4fb48d9..0ce313e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __tests__/integration/editioncrafter/css/ .cache/ storybook-static .DS_Store +.github diff --git a/astro-web/.gitignore b/astro-web/.gitignore index 6d4c0aa..7b1a23d 100644 --- a/astro-web/.gitignore +++ b/astro-web/.gitignore @@ -19,3 +19,6 @@ pnpm-debug.log* # macOS-specific files .DS_Store + +# github workflows +.github diff --git a/editioncrafter-umd/package.json b/editioncrafter-umd/package.json index 41a61d4..565440a 100644 --- a/editioncrafter-umd/package.json +++ b/editioncrafter-umd/package.json @@ -1,6 +1,6 @@ { "name": "@cu-mkp/editioncrafter-umd", - "version": "1.0.1", + "version": "1.0.2", "homepage": "https://cu-mkp.github.io/editioncrafter/", "description": "A simple digital critical edition publication tool", "private": false, diff --git a/editioncrafter/package-lock.json b/editioncrafter/package-lock.json index f8e0f5b..348a143 100644 --- a/editioncrafter/package-lock.json +++ b/editioncrafter/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cu-mkp/editioncrafter", - "version": "0.2.7", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cu-mkp/editioncrafter", - "version": "0.2.7", + "version": "1.0.1", "license": "MIT", "dependencies": { "@material-ui/core": "^4.12.4", diff --git a/editioncrafter/package.json b/editioncrafter/package.json index 632641a..bbc4d3e 100644 --- a/editioncrafter/package.json +++ b/editioncrafter/package.json @@ -1,6 +1,6 @@ { "name": "@cu-mkp/editioncrafter", - "version": "1.0.1", + "version": "1.0.2", "description": "A simple digital critical edition publication tool", "homepage": "https://cu-mkp.github.io/editioncrafter/", "private": false, diff --git a/editioncrafter/src/action/DocumentActions.js b/editioncrafter/src/action/DocumentActions.js index 21ac014..b69bc60 100644 --- a/editioncrafter/src/action/DocumentActions.js +++ b/editioncrafter/src/action/DocumentActions.js @@ -160,7 +160,7 @@ function parseSingleManifest(manifest, transcriptionTypes, document) { const thumbnailURL = `${bodyId}/full/${thumbnailDimensions.join(',')}/0/default.jpg`; const folio = { - id: folioID, + id: document ? `${document}_${folioID}` : folioID, doc_id: document || manifest.id, name: canvasLabel, pageNumber: i, diff --git a/editioncrafter/src/component/DocumentView.js b/editioncrafter/src/component/DocumentView.js index bb3ffa4..e5d6f3a 100644 --- a/editioncrafter/src/component/DocumentView.js +++ b/editioncrafter/src/component/DocumentView.js @@ -30,6 +30,11 @@ const DocumentView = (props) => { const navigate = useNavigate(); const location = useLocation(); + //"reload" the page if the config props change + useEffect(() => { + dispatchAction(props, 'RouteListenerSaga.userNavigatation', location); + }, [props.config]); + useEffect(() => { setSinglePaneMode(props.containerWidth < 960); }, [props.containerWidth]); @@ -62,19 +67,21 @@ const DocumentView = (props) => { } }; } - - const leftFolioID = folioID; + const leftFolioValid = Object.keys(document.folioIndex).includes(folioID); + const leftFolioID = leftFolioValid ? folioID : '-1'; let leftTranscriptionType; let rightFolioID; let rightTranscriptionType; let thirdFolioID; let thirdTranscriptionType; if (folioID2) { // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2 - leftTranscriptionType = transcriptionType; - rightFolioID = folioID2; - rightTranscriptionType = transcriptionType2 || firstTranscriptionType; + const rightFolioValid = Object.keys(document.folioIndex).includes(folioID2); + leftTranscriptionType = leftFolioValid ? transcriptionType : 'g'; + rightFolioID = rightFolioValid ? folioID2 : '-1'; + rightTranscriptionType = rightFolioValid ? transcriptionType2 ? transcriptionType2 : firstTranscriptionType : 'g'; if (folioID3) { // route /ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3 - thirdFolioID = folioID3; - thirdTranscriptionType = transcriptionType3 || firstTranscriptionType; + const thirdFolioValid = Object.keys(document.folioIndex).includes(folioID3); + thirdFolioID = thirdFolioValid ? folioID3 : '-1'; + thirdTranscriptionType = thirdFolioValid ? transcriptionType3 ? transcriptionType3 : firstTranscriptionType : 'g'; } else { thirdFolioID = '-1'; thirdTranscriptionType = 'g'; @@ -83,8 +90,8 @@ const DocumentView = (props) => { // route /ec/:folioID // route /ec/:folioID/:transcriptionType leftTranscriptionType = 'f'; - rightFolioID = folioID; - rightTranscriptionType = transcriptionType || firstTranscriptionType; + rightFolioID = leftFolioValid ? folioID : '-1'; + rightTranscriptionType = leftFolioValid ? transcriptionType ? transcriptionType : firstTranscriptionType : 'g'; thirdFolioID = '-1'; thirdTranscriptionType = 'g'; } @@ -368,6 +375,7 @@ const DocumentView = (props) => { hasNext: current_hasNext, previousFolioShortID: prevID, nextFolioShortID: nextID, + documentID: doc.variorum ? doc.folioIndex[shortID].doc_id : doc.documentName, }; }; @@ -384,6 +392,7 @@ const DocumentView = (props) => { const viewType = determineViewType(side); const key = viewPaneKey(side); const folioID = docView[side].iiifShortID; + const document = docView[side].documentID; const { transcriptionType } = docView[side]; if (viewType === 'ImageView') { @@ -425,7 +434,7 @@ const DocumentView = (props) => { documentView={docView} documentViewActions={documentViewActions} side={side} - selectedDoc={props.document.variorum && Object.keys(props.document.derivativeNames)[side === 'left' ? 0 : side === 'right' ? 1 : Object.keys(props.document.derivativeNames).length > 2 ? 2 : 1]} + selectedDoc={document ? document : props.document.variorum && Object.keys(props.document.derivativeNames)[side === 'left' ? 0 : side === 'right' ? 1 : Object.keys(props.document.derivativeNames).length > 2 ? 2 : 1]} /> ); } if (viewType === 'GlossaryView') { @@ -502,6 +511,7 @@ const DocumentView = (props) => { function mapStateToProps(state) { return { document: state.document, + glossary: state.glossary }; } diff --git a/editioncrafter/src/component/ImageGridView.js b/editioncrafter/src/component/ImageGridView.js index 7a2e677..eb6cb69 100644 --- a/editioncrafter/src/component/ImageGridView.js +++ b/editioncrafter/src/component/ImageGridView.js @@ -117,7 +117,9 @@ class ImageGridView extends React.Component { componentDidMount() { const { documentView } = this.props; const folioID = documentView[this.props.side].iiifShortID; - const thumbs = this.generateThumbs(folioID, this.state.currentDoc ? this.props.document.folios.filter((folio) => (folio.doc_id === this.state.currentDoc)) : this.props.document.folios); + const thumbs = this.generateThumbs(folioID, this.props.document.variorum && this.state.currentDoc ? this.props.document.folios.filter((folio) => (folio.doc_id === this.state.currentDoc)) : this.props.document.folios); + console.log(thumbs); + console.log(this.props.document.folios); const thumbCount = (thumbs.length > this.loadIncrement) ? this.loadIncrement : thumbs.length; const visibleThumbs = thumbs.slice(0, thumbCount); this.setState({ thumbs, visibleThumbs }); @@ -136,9 +138,9 @@ class ImageGridView extends React.Component { const thumbs = folios.map((folio, index) => ( // eslint-disable-next-line react/no-array-index-key
  • -
    {folio.name} {currentTarget.onerror = null; if (folio.image_zoom_url && currentTarget.src !== `${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`) {currentTarget.src=`${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`;} }} />
    -
    - {(folio.id === currentID) ? (`*${folio.name}`) : folio.name} +
    {folio.name} {currentTarget.onerror = null; if (folio.image_zoom_url && currentTarget.src !== `${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`) {currentTarget.src=`${folio.image_zoom_url.slice(0, -9)}full/full/0/default.jpg`;} }} />
    +
    + {folio.name}
  • diff --git a/editioncrafter/src/component/SplitPaneView.js b/editioncrafter/src/component/SplitPaneView.js index 3b25878..d697f7a 100644 --- a/editioncrafter/src/component/SplitPaneView.js +++ b/editioncrafter/src/component/SplitPaneView.js @@ -109,8 +109,8 @@ class SplitPaneView extends Component { componentDidMount() { this.updateUI(); - window.addEventListener('mousemove', this.onDrag); - window.addEventListener('mouseup', this.onEndDrag); + window.addEventListener('pointermove', this.onDrag); + window.addEventListener('pointerup', this.onEndDrag); window.addEventListener('resize', this.onResize); console.log(this.props); // Set the default width on mount @@ -129,8 +129,8 @@ class SplitPaneView extends Component { } componentWillUnmount() { - window.removeEventListener('mousemove', this.onDrag); - window.removeEventListener('mouseup', this.onEndDrag); + window.removeEventListener('pointermove', this.onDrag); + window.removeEventListener('pointerup', this.onEndDrag); window.removeEventListener('resize', this.onResize); } @@ -138,7 +138,7 @@ class SplitPaneView extends Component { const drawerIconClass = 'drawer-icon fas fa-caret-left fa-2x'; return ( -
    this.onStartDrag(position)}> +
    this.onStartDrag(position)}>
    diff --git a/editioncrafter/stories/EditionCrafter.stories.js b/editioncrafter/stories/EditionCrafter.stories.js index d3208bb..dfaf753 100644 --- a/editioncrafter/stories/EditionCrafter.stories.js +++ b/editioncrafter/stories/EditionCrafter.stories.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import EditionCrafter from '../src/index'; export const BowInTheCloud = () => ( @@ -57,25 +57,49 @@ export const IntervistePescatori = () => ( /> ); -export const MultiDocument = () => ( +export const OrnamentDesignTranslation = () => ( @@ -107,6 +131,31 @@ export const fullScreen = () => (
    ) +export const stateChange = () => { + const [manifest, setManifest] = useState('https://cu-mkp.github.io/editioncrafter/taos-baptisms-example/iiif/manifest.json'); + const [glossary, setGlossary] = useState(undefined); + const [title, setTitle] = useState('FHL_007548733_TAOS_BAPTISMS_BATCH_2') + + useEffect(() => { + setTimeout(() => { + //setManifest('https://cu-mkp.github.io/dyngleyfamily-editioncrafter-data/O_8_35/iiif/manifest.json'); + setGlossary('https://cu-mkp.github.io/editioncrafter-data/fr640_3r-3v-example/glossary.json'); + setTitle('Taos Baptisms Batch 2'); + }, 10000); + }, []) + + return () + +} + export default { title: 'EditionCrafter', };