@cu-mkp/editioncrafter 1.3.1-beta.1 → 1.3.1-beta.11

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.
@@ -216,6 +216,7 @@ function parseSingleManifest(manifest, transcriptionTypes, document) {
216
216
  annotations: canvas.annotations
217
217
  ? canvas.annotations.filter(a => a.motivation === 'tagging')
218
218
  : [],
219
+ metadata: canvas.metadata,
219
220
  }
220
221
 
221
222
  folios.push(folio)
@@ -4,12 +4,11 @@ import { createReducer } from '../model/ReduxStore'
4
4
  import DiplomaticActions from './DiplomaticActions'
5
5
  import DocumentActions from './DocumentActions'
6
6
  import GlossaryActions from './GlossaryActions'
7
- import NotesActions from './NotesActions'
8
-
9
7
  import diplomaticInitialState from './initialState/diplomaticInitialState'
10
8
  import documentInitialState from './initialState/documentInitialState'
11
9
  import glossaryInitialState from './initialState/glossaryInitialState'
12
10
  import notesInitialState from './initialState/notesInitialState'
11
+ import NotesActions from './NotesActions'
13
12
 
14
13
  export default function rootReducer(config) {
15
14
  const {
@@ -30,8 +29,14 @@ export default function rootReducer(config) {
30
29
  derivativesInfo[key] = config.documentInfo[key].documentName
31
30
  })
32
31
  }
33
- const transcriptionTypes = variorum ? transcriptionTypesInfo : config.transcriptionTypes
34
- const iiifManifest = variorum ? manifestInfo : config.iiifManifest
32
+
33
+ // handle the case that there's exactly one document in documentInfo
34
+ let docConfig = config
35
+ if (documentInfo && Object.keys(documentInfo).length === 1) {
36
+ docConfig = Object.values(documentInfo)[0]
37
+ }
38
+ const transcriptionTypes = variorum ? transcriptionTypesInfo : docConfig.transcriptionTypes
39
+ const iiifManifest = variorum ? manifestInfo : docConfig.iiifManifest
35
40
  const derivativeNames = variorum && derivativesInfo
36
41
  return combineReducers({
37
42
  diplomatic: createReducer('DiplomaticActions', DiplomaticActions, diplomaticInitialState),
@@ -1,10 +1,9 @@
1
1
  import withWidth from '@material-ui/core/withWidth'
2
2
  import { createBrowserHistory } from 'history'
3
3
  import PropTypes from 'prop-types'
4
- import React, { useEffect, useMemo, useRef, useState } from 'react'
4
+ import React, { useEffect, useRef, useState } from 'react'
5
5
  import { connect, Provider } from 'react-redux'
6
6
  import {
7
- BrowserRouter,
8
7
  HashRouter,
9
8
  Navigate,
10
9
  Route,
@@ -25,8 +24,6 @@ function DiploMatic(props) {
25
24
  })
26
25
  }, [])
27
26
 
