@collectionspace/cspace-public-browser 1.5.1
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/LICENSE.md +71 -0
- package/README.md +38 -0
- package/dist/cspacePublicBrowser.js +4680 -0
- package/dist/cspacePublicBrowser.min.js +2 -0
- package/dist/cspacePublicBrowser.min.js.LICENSE.txt +56 -0
- package/images/check.svg +3 -0
- package/images/close.svg +3 -0
- package/images/collapse.svg +3 -0
- package/images/collapseActive.svg +3 -0
- package/images/expand.svg +3 -0
- package/images/expandActive.svg +3 -0
- package/images/filter.svg +4 -0
- package/images/hideLeft.svg +4 -0
- package/images/linkBack.svg +4 -0
- package/images/linkDown.svg +4 -0
- package/images/linkNext.svg +4 -0
- package/images/linkPrev.svg +4 -0
- package/images/openNew.svg +4 -0
- package/images/search.svg +4 -0
- package/images/select.svg +4 -0
- package/images/top.svg +1 -0
- package/lib/actions/detailActions.js +177 -0
- package/lib/actions/filterActions.js +16 -0
- package/lib/actions/mediaActions.js +63 -0
- package/lib/actions/prefsActions.js +84 -0
- package/lib/actions/searchActions.js +140 -0
- package/lib/actions/searchEntryFormActions.js +19 -0
- package/lib/components/App.js +24 -0
- package/lib/components/detail/DetailNavBar.js +98 -0
- package/lib/components/detail/DetailPanel.js +171 -0
- package/lib/components/detail/DetailPanelContainer.js +22 -0
- package/lib/components/detail/ExhibitionSection.js +54 -0
- package/lib/components/detail/FieldList.js +95 -0
- package/lib/components/detail/FieldValueList.js +30 -0
- package/lib/components/detail/ImageGallery.js +137 -0
- package/lib/components/detail/ImageGalleryContainer.js +19 -0
- package/lib/components/detail/InstitutionHoldingList.js +155 -0
- package/lib/components/detail/InstitutionHoldingListContainer.js +22 -0
- package/lib/components/detail/InstitutionIndex.js +53 -0
- package/lib/components/detail/InstitutionIndexContainer.js +15 -0
- package/lib/components/detail/InstitutionSection.js +44 -0
- package/lib/components/detail/InstitutionSectionContainer.js +15 -0
- package/lib/components/layout/Fixed.js +26 -0
- package/lib/components/layout/IconButton.js +41 -0
- package/lib/components/layout/Panel.js +56 -0
- package/lib/components/layout/PanelContainer.js +19 -0
- package/lib/components/layout/PanelTitle.js +38 -0
- package/lib/components/layout/ScrollTopButton.js +70 -0
- package/lib/components/layout/ToggleFilterPanelButton.js +42 -0
- package/lib/components/pages/DetailPage.js +93 -0
- package/lib/components/pages/DetailPageContainer.js +20 -0
- package/lib/components/pages/RootPage.js +41 -0
- package/lib/components/pages/SearchPage.js +130 -0
- package/lib/components/pages/SearchPageContainer.js +23 -0
- package/lib/components/search/entry/SearchEntryForm.js +74 -0
- package/lib/components/search/entry/SearchEntryFormContainer.js +20 -0
- package/lib/components/search/entry/SearchEntryPanel.js +30 -0
- package/lib/components/search/entry/SearchQueryInput.js +89 -0
- package/lib/components/search/entry/SearchSubmitButton.js +22 -0
- package/lib/components/search/entry/SortSelect.js +89 -0
- package/lib/components/search/entry/SortSelectContainer.js +15 -0
- package/lib/components/search/result/ClearSearchParamsLink.js +42 -0
- package/lib/components/search/result/Filter.js +186 -0
- package/lib/components/search/result/FilterContainer.js +22 -0
- package/lib/components/search/result/FilterGroup.js +72 -0
- package/lib/components/search/result/FilterList.js +48 -0
- package/lib/components/search/result/FilterPanel.js +115 -0
- package/lib/components/search/result/FilterPanelContainer.js +16 -0
- package/lib/components/search/result/FilterSearchInput.js +63 -0
- package/lib/components/search/result/RemoveSearchParamLink.js +66 -0
- package/lib/components/search/result/SearchError.js +29 -0
- package/lib/components/search/result/SearchLoadMore.js +36 -0
- package/lib/components/search/result/SearchParamList.js +41 -0
- package/lib/components/search/result/SearchPending.js +21 -0
- package/lib/components/search/result/SearchResultImage.js +227 -0
- package/lib/components/search/result/SearchResultList.js +119 -0
- package/lib/components/search/result/SearchResultPanel.js +139 -0
- package/lib/components/search/result/SearchResultPanelContainer.js +23 -0
- package/lib/components/search/result/SearchResultStats.js +39 -0
- package/lib/components/search/result/SearchResultTile.js +61 -0
- package/lib/config/anthro.js +123 -0
- package/lib/config/bonsai.js +50 -0
- package/lib/config/botgarden.js +10 -0
- package/lib/config/default.js +530 -0
- package/lib/config/fcart.js +36 -0
- package/lib/config/herbarium.js +10 -0
- package/lib/config/index.js +53 -0
- package/lib/config/lhmc.js +10 -0
- package/lib/config/materials.js +982 -0
- package/lib/config/publicart.js +10 -0
- package/lib/constants/actionCodes.js +46 -0
- package/lib/constants/ids.js +12 -0
- package/lib/helpers/bodyClassName.js +11 -0
- package/lib/helpers/esQueryHelpers.js +206 -0
- package/lib/helpers/formatHelpers.js +293 -0
- package/lib/helpers/searchDimensions.js +28 -0
- package/lib/helpers/urlHelpers.js +43 -0
- package/lib/index.js +53 -0
- package/lib/intl/index.js +16 -0
- package/lib/reducers/detailReducer.js +145 -0
- package/lib/reducers/filterReducer.js +22 -0
- package/lib/reducers/index.js +66 -0
- package/lib/reducers/mediaReducer.js +43 -0
- package/lib/reducers/prefsReducer.js +27 -0
- package/lib/reducers/searchEntryFormReducer.js +24 -0
- package/lib/reducers/searchReducer.js +88 -0
- package/package.json +118 -0
- package/src/actions/detailActions.js +231 -0
- package/src/actions/filterActions.js +10 -0
- package/src/actions/mediaActions.js +65 -0
- package/src/actions/prefsActions.js +95 -0
- package/src/actions/searchActions.js +188 -0
- package/src/actions/searchEntryFormActions.js +15 -0
- package/src/components/App.jsx +18 -0
- package/src/components/detail/DetailNavBar.jsx +132 -0
- package/src/components/detail/DetailPanel.jsx +215 -0
- package/src/components/detail/DetailPanelContainer.js +29 -0
- package/src/components/detail/ExhibitionSection.jsx +71 -0
- package/src/components/detail/FieldList.jsx +122 -0
- package/src/components/detail/FieldValueList.jsx +31 -0
- package/src/components/detail/ImageGallery.jsx +153 -0
- package/src/components/detail/ImageGalleryContainer.js +17 -0
- package/src/components/detail/InstitutionHoldingList.jsx +188 -0
- package/src/components/detail/InstitutionHoldingListContainer.js +29 -0
- package/src/components/detail/InstitutionIndex.jsx +57 -0
- package/src/components/detail/InstitutionIndexContainer.js +11 -0
- package/src/components/detail/InstitutionSection.jsx +48 -0
- package/src/components/detail/InstitutionSectionContainer.js +11 -0
- package/src/components/layout/Fixed.jsx +29 -0
- package/src/components/layout/IconButton.jsx +41 -0
- package/src/components/layout/Panel.jsx +60 -0
- package/src/components/layout/PanelContainer.js +20 -0
- package/src/components/layout/PanelTitle.jsx +43 -0
- package/src/components/layout/ScrollTopButton.jsx +76 -0
- package/src/components/layout/ToggleFilterPanelButton.jsx +43 -0
- package/src/components/pages/DetailPage.jsx +101 -0
- package/src/components/pages/DetailPageContainer.js +18 -0
- package/src/components/pages/RootPage.jsx +37 -0
- package/src/components/pages/SearchPage.jsx +160 -0
- package/src/components/pages/SearchPageContainer.js +21 -0
- package/src/components/search/entry/SearchEntryForm.jsx +82 -0
- package/src/components/search/entry/SearchEntryFormContainer.js +22 -0
- package/src/components/search/entry/SearchEntryPanel.jsx +28 -0
- package/src/components/search/entry/SearchQueryInput.jsx +95 -0
- package/src/components/search/entry/SearchSubmitButton.jsx +22 -0
- package/src/components/search/entry/SortSelect.jsx +104 -0
- package/src/components/search/entry/SortSelectContainer.js +12 -0
- package/src/components/search/result/ClearSearchParamsLink.jsx +43 -0
- package/src/components/search/result/Filter.jsx +226 -0
- package/src/components/search/result/FilterContainer.js +20 -0
- package/src/components/search/result/FilterGroup.jsx +83 -0
- package/src/components/search/result/FilterList.jsx +51 -0
- package/src/components/search/result/FilterPanel.jsx +143 -0
- package/src/components/search/result/FilterPanelContainer.js +16 -0
- package/src/components/search/result/FilterSearchInput.jsx +68 -0
- package/src/components/search/result/RemoveSearchParamLink.jsx +79 -0
- package/src/components/search/result/SearchError.jsx +30 -0
- package/src/components/search/result/SearchLoadMore.jsx +37 -0
- package/src/components/search/result/SearchParamList.jsx +47 -0
- package/src/components/search/result/SearchPending.jsx +19 -0
- package/src/components/search/result/SearchResultImage.jsx +275 -0
- package/src/components/search/result/SearchResultList.jsx +144 -0
- package/src/components/search/result/SearchResultPanel.jsx +169 -0
- package/src/components/search/result/SearchResultPanelContainer.js +31 -0
- package/src/components/search/result/SearchResultStats.jsx +38 -0
- package/src/components/search/result/SearchResultTile.jsx +70 -0
- package/src/config/anthro.js +153 -0
- package/src/config/bonsai.js +50 -0
- package/src/config/botgarden.js +3 -0
- package/src/config/default.js +604 -0
- package/src/config/fcart.js +38 -0
- package/src/config/herbarium.js +3 -0
- package/src/config/index.js +51 -0
- package/src/config/lhmc.js +3 -0
- package/src/config/materials.js +1173 -0
- package/src/config/publicart.js +3 -0
- package/src/constants/actionCodes.js +26 -0
- package/src/constants/ids.js +3 -0
- package/src/helpers/bodyClassName.js +5 -0
- package/src/helpers/esQueryHelpers.js +224 -0
- package/src/helpers/formatHelpers.jsx +361 -0
- package/src/helpers/searchDimensions.js +21 -0
- package/src/helpers/urlHelpers.js +49 -0
- package/src/index.jsx +59 -0
- package/src/intl/index.js +16 -0
- package/src/reducers/detailReducer.js +201 -0
- package/src/reducers/filterReducer.js +16 -0
- package/src/reducers/index.js +56 -0
- package/src/reducers/mediaReducer.js +44 -0
- package/src/reducers/prefsReducer.js +24 -0
- package/src/reducers/searchEntryFormReducer.js +19 -0
- package/src/reducers/searchReducer.js +118 -0
- package/styles/colors.css +7 -0
- package/styles/cspace/DetailNavBar.css +17 -0
- package/styles/cspace/DetailPage.css +3 -0
- package/styles/cspace/DetailPanel.css +69 -0
- package/styles/cspace/ExhibitionSection.css +9 -0
- package/styles/cspace/FieldList.css +15 -0
- package/styles/cspace/FieldListField.css +7 -0
- package/styles/cspace/FieldListGroup.css +27 -0
- package/styles/cspace/FieldValueList.css +19 -0
- package/styles/cspace/Filter.css +64 -0
- package/styles/cspace/FilterGroup.css +21 -0
- package/styles/cspace/FilterPanel.css +45 -0
- package/styles/cspace/FilterSearchInput.css +13 -0
- package/styles/cspace/Fixed.css +8 -0
- package/styles/cspace/IconButton.css +11 -0
- package/styles/cspace/ImageGallery.css +43 -0
- package/styles/cspace/InstitutionHoldingList.css +109 -0
- package/styles/cspace/InstitutionIndex.css +13 -0
- package/styles/cspace/InstitutionSection.css +4 -0
- package/styles/cspace/Link.css +39 -0
- package/styles/cspace/Panel.css +53 -0
- package/styles/cspace/PanelTitle.css +48 -0
- package/styles/cspace/RemoveSearchParamLink.css +15 -0
- package/styles/cspace/RootPage.css +60 -0
- package/styles/cspace/ScrollTopButton.css +32 -0
- package/styles/cspace/SearchEntryForm.css +4 -0
- package/styles/cspace/SearchEntryPanel.css +11 -0
- package/styles/cspace/SearchPage.css +2 -0
- package/styles/cspace/SearchParamLink.css +21 -0
- package/styles/cspace/SearchParamList.css +6 -0
- package/styles/cspace/SearchQueryInput.css +30 -0
- package/styles/cspace/SearchResultImage.css +29 -0
- package/styles/cspace/SearchResultList.css +10 -0
- package/styles/cspace/SearchResultPanel.css +31 -0
- package/styles/cspace/SearchResultStats.css +4 -0
- package/styles/cspace/SearchResultTile.css +67 -0
- package/styles/cspace/SearchStatus.css +12 -0
- package/styles/cspace/SearchSubmitButton.css +3 -0
- package/styles/cspace/SortSelect.css +19 -0
- package/styles/cspace/ToggleFilterPanelButton.css +44 -0
- package/styles/dimensions.css +9 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cssStyles from '../../../styles/cspace/PanelTitle.css';
|
|
4
|
+
|
|
5
|
+
const propTypes = {
|
|
6
|
+
isExpanded: PropTypes.bool,
|
|
7
|
+
styles: PropTypes.shape({
|
|
8
|
+
expanded: PropTypes.string,
|
|
9
|
+
collapsed: PropTypes.string,
|
|
10
|
+
}),
|
|
11
|
+
title: PropTypes.oneOfType([
|
|
12
|
+
PropTypes.string,
|
|
13
|
+
PropTypes.element,
|
|
14
|
+
]).isRequired,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
styles: cssStyles,
|
|
19
|
+
isExpanded: false,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default function PanelTitle(props) {
|
|
23
|
+
const {
|
|
24
|
+
isExpanded,
|
|
25
|
+
styles,
|
|
26
|
+
title,
|
|
27
|
+
...remainingProps
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<button
|
|
32
|
+
className={isExpanded ? styles.expanded : styles.collapsed}
|
|
33
|
+
type="button"
|
|
34
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
35
|
+
{...remainingProps}
|
|
36
|
+
>
|
|
37
|
+
<div>{title}</div>
|
|
38
|
+
</button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
PanelTitle.propTypes = propTypes;
|
|
43
|
+
PanelTitle.defaultProps = defaultProps;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* global window */
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { defineMessages } from 'react-intl';
|
|
5
|
+
import IconButton from './IconButton';
|
|
6
|
+
import styles from '../../../styles/cspace/ScrollTopButton.css';
|
|
7
|
+
|
|
8
|
+
const messages = defineMessages({
|
|
9
|
+
label: {
|
|
10
|
+
id: 'scrollTopButton.label',
|
|
11
|
+
defaultMessage: 'Back to top',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const scrollTop = () => {
|
|
16
|
+
if (window.scrollTo) {
|
|
17
|
+
window.scrollTo({
|
|
18
|
+
left: 0,
|
|
19
|
+
top: 0,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default class ScrollTopButton extends Component {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
|
|
28
|
+
this.handleScroll = this.handleScroll.bind(this);
|
|
29
|
+
|
|
30
|
+
this.state = {
|
|
31
|
+
visible: false,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
componentDidMount() {
|
|
36
|
+
window.addEventListener('scroll', this.handleScroll);
|
|
37
|
+
|
|
38
|
+
this.setVisibility();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
componentWillUnmount() {
|
|
42
|
+
window.removeEventListener('scroll', this.handleScroll);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
handleScroll() {
|
|
46
|
+
this.setVisibility();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setVisibility() {
|
|
50
|
+
const {
|
|
51
|
+
visible,
|
|
52
|
+
} = this.state;
|
|
53
|
+
|
|
54
|
+
const nextVisible = window.document.scrollingElement.scrollTop > 0;
|
|
55
|
+
|
|
56
|
+
if (visible !== nextVisible) {
|
|
57
|
+
this.setState({
|
|
58
|
+
visible: nextVisible,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
const {
|
|
65
|
+
visible,
|
|
66
|
+
} = this.state;
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<IconButton
|
|
70
|
+
className={visible ? styles.common : styles.hidden}
|
|
71
|
+
labelMessage={messages.label}
|
|
72
|
+
onClick={scrollTop}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { defineMessages } from 'react-intl';
|
|
4
|
+
import IconButton from './IconButton';
|
|
5
|
+
import styles from '../../../styles/cspace/ToggleFilterPanelButton.css';
|
|
6
|
+
|
|
7
|
+
const propTypes = {
|
|
8
|
+
isFilterPanelExpanded: PropTypes.bool,
|
|
9
|
+
onClick: PropTypes.func.isRequired,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const defaultProps = {
|
|
13
|
+
isFilterPanelExpanded: false,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const messages = defineMessages({
|
|
17
|
+
hideLabel: {
|
|
18
|
+
id: 'toggleFilterPanelButton.hide.label',
|
|
19
|
+
defaultMessage: 'Hide filters',
|
|
20
|
+
},
|
|
21
|
+
showLabel: {
|
|
22
|
+
id: 'toggleFilterPanelButton.show.label',
|
|
23
|
+
defaultMessage: 'Show filters',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default function ToggleFilterPanelButton(props) {
|
|
28
|
+
const {
|
|
29
|
+
isFilterPanelExpanded,
|
|
30
|
+
onClick,
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<IconButton
|
|
35
|
+
className={isFilterPanelExpanded ? styles.expanded : styles.collapsed}
|
|
36
|
+
labelMessage={isFilterPanelExpanded ? messages.hideLabel : messages.showLabel}
|
|
37
|
+
onClick={onClick}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ToggleFilterPanelButton.propTypes = propTypes;
|
|
43
|
+
ToggleFilterPanelButton.defaultProps = defaultProps;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* global window */
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Immutable from 'immutable';
|
|
6
|
+
import bodyClassName from '../../helpers/bodyClassName';
|
|
7
|
+
import ScrollTopButton from '../layout/ScrollTopButton';
|
|
8
|
+
import DetailPanel from '../detail/DetailPanelContainer';
|
|
9
|
+
import styles from '../../../styles/cspace/DetailPage.css';
|
|
10
|
+
|
|
11
|
+
const propTypes = {
|
|
12
|
+
location: PropTypes.shape({
|
|
13
|
+
search: PropTypes.string.isRequired,
|
|
14
|
+
state: PropTypes.shape({
|
|
15
|
+
index: PropTypes.number,
|
|
16
|
+
}),
|
|
17
|
+
}).isRequired,
|
|
18
|
+
match: PropTypes.shape({
|
|
19
|
+
params: PropTypes.shape({
|
|
20
|
+
csid: PropTypes.string,
|
|
21
|
+
}),
|
|
22
|
+
}).isRequired,
|
|
23
|
+
params: PropTypes.instanceOf(Immutable.Map),
|
|
24
|
+
onLeave: PropTypes.func,
|
|
25
|
+
onLocationChange: PropTypes.func,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const defaultProps = {
|
|
29
|
+
onLeave: () => undefined,
|
|
30
|
+
onLocationChange: () => undefined,
|
|
31
|
+
params: undefined,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default class DetailPage extends Component {
|
|
35
|
+
componentDidMount() {
|
|
36
|
+
window.document.body.classList.add(bodyClassName(styles.common));
|
|
37
|
+
|
|
38
|
+
if (window.scrollTo) {
|
|
39
|
+
window.scrollTo({
|
|
40
|
+
left: 0,
|
|
41
|
+
top: 0,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this.handleLocationChange();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
componentDidUpdate(prevProps) {
|
|
49
|
+
const {
|
|
50
|
+
location,
|
|
51
|
+
} = this.props;
|
|
52
|
+
|
|
53
|
+
const {
|
|
54
|
+
location: prevLocation,
|
|
55
|
+
} = prevProps;
|
|
56
|
+
|
|
57
|
+
if (location !== prevLocation) {
|
|
58
|
+
this.handleLocationChange();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
componentWillUnmount() {
|
|
63
|
+
const {
|
|
64
|
+
onLeave,
|
|
65
|
+
} = this.props;
|
|
66
|
+
|
|
67
|
+
window.document.body.classList.remove(bodyClassName(styles.common));
|
|
68
|
+
|
|
69
|
+
onLeave();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
handleLocationChange() {
|
|
73
|
+
const {
|
|
74
|
+
location,
|
|
75
|
+
match,
|
|
76
|
+
onLocationChange,
|
|
77
|
+
} = this.props;
|
|
78
|
+
|
|
79
|
+
onLocationChange(location, match);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
render() {
|
|
83
|
+
const {
|
|
84
|
+
params,
|
|
85
|
+
} = this.props;
|
|
86
|
+
|
|
87
|
+
if (!params) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div className={styles.common}>
|
|
93
|
+
<DetailPanel params={params} />
|
|
94
|
+
<ScrollTopButton />
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
DetailPage.propTypes = propTypes;
|
|
101
|
+
DetailPage.defaultProps = defaultProps;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { connect } from 'react-redux';
|
|
2
|
+
import DetailPage from './DetailPage';
|
|
3
|
+
import { clearDetail, setDetailParams } from '../../actions/detailActions';
|
|
4
|
+
import { getDetailParams } from '../../reducers';
|
|
5
|
+
|
|
6
|
+
const mapStateToProps = (state) => ({
|
|
7
|
+
params: getDetailParams(state),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const mapDispatchToProps = {
|
|
11
|
+
onLeave: clearDetail,
|
|
12
|
+
onLocationChange: setDetailParams,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default connect(
|
|
16
|
+
mapStateToProps,
|
|
17
|
+
mapDispatchToProps,
|
|
18
|
+
)(DetailPage);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
3
|
+
import { Route, Switch } from 'react-router';
|
|
4
|
+
import Helmet from 'react-helmet';
|
|
5
|
+
import DetailPage from './DetailPageContainer';
|
|
6
|
+
import SearchPage from './SearchPageContainer';
|
|
7
|
+
import config from '../../config';
|
|
8
|
+
import styles from '../../../styles/cspace/RootPage.css';
|
|
9
|
+
|
|
10
|
+
const messages = defineMessages({
|
|
11
|
+
title: {
|
|
12
|
+
id: 'RootPage.title',
|
|
13
|
+
defaultMessage: 'Collection Browser',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default function RootPage() {
|
|
18
|
+
const intl = useIntl();
|
|
19
|
+
const title = intl.formatMessage(messages.title);
|
|
20
|
+
const detailPath = config.get('detailPath');
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className={styles.common}>
|
|
24
|
+
<Helmet
|
|
25
|
+
defaultTitle={title}
|
|
26
|
+
titleTemplate={`%s | ${title}`}
|
|
27
|
+
>
|
|
28
|
+
<meta name="viewport" content="width=device-width" />
|
|
29
|
+
</Helmet>
|
|
30
|
+
|
|
31
|
+
<Switch>
|
|
32
|
+
<Route path="/search" component={SearchPage} />
|
|
33
|
+
<Route path={`/${detailPath}/:csid`} component={DetailPage} />
|
|
34
|
+
</Switch>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* global window */
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Helmet from 'react-helmet';
|
|
6
|
+
import { defineMessages, injectIntl } from 'react-intl';
|
|
7
|
+
import { withRouter } from 'react-router';
|
|
8
|
+
import Immutable from 'immutable';
|
|
9
|
+
import bodyClassName from '../../helpers/bodyClassName';
|
|
10
|
+
import Fixed from '../layout/Fixed';
|
|
11
|
+
import FilterPanel from '../search/result/FilterPanelContainer';
|
|
12
|
+
import SearchEntryPanel from '../search/entry/SearchEntryPanel';
|
|
13
|
+
import SearchResultPanel from '../search/result/SearchResultPanelContainer';
|
|
14
|
+
import ScrollTopButton from '../layout/ScrollTopButton';
|
|
15
|
+
import ToggleFilterPanelButton from '../layout/ToggleFilterPanelButton';
|
|
16
|
+
import { FILTER_PANEL_ID } from '../../constants/ids';
|
|
17
|
+
import styles from '../../../styles/cspace/SearchPage.css';
|
|
18
|
+
|
|
19
|
+
const propTypes = {
|
|
20
|
+
intl: PropTypes.shape({
|
|
21
|
+
formatMessage: PropTypes.func.isRequired,
|
|
22
|
+
}).isRequired,
|
|
23
|
+
location: PropTypes.shape({
|
|
24
|
+
search: PropTypes.string,
|
|
25
|
+
}).isRequired,
|
|
26
|
+
isFilterPanelExpanded: PropTypes.bool,
|
|
27
|
+
onLocationChange: PropTypes.func,
|
|
28
|
+
onTogglePanelButtonClick: PropTypes.func,
|
|
29
|
+
params: PropTypes.instanceOf(Immutable.Map),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const defaultProps = {
|
|
33
|
+
isFilterPanelExpanded: false,
|
|
34
|
+
onLocationChange: () => undefined,
|
|
35
|
+
onTogglePanelButtonClick: () => undefined,
|
|
36
|
+
params: undefined,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const messages = defineMessages({
|
|
40
|
+
title: {
|
|
41
|
+
id: 'SearchPage.title',
|
|
42
|
+
defaultMessage: 'Search',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
class SearchPage extends Component {
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
|
|
50
|
+
this.handleFilterPanelApi = this.handleFilterPanelApi.bind(this);
|
|
51
|
+
this.handleSearchResultListHitsUpdated = this.handleSearchResultListHitsUpdated.bind(this);
|
|
52
|
+
this.handleToggleFilterPanelButtonClick = this.handleToggleFilterPanelButtonClick.bind(this);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentDidMount() {
|
|
56
|
+
window.document.body.classList.add(bodyClassName(styles.common));
|
|
57
|
+
|
|
58
|
+
if (window.scrollTo) {
|
|
59
|
+
window.scrollTo({
|
|
60
|
+
left: 0,
|
|
61
|
+
top: 0,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.handleLocationChange();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
componentDidUpdate(prevProps) {
|
|
69
|
+
const {
|
|
70
|
+
location,
|
|
71
|
+
} = this.props;
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
location: prevLocation,
|
|
75
|
+
} = prevProps;
|
|
76
|
+
|
|
77
|
+
if (location !== prevLocation) {
|
|
78
|
+
this.handleLocationChange();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
componentWillUnmount() {
|
|
83
|
+
window.document.body.classList.remove(bodyClassName(styles.common));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
handleFilterPanelApi(api) {
|
|
87
|
+
this.filterPanelApi = api;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
handleLocationChange() {
|
|
91
|
+
const {
|
|
92
|
+
location,
|
|
93
|
+
onLocationChange,
|
|
94
|
+
} = this.props;
|
|
95
|
+
|
|
96
|
+
onLocationChange(location);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
handleSearchResultListHitsUpdated() {
|
|
100
|
+
if (this.filterPanelApi) {
|
|
101
|
+
this.filterPanelApi.setHeight();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
handleToggleFilterPanelButtonClick() {
|
|
106
|
+
const {
|
|
107
|
+
onTogglePanelButtonClick,
|
|
108
|
+
} = this.props;
|
|
109
|
+
|
|
110
|
+
onTogglePanelButtonClick(FILTER_PANEL_ID);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
render() {
|
|
114
|
+
const {
|
|
115
|
+
intl,
|
|
116
|
+
isFilterPanelExpanded,
|
|
117
|
+
params,
|
|
118
|
+
} = this.props;
|
|
119
|
+
|
|
120
|
+
if (!params) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const title = intl.formatMessage(messages.title);
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div className={styles.common}>
|
|
128
|
+
<Helmet>
|
|
129
|
+
<title>{title}</title>
|
|
130
|
+
</Helmet>
|
|
131
|
+
|
|
132
|
+
<Fixed>
|
|
133
|
+
<SearchEntryPanel />
|
|
134
|
+
|
|
135
|
+
<ToggleFilterPanelButton
|
|
136
|
+
isFilterPanelExpanded={isFilterPanelExpanded}
|
|
137
|
+
onClick={this.handleToggleFilterPanelButtonClick}
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<FilterPanel
|
|
141
|
+
api={this.handleFilterPanelApi}
|
|
142
|
+
isExpanded={isFilterPanelExpanded}
|
|
143
|
+
/>
|
|
144
|
+
</Fixed>
|
|
145
|
+
|
|
146
|
+
<SearchResultPanel
|
|
147
|
+
params={params}
|
|
148
|
+
onHitsUpdated={this.handleSearchResultListHitsUpdated}
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<ScrollTopButton />
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
SearchPage.propTypes = propTypes;
|
|
158
|
+
SearchPage.defaultProps = defaultProps;
|
|
159
|
+
|
|
160
|
+
export default injectIntl(withRouter(SearchPage));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { connect } from 'react-redux';
|
|
2
|
+
import SearchPage from './SearchPage';
|
|
3
|
+
import { togglePanel } from '../../actions/prefsActions';
|
|
4
|
+
import { setSearchParams } from '../../actions/searchActions';
|
|
5
|
+
import { FILTER_PANEL_ID } from '../../constants/ids';
|
|
6
|
+
import { isPanelExpanded, getSearchParams } from '../../reducers';
|
|
7
|
+
|
|
8
|
+
const mapStateToProps = (state) => ({
|
|
9
|
+
isFilterPanelExpanded: isPanelExpanded(state, FILTER_PANEL_ID),
|
|
10
|
+
params: getSearchParams(state),
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const mapDispatchToProps = {
|
|
14
|
+
onLocationChange: setSearchParams,
|
|
15
|
+
onTogglePanelButtonClick: togglePanel,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default connect(
|
|
19
|
+
mapStateToProps,
|
|
20
|
+
mapDispatchToProps,
|
|
21
|
+
)(SearchPage);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { withRouter } from 'react-router';
|
|
4
|
+
import Immutable from 'immutable';
|
|
5
|
+
import SearchQueryInput from './SearchQueryInput';
|
|
6
|
+
import { SEARCH_QUERY_ID } from '../../../constants/ids';
|
|
7
|
+
import styles from '../../../../styles/cspace/SearchEntryForm.css';
|
|
8
|
+
|
|
9
|
+
const propTypes = {
|
|
10
|
+
history: PropTypes.shape({
|
|
11
|
+
push: PropTypes.func,
|
|
12
|
+
}).isRequired,
|
|
13
|
+
onCommit: PropTypes.func,
|
|
14
|
+
onSubmit: PropTypes.func,
|
|
15
|
+
params: PropTypes.instanceOf(Immutable.Map),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const defaultProps = {
|
|
19
|
+
onCommit: () => undefined,
|
|
20
|
+
onSubmit: () => undefined,
|
|
21
|
+
params: Immutable.Map(),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class SearchEntryForm extends Component {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
|
|
28
|
+
this.handleInputCommit = this.handleInputCommit.bind(this);
|
|
29
|
+
this.handleRef = this.handleRef.bind(this);
|
|
30
|
+
this.handleSubmit = this.handleSubmit.bind(this);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
handleInputCommit(id, value) {
|
|
34
|
+
const {
|
|
35
|
+
onCommit,
|
|
36
|
+
} = this.props;
|
|
37
|
+
|
|
38
|
+
onCommit(id, value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
handleRef(ref) {
|
|
42
|
+
this.domNode = ref;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
handleSubmit(event) {
|
|
46
|
+
const {
|
|
47
|
+
history,
|
|
48
|
+
onSubmit,
|
|
49
|
+
} = this.props;
|
|
50
|
+
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
|
|
53
|
+
onSubmit(history);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
render() {
|
|
57
|
+
const {
|
|
58
|
+
params,
|
|
59
|
+
} = this.props;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<form
|
|
63
|
+
className={styles.common}
|
|
64
|
+
ref={this.handleRef}
|
|
65
|
+
role="search"
|
|
66
|
+
onSubmit={this.handleSubmit}
|
|
67
|
+
>
|
|
68
|
+
<SearchQueryInput
|
|
69
|
+
id={SEARCH_QUERY_ID}
|
|
70
|
+
showSubmitButton
|
|
71
|
+
value={params.get(SEARCH_QUERY_ID)}
|
|
72
|
+
onCommit={this.handleInputCommit}
|
|
73
|
+
/>
|
|
74
|
+
</form>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
SearchEntryForm.propTypes = propTypes;
|
|
80
|
+
SearchEntryForm.defaultProps = defaultProps;
|
|
81
|
+
|
|
82
|
+
export default withRouter(SearchEntryForm);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { connect } from 'react-redux';
|
|
2
|
+
import SearchEntryForm from './SearchEntryForm';
|
|
3
|
+
import { getSearchEntryFormParams } from '../../../reducers';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
applySearchEntryForm,
|
|
7
|
+
setSearchEntryFormParam,
|
|
8
|
+
} from '../../../actions/searchEntryFormActions';
|
|
9
|
+
|
|
10
|
+
const mapStateToProps = (state) => ({
|
|
11
|
+
params: getSearchEntryFormParams(state),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const mapDispatchToProps = {
|
|
15
|
+
onCommit: setSearchEntryFormParam,
|
|
16
|
+
onSubmit: applySearchEntryForm,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default connect(
|
|
20
|
+
mapStateToProps,
|
|
21
|
+
mapDispatchToProps,
|
|
22
|
+
)(SearchEntryForm);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Immutable from 'immutable';
|
|
4
|
+
import SearchEntryForm from './SearchEntryFormContainer';
|
|
5
|
+
import styles from '../../../../styles/cspace/SearchEntryPanel.css';
|
|
6
|
+
|
|
7
|
+
const propTypes = {
|
|
8
|
+
params: PropTypes.instanceOf(Immutable.Map),
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const defaultProps = {
|
|
12
|
+
params: undefined,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function SearchEntryPanel(props) {
|
|
16
|
+
const {
|
|
17
|
+
params,
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className={styles.common}>
|
|
22
|
+
<SearchEntryForm params={params} />
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
SearchEntryPanel.propTypes = propTypes;
|
|
28
|
+
SearchEntryPanel.defaultProps = defaultProps;
|