@cu-mkp/editioncrafter 1.2.1 → 1.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/editioncrafter.js +27385 -22786
- package/dist/es/src/EditionCrafter/action/NotesActions.js +11 -0
- package/dist/es/src/EditionCrafter/action/initialState/documentInitialState.js +15 -1
- package/dist/es/src/EditionCrafter/action/initialState/notesInitialState.js +8 -0
- package/dist/es/src/EditionCrafter/action/rootReducer.js +4 -0
- package/dist/es/src/EditionCrafter/component/DiploMatic.js +19 -17
- package/dist/es/src/EditionCrafter/component/DocumentView.js +23 -5
- package/dist/es/src/EditionCrafter/component/EmptyPaneView.js +22 -0
- package/dist/es/src/EditionCrafter/component/ImageView.js +61 -40
- package/dist/es/src/EditionCrafter/component/Navigation.js +7 -0
- package/dist/es/src/EditionCrafter/component/NotesView.js +50 -0
- package/dist/es/src/EditionCrafter/component/SplitPaneView.js +10 -9
- package/dist/es/src/EditionCrafter/component/TagToolbar.jsx +14 -4
- package/dist/es/src/EditionCrafter/context/TagFilter.jsx +22 -11
- package/dist/es/src/EditionCrafter/context/TagFilterContext.js +2 -1
- package/dist/es/src/EditionCrafter/index.jsx +31 -0
- package/dist/es/src/EditionCrafter/model/DocumentHelper.js +1 -0
- package/dist/es/src/EditionCrafter/model/Folio.js +27 -1
- package/dist/es/src/EditionCrafter/saga/RouteListenerSaga.js +33 -7
- package/dist/es/src/EditionCrafter/scss/_imageView.scss +1 -1
- package/dist/es/src/EditionCrafter/scss/_notes.scss +49 -0
- package/dist/es/src/EditionCrafter/scss/editioncrafter.scss +1 -0
- package/dist/es/src/RecordList/component/Record.jsx +1 -1
- package/dist/es/src/RecordList/component/RecordListView.jsx +1 -1
- package/dist/es/src/RecordList/component/Sidebar.jsx +1 -1
- package/dist/es/src/RecordList/component/SidebarTagList.jsx +1 -1
- package/dist/es/src/RecordList/index.jsx +1 -1
- package/dist/es/src/RecordList/styles/base.css +0 -16
- package/dist/es/src/TagExplore/assets/InsertLeft.jsx +18 -0
- package/dist/es/src/TagExplore/assets/InsertRight.jsx +18 -0
- package/dist/es/src/TagExplore/assets/Left.jsx +17 -0
- package/dist/es/src/TagExplore/assets/Right.jsx +17 -0
- package/dist/es/src/TagExplore/assets/insert_left.svg +12 -0
- package/dist/es/src/TagExplore/assets/insert_right.svg +12 -0
- package/dist/es/src/TagExplore/assets/left.svg +11 -0
- package/dist/es/src/TagExplore/assets/right.svg +11 -0
- package/dist/es/src/TagExplore/components/DocumentDetail.jsx +224 -0
- package/dist/es/src/TagExplore/components/NarrowSidebar.jsx +35 -0
- package/dist/es/src/TagExplore/components/SurfaceBrowser.jsx +176 -0
- package/dist/es/src/TagExplore/components/TagExploreSidebar.jsx +55 -0
- package/dist/es/src/TagExplore/components/TagFilters.jsx +106 -0
- package/dist/es/src/TagExplore/index.jsx +108 -0
- package/dist/es/src/TagExplore/styles/base.css +192 -0
- package/dist/es/src/{RecordList/component → common/components}/Pill.jsx +2 -0
- package/dist/es/src/common/components/Pill.style.css +16 -0
- package/dist/es/src/index.jsx +3 -27
- package/package.json +2 -27
- /package/dist/es/src/{RecordList/component → common/components}/Loading.jsx +0 -0
- /package/dist/es/src/{RecordList → common}/lib/sql.js +0 -0
|
@@ -24,6 +24,27 @@ function getTagIds(html) {
|
|
|
24
24
|
return tagIds
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
function getZoneTagData(annotations) {
|
|
28
|
+
const tagIds = new Set()
|
|
29
|
+
const zoneTagIndex = {}
|
|
30
|
+
|
|
31
|
+
annotations.forEach((anno) => {
|
|
32
|
+
zoneTagIndex[anno.id] = []
|
|
33
|
+
anno.body.forEach((item) => {
|
|
34
|
+
if (item.purpose === 'classifying') {
|
|
35
|
+
const value = item.value.slice(1)
|
|
36
|
+
tagIds.add(value)
|
|
37
|
+
zoneTagIndex[anno.id].push(value)
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
tagIds: Array.from(tagIds),
|
|
44
|
+
zoneTagIndex,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
27
48
|
export async function loadFolio(folioData) {
|
|
28
49
|
if (folioData.loading) {
|
|
29
50
|
return folioData
|
|
@@ -49,6 +70,11 @@ export async function loadFolio(folioData) {
|
|
|
49
70
|
})
|
|
50
71
|
}
|
|
51
72
|
|
|
73
|
+
const { tagIds, zoneTagIndex } = getZoneTagData(folio.annotations)
|
|
74
|
+
|
|
75
|
+
folio.tagIds = [...tagIds]
|
|
76
|
+
folio.zoneTagIndex = { ...zoneTagIndex }
|
|
77
|
+
|
|
52
78
|
if (transcriptionTypes.length > 0) {
|
|
53
79
|
for await (const transcriptionType of transcriptionTypes) {
|
|
54
80
|
const { htmlURL, xmlURL } = folio.annotationURLs[transcriptionType]
|
|
@@ -68,7 +94,7 @@ export async function loadFolio(folioData) {
|
|
|
68
94
|
}
|
|
69
95
|
else {
|
|
70
96
|
folio.transcription[transcriptionType] = transcription
|
|
71
|
-
folio.tagIds = tagIds
|
|
97
|
+
folio.tagIds = [...folio.tagIds, ...tagIds]
|
|
72
98
|
folio.loading = false
|
|
73
99
|
transcriptionTypeTracker[transcriptionType] = true
|
|
74
100
|
}
|
|
@@ -5,14 +5,12 @@ import { putResolveAction } from '../model/ReduxStore'
|
|
|
5
5
|
|
|
6
6
|
const justDocument = state => state.document
|
|
7
7
|
const justGlossary = state => state.glossary
|
|
8
|
+
const justNotes = state => state.notes
|
|
8
9
|
|
|
9
|
-
function*
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const res = yield fetch(headerUrl)
|
|
10
|
+
function* parseTagUrl(url) {
|
|
11
|
+
const res = yield fetch(url)
|
|
13
12
|
|
|
14
13
|
if (!res.ok) {
|
|
15
|
-
yield putResolveAction('DocumentActions.loadTags', tags)
|
|
16
14
|
return null
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -22,6 +20,8 @@ function* parseTags(headerUrl) {
|
|
|
22
20
|
|
|
23
21
|
const categoryEls = headerDoc.querySelectorAll('tei-category')
|
|
24
22
|
|
|
23
|
+
const documentTags = {}
|
|
24
|
+
|
|
25
25
|
for (const categoryEl of categoryEls) {
|
|
26
26
|
const xmlId = categoryEl.getAttribute('id')
|
|
27
27
|
|
|
@@ -29,12 +29,28 @@ function* parseTags(headerUrl) {
|
|
|
29
29
|
const desc = categoryEl.querySelector('tei-catdesc')
|
|
30
30
|
if (desc) {
|
|
31
31
|
const name = desc.textContent
|
|
32
|
-
|
|
32
|
+
documentTags[xmlId] = name
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
return documentTags
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function* parseTags(headerUrl) {
|
|
41
|
+
if (typeof headerUrl === 'string') {
|
|
42
|
+
const result = yield parseTagUrl(headerUrl)
|
|
43
|
+
yield putResolveAction('DocumentActions.loadTags', result)
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const tags = {}
|
|
47
|
+
|
|
48
|
+
for (const docId of Object.keys(headerUrl)) {
|
|
49
|
+
tags[docId] = yield parseTagUrl(headerUrl[docId])
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
yield putResolveAction('DocumentActions.loadTags', tags)
|
|
53
|
+
}
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
function* userNavigation(action) {
|
|
@@ -48,6 +64,7 @@ function* userNavigation(action) {
|
|
|
48
64
|
yield resolveDocumentManifest()
|
|
49
65
|
yield resolveDocumentTags()
|
|
50
66
|
yield resolveGlossary()
|
|
67
|
+
yield resolveNotes()
|
|
51
68
|
yield resolveFolio(pathSegments)
|
|
52
69
|
break
|
|
53
70
|
}
|
|
@@ -134,6 +151,15 @@ function* resolveGlossary() {
|
|
|
134
151
|
}
|
|
135
152
|
}
|
|
136
153
|
|
|
154
|
+
function* resolveNotes() {
|
|
155
|
+
const notes = yield select(justNotes)
|
|
156
|
+
if (!notes.loaded && notes.URL) {
|
|
157
|
+
const response = yield fetch(notes.URL)
|
|
158
|
+
const txt = yield response.text()
|
|
159
|
+
yield putResolveAction('NotesActions.loadNotes', txt)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
137
163
|
export default function* routeListenerSaga() {
|
|
138
164
|
yield takeEvery('RouteListenerSaga.userNavigation', userNavigation)
|
|
139
165
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.editioncrafter {
|
|
2
|
+
|
|
3
|
+
#notesView {
|
|
4
|
+
|
|
5
|
+
#notesViewInner {
|
|
6
|
+
margin: 5px 0 0 0;
|
|
7
|
+
// @include md {
|
|
8
|
+
// margin: 52px 0 0 0;
|
|
9
|
+
// }
|
|
10
|
+
width: calc(100% - 1.2rem);
|
|
11
|
+
max-height: calc(100vh - 170px);
|
|
12
|
+
padding: 5px 16px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#notesContent {
|
|
16
|
+
padding: max(80px, 5rem) 0 0;
|
|
17
|
+
max-height: 100vh;
|
|
18
|
+
-webkit-user-select: text;
|
|
19
|
+
-moz-user-select: text;
|
|
20
|
+
-ms-user-select: text;
|
|
21
|
+
user-select: text;
|
|
22
|
+
min-width: max(10rem, 160px);
|
|
23
|
+
@include md {
|
|
24
|
+
padding: max(3.5rem, 56px) 0 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
table {
|
|
28
|
+
margin-top: 30px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
td, th {
|
|
32
|
+
border: 1px solid #ddd;
|
|
33
|
+
padding: 8px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
tr:nth-child(even){
|
|
37
|
+
background-color: #f2f2f2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
th {
|
|
41
|
+
padding-top: 12px;
|
|
42
|
+
padding-bottom: 12px;
|
|
43
|
+
text-align: left;
|
|
44
|
+
background-color: gray;
|
|
45
|
+
color: white;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'react'
|
|
2
2
|
import { IoCheckmarkSharp } from 'react-icons/io5'
|
|
3
|
+
import Pill from '../../common/components/Pill'
|
|
3
4
|
import FilterContext from '../context/FilterContext'
|
|
4
|
-
import Pill from './Pill'
|
|
5
5
|
|
|
6
6
|
function TagPill(props) {
|
|
7
7
|
const { categories, toggleCategoryFilter, tags, toggleTagFilter } = useContext(FilterContext)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import initSqlJs from 'sql.js'
|
|
3
|
-
import Loading from '
|
|
3
|
+
import Loading from '../common/components/Loading'
|
|
4
4
|
import RecordListView from './component/RecordListView'
|
|
5
5
|
import Sidebar from './component/Sidebar'
|
|
6
6
|
|
|
@@ -60,19 +60,3 @@
|
|
|
60
60
|
background-color: #ffffff;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.editioncrafter-record-list .pill {
|
|
64
|
-
appearance: none;
|
|
65
|
-
display: flex;
|
|
66
|
-
height: 32px;
|
|
67
|
-
padding: 4px 12px;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
align-items: center;
|
|
70
|
-
gap: 4px;
|
|
71
|
-
border-radius: 50px;
|
|
72
|
-
border: 1px solid #CEDAE7;
|
|
73
|
-
background: #CEDAE7;
|
|
74
|
-
color: #0A0A0A;
|
|
75
|
-
font-family: Inter;
|
|
76
|
-
font-size: 14px;
|
|
77
|
-
font-weight: 500;
|
|
78
|
-
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function InsertLeft() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="28" height="21" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<g id="fluent:document-one-page-20-regular" clipPath="url(#clip0_527_47401)">
|
|
5
|
+
<path id="Vector" d="M1.26984 0H6.34921C6.68599 0 7.00898 0.158035 7.24712 0.43934C7.48526 0.720644 7.61905 1.10218 7.61905 1.5V10.5C7.61905 10.8978 7.48526 11.2794 7.24712 11.5607C7.00898 11.842 6.68599 12 6.34921 12H1.26984C0.933058 12 0.610069 11.842 0.371928 11.5607C0.133786 11.2794 0 10.8978 0 10.5V1.5C0 1.10218 0.133786 0.720644 0.371928 0.43934C0.610069 0.158035 0.933058 0 1.26984 0ZM1.26984 0.75C1.10145 0.75 0.939955 0.829018 0.820885 0.96967C0.701814 1.11032 0.634921 1.30109 0.634921 1.5V10.5C0.634921 10.6989 0.701814 10.8897 0.820885 11.0303C0.939955 11.171 1.10145 11.25 1.26984 11.25H6.34921C6.5176 11.25 6.67909 11.171 6.79816 11.0303C6.91723 10.8897 6.98413 10.6989 6.98413 10.5V1.5C6.98413 1.30109 6.91723 1.11032 6.79816 0.96967C6.67909 0.829018 6.5176 0.75 6.34921 0.75H1.26984Z" fill="white" />
|
|
6
|
+
<path id="Vector_2" opacity="0.4" d="M9.6507 0H14.7301C15.0668 0 15.3898 0.158035 15.628 0.43934C15.8661 0.720644 15.9999 1.10218 15.9999 1.5V10.5C15.9999 10.8978 15.8661 11.2794 15.628 11.5607C15.3898 11.842 15.0668 12 14.7301 12H9.6507C9.31392 12 8.99093 11.842 8.75279 11.5607C8.51465 11.2794 8.38086 10.8978 8.38086 10.5V1.5C8.38086 1.10218 8.51465 0.720644 8.75279 0.43934C8.99093 0.158035 9.31392 0 9.6507 0ZM9.6507 0.75C9.48231 0.75 9.32081 0.829018 9.20174 0.96967C9.08267 1.11032 9.01578 1.30109 9.01578 1.5V10.5C9.01578 10.6989 9.08267 10.8897 9.20174 11.0303C9.32081 11.171 9.48231 11.25 9.6507 11.25H14.7301C14.8985 11.25 15.06 11.171 15.179 11.0303C15.2981 10.8897 15.365 10.6989 15.365 10.5V1.5C15.365 1.30109 15.2981 1.11032 15.179 0.96967C15.06 0.829018 14.8985 0.75 14.7301 0.75H9.6507Z" fill="white" />
|
|
7
|
+
<path id="Vector_3" d="M5.82826 6.11765C5.82826 6.16445 5.81101 6.20934 5.7803 6.24243C5.74959 6.27553 5.70794 6.29412 5.66451 6.29412H4.02709V8.05882C4.02709 8.10563 4.00984 8.15051 3.97913 8.18361C3.94842 8.2167 3.90677 8.23529 3.86335 8.23529C3.81992 8.23529 3.77827 8.2167 3.74756 8.18361C3.71686 8.15051 3.6996 8.10563 3.6996 8.05882V6.29412H2.06218C2.01875 6.29412 1.9771 6.27553 1.9464 6.24243C1.91569 6.20934 1.89844 6.16445 1.89844 6.11765C1.89844 6.07084 1.91569 6.02596 1.9464 5.99286C1.9771 5.95977 2.01875 5.94118 2.06218 5.94118H3.6996V4.17647C3.6996 4.12967 3.71686 4.08478 3.74756 4.05169C3.77827 4.01859 3.81992 4 3.86335 4C3.90677 4 3.94842 4.01859 3.97913 4.05169C4.00984 4.08478 4.02709 4.12967 4.02709 4.17647V5.94118H5.66451C5.70794 5.94118 5.74959 5.95977 5.7803 5.99286C5.81101 6.02596 5.82826 6.07084 5.82826 6.11765Z" fill="white" />
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="clip0_527_47401">
|
|
11
|
+
<rect width="16" height="12" fill="white" />
|
|
12
|
+
</clipPath>
|
|
13
|
+
</defs>
|
|
14
|
+
</svg>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default InsertLeft
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function InsertRight() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="28" height="21" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<g clipPath="url(#clip0_527_47406)">
|
|
5
|
+
<path opacity="0.4" d="M1.27 0H6.35C6.68682 0 7.00985 0.158035 7.24802 0.43934C7.4862 0.720644 7.62 1.10218 7.62 1.5V10.5C7.62 10.8978 7.4862 11.2794 7.24802 11.5607C7.00985 11.842 6.68682 12 6.35 12H1.27C0.933175 12 0.610146 11.842 0.371974 11.5607C0.133803 11.2794 0 10.8978 0 10.5V1.5C0 1.10218 0.133803 0.720644 0.371974 0.43934C0.610146 0.158035 0.933175 0 1.27 0ZM1.27 0.75C1.10159 0.75 0.940073 0.829018 0.820987 0.96967C0.701902 1.11032 0.635 1.30109 0.635 1.5V10.5C0.635 10.6989 0.701902 10.8897 0.820987 11.0303C0.940073 11.171 1.10159 11.25 1.27 11.25H6.35C6.51841 11.25 6.67993 11.171 6.79901 11.0303C6.9181 10.8897 6.985 10.6989 6.985 10.5V1.5C6.985 1.30109 6.9181 1.11032 6.79901 0.96967C6.67993 0.829018 6.51841 0.75 6.35 0.75H1.27Z" fill="white" />
|
|
6
|
+
<path d="M9.64988 0H14.7299C15.0667 0 15.3897 0.158035 15.6279 0.43934C15.8661 0.720644 15.9999 1.10218 15.9999 1.5V10.5C15.9999 10.8978 15.8661 11.2794 15.6279 11.5607C15.3897 11.842 15.0667 12 14.7299 12H9.64988C9.31306 12 8.99003 11.842 8.75186 11.5607C8.51369 11.2794 8.37988 10.8978 8.37988 10.5V1.5C8.37988 1.10218 8.51369 0.720644 8.75186 0.43934C8.99003 0.158035 9.31306 0 9.64988 0ZM9.64988 0.75C9.48147 0.75 9.31996 0.829018 9.20087 0.96967C9.08178 1.11032 9.01488 1.30109 9.01488 1.5V10.5C9.01488 10.6989 9.08178 10.8897 9.20087 11.0303C9.31996 11.171 9.48147 11.25 9.64988 11.25H14.7299C14.8983 11.25 15.0598 11.171 15.1789 11.0303C15.298 10.8897 15.3649 10.6989 15.3649 10.5V1.5C15.3649 1.30109 15.298 1.11032 15.1789 0.96967C15.0598 0.829018 14.8983 0.75 14.7299 0.75H9.64988Z" fill="white" />
|
|
7
|
+
<path d="M14.2096 6.10028C14.2096 6.1404 14.1924 6.17887 14.1616 6.20724C14.1309 6.23561 14.0893 6.25154 14.0458 6.25154H12.4082V7.76415C12.4082 7.80426 12.391 7.84274 12.3603 7.87111C12.3295 7.89947 12.2879 7.91541 12.2445 7.91541C12.201 7.91541 12.1594 7.89947 12.1287 7.87111C12.0979 7.84274 12.0807 7.80426 12.0807 7.76415V6.25154H10.4431C10.3996 6.25154 10.358 6.23561 10.3273 6.20724C10.2966 6.17887 10.2793 6.1404 10.2793 6.10028C10.2793 6.06017 10.2966 6.02169 10.3273 5.99332C10.358 5.96496 10.3996 5.94902 10.4431 5.94902H12.0807V4.43642C12.0807 4.3963 12.0979 4.35783 12.1287 4.32946C12.1594 4.30109 12.201 4.28516 12.2445 4.28516C12.2879 4.28516 12.3295 4.30109 12.3603 4.32946C12.391 4.35783 12.4082 4.3963 12.4082 4.43642V5.94902H14.0458C14.0893 5.94902 14.1309 5.96496 14.1616 5.99332C14.1924 6.02169 14.2096 6.06017 14.2096 6.10028Z" fill="white" />
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="clip0_527_47406">
|
|
11
|
+
<rect width="16" height="12" fill="white" />
|
|
12
|
+
</clipPath>
|
|
13
|
+
</defs>
|
|
14
|
+
</svg>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default InsertRight
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function Left() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<g clipPath="url(#clip0_527_47371)">
|
|
5
|
+
<path d="M1.57302 0H6.01747C6.31215 0 6.59477 0.144866 6.80314 0.402728C7.01152 0.660591 7.12858 1.01033 7.12858 1.375V9.625C7.12858 9.98967 7.01152 10.3394 6.80314 10.5973C6.59477 10.8551 6.31215 11 6.01747 11H1.57302C1.27834 11 0.995725 10.8551 0.787351 10.5973C0.578977 10.3394 0.461914 9.98967 0.461914 9.625V1.375C0.461914 1.01033 0.578977 0.660591 0.787351 0.402728C0.995725 0.144866 1.27834 0 1.57302 0ZM1.57302 0.6875C1.42568 0.6875 1.28437 0.759933 1.18019 0.888864C1.076 1.0178 1.01747 1.19266 1.01747 1.375V9.625C1.01747 9.80734 1.076 9.98221 1.18019 10.1111C1.28437 10.2401 1.42568 10.3125 1.57302 10.3125H6.01747C6.16481 10.3125 6.30612 10.2401 6.41031 10.1111C6.51449 9.98221 6.57302 9.80734 6.57302 9.625V1.375C6.57302 1.19266 6.51449 1.0178 6.41031 0.888864C6.30612 0.759933 6.16481 0.6875 6.01747 0.6875H1.57302Z" fill="white" />
|
|
6
|
+
<path opacity="0.4" d="M8.90603 0H13.3505C13.6452 0 13.9278 0.144866 14.1362 0.402728C14.3445 0.660591 14.4616 1.01033 14.4616 1.375V9.625C14.4616 9.98967 14.3445 10.3394 14.1362 10.5973C13.9278 10.8551 13.6452 11 13.3505 11H8.90603C8.61135 11 8.32873 10.8551 8.12036 10.5973C7.91198 10.3394 7.79492 9.98967 7.79492 9.625V1.375C7.79492 1.01033 7.91198 0.660591 8.12036 0.402728C8.32873 0.144866 8.61135 0 8.90603 0ZM8.90603 0.6875C8.75869 0.6875 8.61738 0.759933 8.5132 0.888864C8.40901 1.0178 8.35048 1.19266 8.35048 1.375V9.625C8.35048 9.80734 8.40901 9.98221 8.5132 10.1111C8.61738 10.2401 8.75869 10.3125 8.90603 10.3125H13.3505C13.4978 10.3125 13.6391 10.2401 13.7433 10.1111C13.8475 9.98221 13.906 9.80734 13.906 9.625V1.375C13.906 1.19266 13.8475 1.0178 13.7433 0.888864C13.6391 0.759933 13.4978 0.6875 13.3505 0.6875H8.90603Z" fill="white" />
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="clip0_527_47371">
|
|
10
|
+
<rect width="14" height="11" fill="white" transform="translate(0.461914)" />
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Left
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function Right() {
|
|
2
|
+
return (
|
|
3
|
+
<svg width="14" height="11" viewBox="0 0 14 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<g clipPath="url(#clip0_527_47381)">
|
|
5
|
+
<path opacity="0.4" d="M1.11111 0H5.55555C5.85024 0 6.13285 0.144866 6.34123 0.402728C6.5496 0.660591 6.66667 1.01033 6.66667 1.375V9.625C6.66667 9.98967 6.5496 10.3394 6.34123 10.5973C6.13285 10.8551 5.85024 11 5.55555 11H1.11111C0.816426 11 0.533811 10.8551 0.325437 10.5973C0.117063 10.3394 0 9.98967 0 9.625V1.375C0 1.01033 0.117063 0.660591 0.325437 0.402728C0.533811 0.144866 0.816426 0 1.11111 0ZM1.11111 0.6875C0.963768 0.6875 0.822461 0.759933 0.718274 0.888864C0.614087 1.0178 0.555555 1.19266 0.555555 1.375V9.625C0.555555 9.80734 0.614087 9.98221 0.718274 10.1111C0.822461 10.2401 0.963768 10.3125 1.11111 10.3125H5.55555C5.7029 10.3125 5.8442 10.2401 5.94839 10.1111C6.05258 9.98221 6.11111 9.80734 6.11111 9.625V1.375C6.11111 1.19266 6.05258 1.0178 5.94839 0.888864C5.8442 0.759933 5.7029 0.6875 5.55555 0.6875H1.11111Z" fill="white" />
|
|
6
|
+
<path d="M8.44412 0H12.8886C13.1832 0 13.4659 0.144866 13.6742 0.402728C13.8826 0.660591 13.9997 1.01033 13.9997 1.375V9.625C13.9997 9.98967 13.8826 10.3394 13.6742 10.5973C13.4659 10.8551 13.1832 11 12.8886 11H8.44412C8.14943 11 7.86682 10.8551 7.65844 10.5973C7.45007 10.3394 7.33301 9.98967 7.33301 9.625V1.375C7.33301 1.01033 7.45007 0.660591 7.65844 0.402728C7.86682 0.144866 8.14943 0 8.44412 0ZM8.44412 0.6875C8.29678 0.6875 8.15547 0.759933 8.05128 0.888864C7.94709 1.0178 7.88856 1.19266 7.88856 1.375V9.625C7.88856 9.80734 7.94709 9.98221 8.05128 10.1111C8.15547 10.2401 8.29678 10.3125 8.44412 10.3125H12.8886C13.0359 10.3125 13.1772 10.2401 13.2814 10.1111C13.3856 9.98221 13.4441 9.80734 13.4441 9.625V1.375C13.4441 1.19266 13.3856 1.0178 13.2814 0.888864C13.1772 0.759933 13.0359 0.6875 12.8886 0.6875H8.44412Z" fill="white" />
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="clip0_527_47381">
|
|
10
|
+
<rect width="14" height="11" fill="white" />
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Right
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g id="fluent:document-one-page-20-regular" clip-path="url(#clip0_527_47401)">
|
|
3
|
+
<path id="Vector" d="M1.26984 0H6.34921C6.68599 0 7.00898 0.158035 7.24712 0.43934C7.48526 0.720644 7.61905 1.10218 7.61905 1.5V10.5C7.61905 10.8978 7.48526 11.2794 7.24712 11.5607C7.00898 11.842 6.68599 12 6.34921 12H1.26984C0.933058 12 0.610069 11.842 0.371928 11.5607C0.133786 11.2794 0 10.8978 0 10.5V1.5C0 1.10218 0.133786 0.720644 0.371928 0.43934C0.610069 0.158035 0.933058 0 1.26984 0ZM1.26984 0.75C1.10145 0.75 0.939955 0.829018 0.820885 0.96967C0.701814 1.11032 0.634921 1.30109 0.634921 1.5V10.5C0.634921 10.6989 0.701814 10.8897 0.820885 11.0303C0.939955 11.171 1.10145 11.25 1.26984 11.25H6.34921C6.5176 11.25 6.67909 11.171 6.79816 11.0303C6.91723 10.8897 6.98413 10.6989 6.98413 10.5V1.5C6.98413 1.30109 6.91723 1.11032 6.79816 0.96967C6.67909 0.829018 6.5176 0.75 6.34921 0.75H1.26984Z" fill="white"/>
|
|
4
|
+
<path id="Vector_2" opacity="0.4" d="M9.6507 0H14.7301C15.0668 0 15.3898 0.158035 15.628 0.43934C15.8661 0.720644 15.9999 1.10218 15.9999 1.5V10.5C15.9999 10.8978 15.8661 11.2794 15.628 11.5607C15.3898 11.842 15.0668 12 14.7301 12H9.6507C9.31392 12 8.99093 11.842 8.75279 11.5607C8.51465 11.2794 8.38086 10.8978 8.38086 10.5V1.5C8.38086 1.10218 8.51465 0.720644 8.75279 0.43934C8.99093 0.158035 9.31392 0 9.6507 0ZM9.6507 0.75C9.48231 0.75 9.32081 0.829018 9.20174 0.96967C9.08267 1.11032 9.01578 1.30109 9.01578 1.5V10.5C9.01578 10.6989 9.08267 10.8897 9.20174 11.0303C9.32081 11.171 9.48231 11.25 9.6507 11.25H14.7301C14.8985 11.25 15.06 11.171 15.179 11.0303C15.2981 10.8897 15.365 10.6989 15.365 10.5V1.5C15.365 1.30109 15.2981 1.11032 15.179 0.96967C15.06 0.829018 14.8985 0.75 14.7301 0.75H9.6507Z" fill="white"/>
|
|
5
|
+
<path id="Vector_3" d="M5.82826 6.11765C5.82826 6.16445 5.81101 6.20934 5.7803 6.24243C5.74959 6.27553 5.70794 6.29412 5.66451 6.29412H4.02709V8.05882C4.02709 8.10563 4.00984 8.15051 3.97913 8.18361C3.94842 8.2167 3.90677 8.23529 3.86335 8.23529C3.81992 8.23529 3.77827 8.2167 3.74756 8.18361C3.71686 8.15051 3.6996 8.10563 3.6996 8.05882V6.29412H2.06218C2.01875 6.29412 1.9771 6.27553 1.9464 6.24243C1.91569 6.20934 1.89844 6.16445 1.89844 6.11765C1.89844 6.07084 1.91569 6.02596 1.9464 5.99286C1.9771 5.95977 2.01875 5.94118 2.06218 5.94118H3.6996V4.17647C3.6996 4.12967 3.71686 4.08478 3.74756 4.05169C3.77827 4.01859 3.81992 4 3.86335 4C3.90677 4 3.94842 4.01859 3.97913 4.05169C4.00984 4.08478 4.02709 4.12967 4.02709 4.17647V5.94118H5.66451C5.70794 5.94118 5.74959 5.95977 5.7803 5.99286C5.81101 6.02596 5.82826 6.07084 5.82826 6.11765Z" fill="white"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_527_47401">
|
|
9
|
+
<rect width="16" height="12" fill="white"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_527_47406)">
|
|
3
|
+
<path opacity="0.4" d="M1.27 0H6.35C6.68682 0 7.00985 0.158035 7.24802 0.43934C7.4862 0.720644 7.62 1.10218 7.62 1.5V10.5C7.62 10.8978 7.4862 11.2794 7.24802 11.5607C7.00985 11.842 6.68682 12 6.35 12H1.27C0.933175 12 0.610146 11.842 0.371974 11.5607C0.133803 11.2794 0 10.8978 0 10.5V1.5C0 1.10218 0.133803 0.720644 0.371974 0.43934C0.610146 0.158035 0.933175 0 1.27 0ZM1.27 0.75C1.10159 0.75 0.940073 0.829018 0.820987 0.96967C0.701902 1.11032 0.635 1.30109 0.635 1.5V10.5C0.635 10.6989 0.701902 10.8897 0.820987 11.0303C0.940073 11.171 1.10159 11.25 1.27 11.25H6.35C6.51841 11.25 6.67993 11.171 6.79901 11.0303C6.9181 10.8897 6.985 10.6989 6.985 10.5V1.5C6.985 1.30109 6.9181 1.11032 6.79901 0.96967C6.67993 0.829018 6.51841 0.75 6.35 0.75H1.27Z" fill="white"/>
|
|
4
|
+
<path d="M9.64988 0H14.7299C15.0667 0 15.3897 0.158035 15.6279 0.43934C15.8661 0.720644 15.9999 1.10218 15.9999 1.5V10.5C15.9999 10.8978 15.8661 11.2794 15.6279 11.5607C15.3897 11.842 15.0667 12 14.7299 12H9.64988C9.31306 12 8.99003 11.842 8.75186 11.5607C8.51369 11.2794 8.37988 10.8978 8.37988 10.5V1.5C8.37988 1.10218 8.51369 0.720644 8.75186 0.43934C8.99003 0.158035 9.31306 0 9.64988 0ZM9.64988 0.75C9.48147 0.75 9.31996 0.829018 9.20087 0.96967C9.08178 1.11032 9.01488 1.30109 9.01488 1.5V10.5C9.01488 10.6989 9.08178 10.8897 9.20087 11.0303C9.31996 11.171 9.48147 11.25 9.64988 11.25H14.7299C14.8983 11.25 15.0598 11.171 15.1789 11.0303C15.298 10.8897 15.3649 10.6989 15.3649 10.5V1.5C15.3649 1.30109 15.298 1.11032 15.1789 0.96967C15.0598 0.829018 14.8983 0.75 14.7299 0.75H9.64988Z" fill="white"/>
|
|
5
|
+
<path d="M14.2096 6.10028C14.2096 6.1404 14.1924 6.17887 14.1616 6.20724C14.1309 6.23561 14.0893 6.25154 14.0458 6.25154H12.4082V7.76415C12.4082 7.80426 12.391 7.84274 12.3603 7.87111C12.3295 7.89947 12.2879 7.91541 12.2445 7.91541C12.201 7.91541 12.1594 7.89947 12.1287 7.87111C12.0979 7.84274 12.0807 7.80426 12.0807 7.76415V6.25154H10.4431C10.3996 6.25154 10.358 6.23561 10.3273 6.20724C10.2966 6.17887 10.2793 6.1404 10.2793 6.10028C10.2793 6.06017 10.2966 6.02169 10.3273 5.99332C10.358 5.96496 10.3996 5.94902 10.4431 5.94902H12.0807V4.43642C12.0807 4.3963 12.0979 4.35783 12.1287 4.32946C12.1594 4.30109 12.201 4.28516 12.2445 4.28516C12.2879 4.28516 12.3295 4.30109 12.3603 4.32946C12.391 4.35783 12.4082 4.3963 12.4082 4.43642V5.94902H14.0458C14.0893 5.94902 14.1309 5.96496 14.1616 5.99332C14.1924 6.02169 14.2096 6.06017 14.2096 6.10028Z" fill="white"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_527_47406">
|
|
9
|
+
<rect width="16" height="12" fill="white"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_527_47371)">
|
|
3
|
+
<path d="M1.57302 0H6.01747C6.31215 0 6.59477 0.144866 6.80314 0.402728C7.01152 0.660591 7.12858 1.01033 7.12858 1.375V9.625C7.12858 9.98967 7.01152 10.3394 6.80314 10.5973C6.59477 10.8551 6.31215 11 6.01747 11H1.57302C1.27834 11 0.995725 10.8551 0.787351 10.5973C0.578977 10.3394 0.461914 9.98967 0.461914 9.625V1.375C0.461914 1.01033 0.578977 0.660591 0.787351 0.402728C0.995725 0.144866 1.27834 0 1.57302 0ZM1.57302 0.6875C1.42568 0.6875 1.28437 0.759933 1.18019 0.888864C1.076 1.0178 1.01747 1.19266 1.01747 1.375V9.625C1.01747 9.80734 1.076 9.98221 1.18019 10.1111C1.28437 10.2401 1.42568 10.3125 1.57302 10.3125H6.01747C6.16481 10.3125 6.30612 10.2401 6.41031 10.1111C6.51449 9.98221 6.57302 9.80734 6.57302 9.625V1.375C6.57302 1.19266 6.51449 1.0178 6.41031 0.888864C6.30612 0.759933 6.16481 0.6875 6.01747 0.6875H1.57302Z" fill="white"/>
|
|
4
|
+
<path opacity="0.4" d="M8.90603 0H13.3505C13.6452 0 13.9278 0.144866 14.1362 0.402728C14.3445 0.660591 14.4616 1.01033 14.4616 1.375V9.625C14.4616 9.98967 14.3445 10.3394 14.1362 10.5973C13.9278 10.8551 13.6452 11 13.3505 11H8.90603C8.61135 11 8.32873 10.8551 8.12036 10.5973C7.91198 10.3394 7.79492 9.98967 7.79492 9.625V1.375C7.79492 1.01033 7.91198 0.660591 8.12036 0.402728C8.32873 0.144866 8.61135 0 8.90603 0ZM8.90603 0.6875C8.75869 0.6875 8.61738 0.759933 8.5132 0.888864C8.40901 1.0178 8.35048 1.19266 8.35048 1.375V9.625C8.35048 9.80734 8.40901 9.98221 8.5132 10.1111C8.61738 10.2401 8.75869 10.3125 8.90603 10.3125H13.3505C13.4978 10.3125 13.6391 10.2401 13.7433 10.1111C13.8475 9.98221 13.906 9.80734 13.906 9.625V1.375C13.906 1.19266 13.8475 1.0178 13.7433 0.888864C13.6391 0.759933 13.4978 0.6875 13.3505 0.6875H8.90603Z" fill="white"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_527_47371">
|
|
8
|
+
<rect width="14" height="11" fill="white" transform="translate(0.461914)"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="14" height="11" viewBox="0 0 14 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_527_47381)">
|
|
3
|
+
<path opacity="0.4" d="M1.11111 0H5.55555C5.85024 0 6.13285 0.144866 6.34123 0.402728C6.5496 0.660591 6.66667 1.01033 6.66667 1.375V9.625C6.66667 9.98967 6.5496 10.3394 6.34123 10.5973C6.13285 10.8551 5.85024 11 5.55555 11H1.11111C0.816426 11 0.533811 10.8551 0.325437 10.5973C0.117063 10.3394 0 9.98967 0 9.625V1.375C0 1.01033 0.117063 0.660591 0.325437 0.402728C0.533811 0.144866 0.816426 0 1.11111 0ZM1.11111 0.6875C0.963768 0.6875 0.822461 0.759933 0.718274 0.888864C0.614087 1.0178 0.555555 1.19266 0.555555 1.375V9.625C0.555555 9.80734 0.614087 9.98221 0.718274 10.1111C0.822461 10.2401 0.963768 10.3125 1.11111 10.3125H5.55555C5.7029 10.3125 5.8442 10.2401 5.94839 10.1111C6.05258 9.98221 6.11111 9.80734 6.11111 9.625V1.375C6.11111 1.19266 6.05258 1.0178 5.94839 0.888864C5.8442 0.759933 5.7029 0.6875 5.55555 0.6875H1.11111Z" fill="white"/>
|
|
4
|
+
<path d="M8.44412 0H12.8886C13.1832 0 13.4659 0.144866 13.6742 0.402728C13.8826 0.660591 13.9997 1.01033 13.9997 1.375V9.625C13.9997 9.98967 13.8826 10.3394 13.6742 10.5973C13.4659 10.8551 13.1832 11 12.8886 11H8.44412C8.14943 11 7.86682 10.8551 7.65844 10.5973C7.45007 10.3394 7.33301 9.98967 7.33301 9.625V1.375C7.33301 1.01033 7.45007 0.660591 7.65844 0.402728C7.86682 0.144866 8.14943 0 8.44412 0ZM8.44412 0.6875C8.29678 0.6875 8.15547 0.759933 8.05128 0.888864C7.94709 1.0178 7.88856 1.19266 7.88856 1.375V9.625C7.88856 9.80734 7.94709 9.98221 8.05128 10.1111C8.15547 10.2401 8.29678 10.3125 8.44412 10.3125H12.8886C13.0359 10.3125 13.1772 10.2401 13.2814 10.1111C13.3856 9.98221 13.4441 9.80734 13.4441 9.625V1.375C13.4441 1.19266 13.3856 1.0178 13.2814 0.888864C13.1772 0.759933 13.0359 0.6875 12.8886 0.6875H8.44412Z" fill="white"/>
|
|
5
|
+
</g>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_527_47381">
|
|
8
|
+
<rect width="14" height="11" fill="white"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Accordion, AccordionDetails, AccordionSummary, Grid, Typography } from '@material-ui/core'
|
|
2
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
|
|
3
|
+
import { useEffect, useMemo } from 'react'
|
|
4
|
+
import { getObjs } from '../../common/lib/sql'
|
|
5
|
+
import InsertLeft from '../assets/InsertLeft'
|
|
6
|
+
import InsertRight from '../assets/InsertRight'
|
|
7
|
+
import Left from '../assets/Left'
|
|
8
|
+
import Right from '../assets/Right'
|
|
9
|
+
|
|
10
|
+
const MAX_THUMBNAIL_DIMENSION = 100
|
|
11
|
+
|
|
12
|
+
function getData(db, docID, tags = []) {
|
|
13
|
+
const surfaceStmt = db.prepare(`
|
|
14
|
+
SELECT
|
|
15
|
+
surfaces.id AS id,
|
|
16
|
+
surfaces.name AS name,
|
|
17
|
+
surfaces.xml_id AS xml_id,
|
|
18
|
+
surfaces.width AS width,
|
|
19
|
+
surfaces.height AS height,
|
|
20
|
+
surfaces.image_type AS image_type,
|
|
21
|
+
surfaces.image_url AS image_url,
|
|
22
|
+
surfaces.position AS position,
|
|
23
|
+
taggings.tag_id
|
|
24
|
+
FROM
|
|
25
|
+
surfaces
|
|
26
|
+
LEFT JOIN
|
|
27
|
+
elements
|
|
28
|
+
ON
|
|
29
|
+
surfaces.id = elements.surface_id
|
|
30
|
+
LEFT JOIN
|
|
31
|
+
taggings
|
|
32
|
+
ON
|
|
33
|
+
elements.id = taggings.element_id
|
|
34
|
+
WHERE
|
|
35
|
+
document_id=${docID}${tags.length ? ` AND taggings.tag_id IN (${tags.join(',')})` : ''}
|
|
36
|
+
ORDER BY
|
|
37
|
+
surfaces.id, position
|
|
38
|
+
`)
|
|
39
|
+
|
|
40
|
+
// add thumbnail URLs
|
|
41
|
+
const surfaces = getObjs(surfaceStmt)
|
|
42
|
+
for (const surface of surfaces) {
|
|
43
|
+
surface.thumbnail_url = getThumbnailURL(surface)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return surfaces
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getThumbnailURL(surface) {
|
|
50
|
+
const { image_url, width, height, image_type } = surface
|
|
51
|
+
|
|
52
|
+
const ratio = height !== 0 ? width / height : 0
|
|
53
|
+
|
|
54
|
+
let thumbnailDimensions = []
|
|
55
|
+
if (ratio > 1) {
|
|
56
|
+
thumbnailDimensions = [MAX_THUMBNAIL_DIMENSION, Math.round(MAX_THUMBNAIL_DIMENSION / ratio)]
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
thumbnailDimensions = [Math.round(MAX_THUMBNAIL_DIMENSION * ratio), MAX_THUMBNAIL_DIMENSION]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const thumbnailURL = image_type === 'iiif'
|
|
63
|
+
? `${image_url}/full/${thumbnailDimensions.join(',')}/0/default.jpg`
|
|
64
|
+
: image_url
|
|
65
|
+
|
|
66
|
+
return thumbnailURL
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function Thumbnail(props) {
|
|
70
|
+
const { surfaceID, name, imageURL, thumbnailURL, onClick, selection, info } = props
|
|
71
|
+
|
|
72
|
+
const isLeft = useMemo(() => (selection && selection?.left?.localID === info?.localID && selection?.left?.surfaceID === info?.surfaceID), [selection, info])
|
|
73
|
+
const isRight = useMemo(() => (selection && selection?.right?.localID === info?.localID && selection?.right?.surfaceID === info?.surfaceID), [selection, info])
|
|
74
|
+
|
|
75
|
+
const onError = (currentTarget) => {
|
|
76
|
+
currentTarget.onerror = null
|
|
77
|
+
const fullImageURL = `${imageURL.slice(0, -9)}full/full/0/default.jpg`
|
|
78
|
+
if (currentTarget.src !== fullImageURL) {
|
|
79
|
+
currentTarget.src = fullImageURL
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Grid className="surface-thumbnail">
|
|
85
|
+
<figure className="surface-thumbnail-figure">
|
|
86
|
+
{isLeft
|
|
87
|
+
? (
|
|
88
|
+
<div className="surface-thumbnail-overlay-selected left">
|
|
89
|
+
<div>
|
|
90
|
+
<Left />
|
|
91
|
+
<Typography>Left</Typography>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
)
|
|
95
|
+
: isRight
|
|
96
|
+
? (
|
|
97
|
+
<div className="surface-thumbnail-overlay-selected right">
|
|
98
|
+
<div>
|
|
99
|
+
<Right />
|
|
100
|
+
<Typography>Right</Typography>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
: (
|
|
105
|
+
<div className="surface-thumbnail-overlay">
|
|
106
|
+
<div className="surface-thumbnail-overlay-content">
|
|
107
|
+
<a onClick={onClick.left} title="Insert left"><InsertLeft /></a>
|
|
108
|
+
<a onClick={onClick.right} title="Insert right"><InsertRight /></a>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
)}
|
|
112
|
+
<div id={surfaceID}>
|
|
113
|
+
<img
|
|
114
|
+
src={thumbnailURL}
|
|
115
|
+
alt={name}
|
|
116
|
+
style={{ maxWidth: `${MAX_THUMBNAIL_DIMENSION}px`, maxHeight: `${MAX_THUMBNAIL_DIMENSION}px` }}
|
|
117
|
+
onError={onError}
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
</figure>
|
|
121
|
+
<figcaption className="surface-thumbnail-caption">
|
|
122
|
+
{name}
|
|
123
|
+
</figcaption>
|
|
124
|
+
</Grid>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function ThumbnailGrid(props) {
|
|
129
|
+
const { surfaces, selection, navigateToSelection, documentLocalID } = props
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<Grid className="thumbnail-grid" container>
|
|
133
|
+
{
|
|
134
|
+
surfaces.map(surface => (
|
|
135
|
+
<Thumbnail
|
|
136
|
+
key={`doc-detail-thumb-${surface.id}`}
|
|
137
|
+
surfaceID={surface.id}
|
|
138
|
+
name={surface.name}
|
|
139
|
+
imageURL={surface.image_url}
|
|
140
|
+
thumbnailURL={surface.thumbnail_url}
|
|
141
|
+
selection={selection}
|
|
142
|
+
info={{
|
|
143
|
+
localID: documentLocalID,
|
|
144
|
+
surfaceID: surface.xml_id,
|
|
145
|
+
}}
|
|
146
|
+
onClick={{
|
|
147
|
+
left: (e) => {
|
|
148
|
+
e.preventDefault()
|
|
149
|
+
navigateToSelection({
|
|
150
|
+
left: {
|
|
151
|
+
localID: documentLocalID,
|
|
152
|
+
surfaceID: surface.xml_id,
|
|
153
|
+
},
|
|
154
|
+
right: selection.right,
|
|
155
|
+
})
|
|
156
|
+
},
|
|
157
|
+
right: (e) => {
|
|
158
|
+
e.preventDefault()
|
|
159
|
+
navigateToSelection({
|
|
160
|
+
left: selection.left,
|
|
161
|
+
right: {
|
|
162
|
+
localID: documentLocalID,
|
|
163
|
+
surfaceID: surface.xml_id,
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
},
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
</Thumbnail>
|
|
170
|
+
),
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
</Grid>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function DocumentDetail(props) {
|
|
178
|
+
const { db, documentName, documentID, documentLocalID, navigateToSelection, updatePageCount, selection, tags } = props
|
|
179
|
+
const surfaces = useMemo(() => {
|
|
180
|
+
const taggedSurfaces = getData(db, documentID, tags)
|
|
181
|
+
const data = []
|
|
182
|
+
for (const entry of taggedSurfaces) {
|
|
183
|
+
if (!data.find(d => (d.id === entry.id))) {
|
|
184
|
+
const tags = taggedSurfaces.filter(s => (s.id === entry.id)).map(s => (s.tag_id))
|
|
185
|
+
data.push({
|
|
186
|
+
...entry,
|
|
187
|
+
tag_id: [...new Set(tags)],
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return data.filter(s => (tags.every(t => s.tag_id.includes(t))))
|
|
192
|
+
}, [db, documentID, tags])
|
|
193
|
+
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
updatePageCount(surfaces?.length)
|
|
196
|
+
}, [surfaces, updatePageCount, tags])
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Accordion>
|
|
200
|
+
<AccordionSummary
|
|
201
|
+
expandIcon={<ExpandMoreIcon />}
|
|
202
|
+
aria-controls={`document-detail-${documentID}-content`}
|
|
203
|
+
id={`document-detail-${documentID}`}
|
|
204
|
+
className="accordion-summary"
|
|
205
|
+
>
|
|
206
|
+
<Typography>{documentName}</Typography>
|
|
207
|
+
<Typography>{surfaces?.length || ''}</Typography>
|
|
208
|
+
</AccordionSummary>
|
|
209
|
+
<AccordionDetails
|
|
210
|
+
className="accordion-detail"
|
|
211
|
+
>
|
|
212
|
+
<ThumbnailGrid
|
|
213
|
+
navigateToSelection={navigateToSelection}
|
|
214
|
+
documentLocalID={documentLocalID}
|
|
215
|
+
surfaces={surfaces}
|
|
216
|
+
selection={selection}
|
|
217
|
+
>
|
|
218
|
+
</ThumbnailGrid>
|
|
219
|
+
</AccordionDetails>
|
|
220
|
+
</Accordion>
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export default DocumentDetail
|