28
- const Router = useMemo(() => props.config.serverNav ? BrowserRouter : HashRouter, [props.config.serverNav])
29
-
30
27
  useEffect(() => {
31
28
  if (containerRef.current) {
32
29
  setContainerWidth(containerRef.current.offsetWidth)
@@ -39,34 +36,23 @@ function DiploMatic(props) {
39
36
  const { fixedFrameMode } = props.diplomatic
40
37
  const fixedFrameModeClass = fixedFrameMode ? 'editioncrafter' : 'editioncrafter sticky'
41
38
 
42
- const mainBody
43
- = (
44
- <div id="diplomatic" className={fixedFrameModeClass} ref={containerRef} style={{ height: containerHeight }}>
45
- <RouteListener divider={props.config.divider} />
46
- <div id="content" style={{ height: '100%' }}>
47
- {
48
- props.config.serverNav
49
- ? (
50
- <DocumentView {...props} containerWidth={containerWidth} />
51
- )
52
- : (
53
- <Routes>
54
- <Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
55
- <Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
56
- <Route path="/ec/:folioID/:transcriptionType" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
57
- <Route path="/ec/:folioID" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
58
- <Route path="/ec" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
59
- <Route path="/" element={<Navigate to="/ec" />} exact />
60
- </Routes>
61
- )
62
- }
63
- </div>
64
- </div>
65
- )
39
+ const mainBody = (
40
+ <div id="diplomatic" className={fixedFrameModeClass} ref={containerRef} style={{ height: containerHeight }}>
41
+ <RouteListener />
42
+ <div id="content" style={{ height: '100%' }}>
43
+ <Routes>
44
+ <Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2/:folioID3/:transcriptionType3" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
45
+ <Route path="/ec/:folioID/:transcriptionType/:folioID2/:transcriptionType2" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
46
+ <Route path="/ec/:folioID/:transcriptionType" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
47
+ <Route path="/ec/:folioID" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
48
+ <Route path="/ec" element={<DocumentView {...props} containerWidth={containerWidth} />} exact />
49
+ <Route path="/" element={<Navigate to="/ec" />} exact />
50
+ </Routes>
51
+ </div>
52
+ </div>
53
+ )
66
54
 
67
- const topLevel = !(props.tagExplorerMode === true)
68
- ? <Router><TagFilterProvider>{mainBody}</TagFilterProvider></Router>
69
- : mainBody
55
+ const topLevel = !(props.tagExplorerMode === true) ? <HashRouter><TagFilterProvider>{mainBody}</TagFilterProvider></HashRouter> : mainBody
70
56
 
71
57
  return (
72
58
  <Provider store={props.store}>
@@ -1,5 +1,5 @@
1
1
  import withWidth, { isWidthUp } from '@material-ui/core/withWidth'
2
- import React, { useEffect, useMemo, useState } from 'react'
2
+ import React, { useEffect, useState } from 'react'
3
3
  import { connect } from 'react-redux'
4
4
  import {
5
5
  useLocation,
@@ -30,55 +30,13 @@ function DocumentView(props) {
30
30
  const [third, setThird] = useState(paneDefaults)
31
31
  const [singlePaneMode, setSinglePaneMode] = useState(props.containerWidth < 960)
32
32
 
33
- const navigateRouter = useNavigate()
34
- const navigateWindow = (path) => {
35
- window.location.href = path
36
- }
37
- /**
38
- * Memoize the navigation method
39
- */
40
- const navigate = useMemo(() => (props.config.serverNav
41
- ? (props.config.navigate || navigateWindow)
42
- : navigateRouter), [props.config.serverNav, props.config.navigate, navigateRouter])
43
-
44
- /**
45
- * Memoize the URL divider ('ec' by default)
46
- */
47
- const divider = useMemo(() => (props.config.divider || '/ec'), [props.config.divider])
33
+ const params = useParams()
34
+ const navigate = useNavigate()
48
35
  const location = useLocation()
49
36
 
50
- /**
51
- * Memoize the base URL of the current page (before the divider)
52
- */
53
- const baseUrl = useMemo(() => (
54
- props.config.serverNav
55
- ? location.pathname.split(divider)[0]
56
- : null
57
- ), [props.config.serverNav, location, divider])
58
-
59
- const routerParams = useParams()
60
-
61
- /**
62
- * Memoize the folio parameters
63
- */
64
- const params = useMemo(() => {
65
- if (!props.config.serverNav) {
66
- return routerParams
67
- }
68
- const suffix = location.pathname.split(divider)[1]?.split('/')
69
- return ({
70
- folioID: suffix[1],
71
- transcriptionType: suffix[2],
72
- folioID2: suffix[3],
73
- transcriptionType2: suffix[4],
74
- folioID3: suffix[5],
75
- transcriptionType3: suffix[6],
76
- })
77
- }, [location, routerParams, props.config.serverNav, divider])
78
-
79
37
  // "reload" the page if the config props change
80
38
  useEffect(() => {
81
- dispatchAction(props, 'RouteListenerSaga.userNavigation', location.pathname, divider.replaceAll('/', ''))
39
+ dispatchAction(props, 'RouteListenerSaga.userNavigation', location.pathname)
82
40
  }, [props.config])
83
41
 
84
42
  useEffect(() => {
@@ -87,7 +45,7 @@ function DocumentView(props) {
87
45
 
88
46
  // Navigate while keeping existing search params
89
47
  const navigateWithParams = (pathname) => {
90
- navigate(baseUrl + pathname + location.search)
48
+ navigate(pathname + location.search)
91
49
  }
92
50
 
93
51
  const getViewports = () => {
@@ -167,7 +125,7 @@ function DocumentView(props) {
167
125
 
168
126
  useEffect(() => {
169
127
  dispatchAction(props, 'DiplomaticActions.setFixedFrameMode', true)
170
- // eslint-disable-next-line react-hooks/exhaustive-deps
128
+ // eslint-disable-next-line react-hooks/exhaustive-deps
171
129
  }, [])
172
130
 
173
131
  const setXMLMode = (side, xmlMode) => {
@@ -0,0 +1,32 @@
1
+ function KeyValue(props) {
2
+ return (
3
+ <>
4
+ <span>{`${props.label}: `}</span>
5
+ {
6
+ props.data.startsWith('http')
7
+ ? (
8
+ <a href={props.data} target="_blank">
9
+ { props.data }
10
+ </a>
11
+ )
12
+ : (
13
+ <span>{props.data}</span>
14
+ )
15
+ }
16
+ </>
17
+ )
18
+ }
19
+
20
+ export default function ImageMetadata(props) {
21
+ const { data } = props
22
+
23
+ return (
24
+ <div className="image-metadata">
25
+ { Object.keys(data)?.map(key => (
26
+ <div key={key}>
27
+ <KeyValue label={key} data={data[key]} />
28
+ </div>
29
+ ))}
30
+ </div>
31
+ )
32
+ }
@@ -10,6 +10,7 @@ import {
10
10
  useSearchParams,
11
11
  } from 'react-router-dom'
12
12
  import TagFilterContext from '../context/TagFilterContext'
13
+ import ImageMetadata from './ImageMetadata'
13
14
  import ImageZoomControl from './ImageZoomControl'
14
15
  import Navigation from './Navigation'
15
16
 
@@ -187,6 +188,11 @@ function ImageView(props) {
187
188
  initViewer={initViewer}
188
189
  loading={folio.loading}
189
190
  />
191
+ {
192
+ folio.metadata && (
193
+ <ImageMetadata data={folio.metadata} />
194
+ )
195
+ }
190
196
  </div>
191
197
  )
192
198
  : (
@@ -10,7 +10,7 @@ function RouteListener(props) {
10
10
  const { pathname } = useLocation()
11
11
 
12
12
  const userNavigated = () => {
13
- dispatchAction(props, 'RouteListenerSaga.userNavigation', pathname, props.divider && props.divider.replaceAll('/', ''))
13
+ dispatchAction(props, 'RouteListenerSaga.userNavigation', pathname)
14
14
  }
15
15
 
16
16
  useEffect(() => {
@@ -55,10 +55,16 @@ function TagFilterProvider(props) {
55
55
  }
56
56
  }
57
57
 
58
+ const clearTags = () => {
59
+ setTagsRight([])
60
+ setTagsLeft([])
61
+ }
62
+
58
63
  return {
59
64
  tagsLeft,
60
65
  tagsRight,
61
66
  toggleTag,
67
+ clearTags,
62
68
  }
63
69
  }, [location.pathname, navigate, searchParams, tagParamsLeft, tagParamsRight, tagsLeft, tagsRight])
64
70
 
@@ -4,6 +4,7 @@ const TagFilterContext = createContext({
4
4
  tagsLeft: [],
5
5
  tagsRight: [],
6
6
  toggleTag: () => null,
7
+ clearTags: () => null,
7
8
  })
8
9
 
9
10
  export default TagFilterContext
@@ -55,12 +55,11 @@ function* parseTags(headerUrl) {
55
55
 
56
56
  function* userNavigation(action) {
57
57
  const pathname = action.payload.params[0]
58
- const divider = action.payload.params[1] || 'ec'
59
58
  const pathSegments = pathname.split('/')
60
59
 
61
60
  if (pathSegments.length > 1) {
62
- switch (pathSegments.includes(divider)) {
63
- case true:
61
+ switch (pathSegments[1]) {
62
+ case 'ec':
64
63
  {
65
64
  yield resolveDocumentManifest()
66
65
  yield resolveDocumentTags()
@@ -132,7 +131,7 @@ function* resolveFolio(pathSegments) {
132
131
  folioIDs.push(thirdID)
133
132
 
134
133
  for (const folioID of folioIDs) {
135
- const folioData = document.folioIndex[folioID]
134
+ const folioData = document.folioIndex[folioID] || document.folioIndex[decodeURI(folioID)]
136
135
  if (folioData && !folioData.loading) {
137
136
  // wait for folio to load and then advance state
138
137
  const folio = yield loadFolio(folioData)
@@ -0,0 +1,20 @@
1
+ .editioncrafter {
2
+
3
+ .image-metadata {
4
+ position: absolute;
5
+ bottom: 8px;
6
+ left: 8px;
7
+ background-color: rgba(128, 128, 128, 0.5);
8
+ color: white;
9
+ display: flex;
10
+ flex-direction: row;
11
+ gap: 16px;
12
+ flex-wrap: wrap;
13
+ padding: 4px 6px;
14
+ }
15
+
16
+ .image-metadata a {
17
+ color: white;
18
+ }
19
+
20
+ }
@@ -99,6 +99,7 @@ animation: #{$str};
99
99
 
100
100
  @import "diplomatic";
101
101
  @import "imageGridView";
102
+ @import "imageMetadata";
102
103
  @import "splitPaneView";
103
104
  @import "imageView";
104
105
  @import "imageZoomControl";
@@ -1,16 +1,19 @@
1
1
  function InsertLeft() {
2
2
  return (
3
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)">
4
+ <g
5
+ // id="fluent:document-one-page-20-regular"
6
+ // clipPath="url(#clip0_527_47401)"
7
+ >
5
8
  <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
9
  <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
10
  <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
11
  </g>
9
- <defs>
12
+ {/* <defs>
10
13
  <clipPath id="clip0_527_47401">
11
14
  <rect width="16" height="12" fill="white" />
12
15
  </clipPath>
13
- </defs>
16
+ </defs> */}
14
17
  </svg>
15
18
  )
16
19
  }
@@ -1,16 +1,18 @@
1
1
  function InsertRight() {
2
2
  return (
3
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)">
4
+ <g
5
+ // clipPath="url(#clip0_527_47406)"
6
+ >
5
7
  <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
8
  <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
9
  <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
10
  </g>
9
- <defs>
11
+ {/* <defs>
10
12
  <clipPath id="clip0_527_47406">
11
13
  <rect width="16" height="12" fill="white" />
12
14
  </clipPath>
13
- </defs>
15
+ </defs> */}
14
16
  </svg>
15
17
  )
16
18
  }
@@ -85,21 +85,25 @@ function Thumbnail(props) {
85
85
  <figure className="surface-thumbnail-figure">
86
86
  {isLeft
87
87
  ? (
88
- <div className="surface-thumbnail-overlay-selected left">
89
- <div>
90
- <Left />
91
- <Typography>Left</Typography>
88
+ <a onDoubleClick={onClick.right} title="Double click to insert right">
89
+ <div className="surface-thumbnail-overlay-selected left">
90
+ <div>
91
+ <Left />
92
+ <Typography>Left</Typography>
93
+ </div>
92
94
  </div>
93
- </div>
95
+ </a>
94
96
  )
95
97
  : isRight
96
98
  ? (
97
- <div className="surface-thumbnail-overlay-selected right">
98
- <div>
99
- <Right />
100
- <Typography>Right</Typography>
99
+ <a onDoubleClick={onClick.left} title="Double click to insert left">
100
+ <div className="surface-thumbnail-overlay-selected right">
101
+ <div>
102
+ <Right />
103
+ <Typography>Right</Typography>
104
+ </div>
101
105
  </div>
102
- </div>
106
+ </a>
103
107
  )
104
108
  : (
105
109
  <div className="surface-thumbnail-overlay">
@@ -195,29 +199,32 @@ function DocumentDetail(props) {
195
199
  updatePageCount(surfaces?.length)
196
200
  }, [surfaces, updatePageCount, tags])
197
201
 
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>
202
+ return ((!tags.length || surfaces.length)
203
+ ? (
204
+ <Accordion>
205
+ <AccordionSummary
206
+ expandIcon={<ExpandMoreIcon />}
207
+ aria-controls={`document-detail-${documentID}-content`}
208
+ id={`document-detail-${documentID}`}
209
+ className="accordion-summary"
210
+ >
211
+ <Typography>{documentName}</Typography>
212
+ <Typography>{surfaces?.length || ''}</Typography>
213
+ </AccordionSummary>
214
+ <AccordionDetails
215
+ className="accordion-detail"
216
+ >
217
+ <ThumbnailGrid
218
+ navigateToSelection={navigateToSelection}
219
+ documentLocalID={documentLocalID}
220
+ surfaces={surfaces}
221
+ selection={selection}
222
+ >
223
+ </ThumbnailGrid>
224
+ </AccordionDetails>
225
+ </Accordion>
226
+ )
227
+ : null
221
228
  )
222
229
  }
223
230