@cu-mkp/editioncrafter 1.3.1-beta.2 → 1.3.1-beta.4
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/dist/editioncrafter.js +6298 -6285
- package/dist/es/src/EditionCrafter/context/TagFilter.jsx +6 -0
- package/dist/es/src/EditionCrafter/context/TagFilterContext.js +1 -0
- package/dist/es/src/TagExplore/components/SurfaceBrowser.jsx +41 -24
- package/dist/es/src/TagExplore/components/TagFilters.jsx +0 -1
- package/package.json +1 -1
|
@@ -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
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Box, Button, Collapse, Divider, IconButton, Input, Typography } from '@material-ui/core'
|
|
2
2
|
import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'
|
|
3
3
|
import TuneIcon from '@material-ui/icons/Tune'
|
|
4
|
-
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
4
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useLocation, useNavigate } from 'react-router-dom'
|
|
7
7
|
import { getObjs } from '../../common/lib/sql'
|
|
8
8
|
import DocumentDetail from './DocumentDetail'
|
|
9
9
|
// import DocumentFilters from './DocumentFilters'
|
|
10
|
+
import TagFilterContext from '../../EditionCrafter/context/TagFilterContext'
|
|
10
11
|
import TagFilters from './TagFilters'
|
|
11
12
|
|
|
12
13
|
function getData(db) {
|
|
@@ -87,6 +88,8 @@ function SurfaceBrowser(props) {
|
|
|
87
88
|
|
|
88
89
|
const filteredDocs = useMemo(() => (filterDocs(documents, tags)), [filterDocs, documents, tags])
|
|
89
90
|
|
|
91
|
+
const { clearTags } = useContext(TagFilterContext)
|
|
92
|
+
|
|
90
93
|
const navigate = useNavigate()
|
|
91
94
|
const location = useLocation()
|
|
92
95
|
const selection = useMemo(() => getSelection(location.pathname), [location])
|
|
@@ -140,34 +143,48 @@ function SurfaceBrowser(props) {
|
|
|
140
143
|
<Divider></Divider>
|
|
141
144
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
142
145
|
<Typography>Contents</Typography>
|
|
143
|
-
<
|
|
144
|
-
startIcon={<TuneIcon />}
|
|
145
|
-
onClick={() => setShowFilters(current => (!current))}
|
|
146
|
-
>
|
|
147
|
-
Filter
|
|
146
|
+
<div>
|
|
148
147
|
{ tags && tags.length
|
|
149
148
|
? (
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
justifyContent: 'center',
|
|
156
|
-
alignItems: 'center',
|
|
157
|
-
padding: '3px',
|
|
158
|
-
color: 'white',
|
|
159
|
-
height: '16px',
|
|
160
|
-
width: '16px',
|
|
161
|
-
position: 'absolute',
|
|
162
|
-
top: '0',
|
|
163
|
-
left: '-12px',
|
|
164
|
-
}}
|
|
149
|
+
<Button
|
|
150
|
+
onClick={() => {
|
|
151
|
+
setTags([])
|
|
152
|
+
clearTags()
|
|
153
|
+
}}
|
|
165
154
|
>
|
|
166
|
-
|
|
167
|
-
</
|
|
155
|
+
Clear All
|
|
156
|
+
</Button>
|
|
168
157
|
)
|
|
169
158
|
: null}
|
|
170
|
-
|
|
159
|
+
<Button
|
|
160
|
+
startIcon={<TuneIcon />}
|
|
161
|
+
onClick={() => setShowFilters(current => (!current))}
|
|
162
|
+
>
|
|
163
|
+
Filter
|
|
164
|
+
{ tags && tags.length
|
|
165
|
+
? (
|
|
166
|
+
<div style={{
|
|
167
|
+
fontSize: 'small',
|
|
168
|
+
backgroundColor: 'red',
|
|
169
|
+
borderRadius: '999px',
|
|
170
|
+
display: 'flex',
|
|
171
|
+
justifyContent: 'center',
|
|
172
|
+
alignItems: 'center',
|
|
173
|
+
padding: '3px',
|
|
174
|
+
color: 'white',
|
|
175
|
+
height: '16px',
|
|
176
|
+
width: '16px',
|
|
177
|
+
position: 'absolute',
|
|
178
|
+
top: '0',
|
|
179
|
+
left: '-12px',
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
{tags.length}
|
|
183
|
+
</div>
|
|
184
|
+
)
|
|
185
|
+
: null}
|
|
186
|
+
</Button>
|
|
187
|
+
</div>
|
|
171
188
|
</div>
|
|
172
189
|
<Typography>
|
|
173
190
|
{totalPages}
|
|
@@ -34,7 +34,6 @@ function getData(db) {
|
|
|
34
34
|
function TagFilters(props) {
|
|
35
35
|
const { onToggleSelected, filters, query } = props
|
|
36
36
|
const data = useMemo(() => getData(props.db), [props.db])
|
|
37
|
-
console.log(data.taxonomies)
|
|
38
37
|
const [expanded, setExpanded] = useState(data.taxonomies?.map(() => (false)))
|
|
39
38
|
const [displayedTags, setDisplayedTags] = useState({})
|
|
40
39
|
|