@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,132 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { defineMessages, FormattedMessage } from 'react-intl';
|
|
4
|
+
import { Link } from 'react-router-dom';
|
|
5
|
+
import Immutable from 'immutable';
|
|
6
|
+
import get from 'lodash/get';
|
|
7
|
+
import config from '../../config';
|
|
8
|
+
import { searchParamsToQueryString } from '../../helpers/urlHelpers';
|
|
9
|
+
import styles from '../../../styles/cspace/DetailNavBar.css';
|
|
10
|
+
import linkStyles from '../../../styles/cspace/Link.css';
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
params: PropTypes.instanceOf(Immutable.Map).isRequired,
|
|
14
|
+
prev: PropTypes.shape({
|
|
15
|
+
'ecm:name': PropTypes.string,
|
|
16
|
+
}),
|
|
17
|
+
next: PropTypes.shape({
|
|
18
|
+
'ecm:name': PropTypes.string,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const defaultProps = {
|
|
23
|
+
prev: undefined,
|
|
24
|
+
next: undefined,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const messages = defineMessages({
|
|
28
|
+
search: {
|
|
29
|
+
id: 'detailNavBar.search',
|
|
30
|
+
defaultMessage: 'Return to search',
|
|
31
|
+
},
|
|
32
|
+
prev: {
|
|
33
|
+
id: 'detailNavBar.prev',
|
|
34
|
+
defaultMessage: 'Previous',
|
|
35
|
+
},
|
|
36
|
+
next: {
|
|
37
|
+
id: 'detailNavBar.next',
|
|
38
|
+
defaultMessage: 'Next',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export default function DetailNavBar(props) {
|
|
43
|
+
const {
|
|
44
|
+
params,
|
|
45
|
+
prev,
|
|
46
|
+
next,
|
|
47
|
+
} = props;
|
|
48
|
+
|
|
49
|
+
const index = params.get('index');
|
|
50
|
+
const searchParams = params.get('searchParams');
|
|
51
|
+
|
|
52
|
+
if (!searchParams || typeof index === 'undefined') {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const searchParamsObj = searchParams.toJS();
|
|
57
|
+
const detailPath = config.get('detailPath');
|
|
58
|
+
|
|
59
|
+
let prevLink;
|
|
60
|
+
let nextLink;
|
|
61
|
+
|
|
62
|
+
if (prev) {
|
|
63
|
+
const csid = get(prev, 'ecm:name');
|
|
64
|
+
|
|
65
|
+
prevLink = (
|
|
66
|
+
<span>
|
|
67
|
+
<Link
|
|
68
|
+
className={linkStyles.prev}
|
|
69
|
+
to={{
|
|
70
|
+
pathname: `/${detailPath}/${csid}`,
|
|
71
|
+
state: {
|
|
72
|
+
index: index - 1,
|
|
73
|
+
searchParams: searchParamsObj,
|
|
74
|
+
},
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
78
|
+
<FormattedMessage {...messages.prev} />
|
|
79
|
+
</Link>
|
|
80
|
+
</span>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (next) {
|
|
85
|
+
const csid = get(next, 'ecm:name');
|
|
86
|
+
|
|
87
|
+
nextLink = (
|
|
88
|
+
<span>
|
|
89
|
+
<Link
|
|
90
|
+
className={linkStyles.next}
|
|
91
|
+
to={{
|
|
92
|
+
pathname: `/${detailPath}/${csid}`,
|
|
93
|
+
state: {
|
|
94
|
+
index: index + 1,
|
|
95
|
+
searchParams: searchParamsObj,
|
|
96
|
+
},
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
100
|
+
<FormattedMessage {...messages.next} />
|
|
101
|
+
</Link>
|
|
102
|
+
</span>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const queryString = searchParamsToQueryString(searchParams);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<nav className={styles.common}>
|
|
110
|
+
<div>
|
|
111
|
+
<Link
|
|
112
|
+
className={linkStyles.back}
|
|
113
|
+
to={{
|
|
114
|
+
pathname: '/search',
|
|
115
|
+
search: `?${queryString}`,
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
119
|
+
<FormattedMessage {...messages.search} />
|
|
120
|
+
</Link>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div>
|
|
124
|
+
{prevLink}
|
|
125
|
+
{nextLink}
|
|
126
|
+
</div>
|
|
127
|
+
</nav>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
DetailNavBar.propTypes = propTypes;
|
|
132
|
+
DetailNavBar.defaultProps = defaultProps;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Helmet from 'react-helmet';
|
|
4
|
+
import Immutable from 'immutable';
|
|
5
|
+
import FieldList from './FieldList';
|
|
6
|
+
import DetailNavBar from './DetailNavBar';
|
|
7
|
+
import ImageGallery from './ImageGalleryContainer';
|
|
8
|
+
import InstitutionIndex from './InstitutionIndexContainer';
|
|
9
|
+
import InstitutionSection from './InstitutionSectionContainer';
|
|
10
|
+
import ExhibitionSection from './ExhibitionSection';
|
|
11
|
+
import config from '../../config';
|
|
12
|
+
import styles from '../../../styles/cspace/DetailPanel.css';
|
|
13
|
+
|
|
14
|
+
const propTypes = {
|
|
15
|
+
adjacents: PropTypes.shape({
|
|
16
|
+
prev: PropTypes.object,
|
|
17
|
+
next: PropTypes.object,
|
|
18
|
+
}),
|
|
19
|
+
data: PropTypes.shape({
|
|
20
|
+
'collectionspace_core:refName': PropTypes.string,
|
|
21
|
+
'collectionspace_denorm:title': PropTypes.string,
|
|
22
|
+
'collectionspace_denorm:exhibition': PropTypes.array,
|
|
23
|
+
'collectionobjects_common:objectHistoryNote': PropTypes.string,
|
|
24
|
+
'collectionobjects_common:ownersContributionNote': PropTypes.string,
|
|
25
|
+
'collectionobjects_common:viewersContributionNote': PropTypes.string,
|
|
26
|
+
}),
|
|
27
|
+
params: PropTypes.instanceOf(Immutable.Map).isRequired,
|
|
28
|
+
readDetail: PropTypes.func,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const defaultProps = {
|
|
32
|
+
adjacents: {},
|
|
33
|
+
data: undefined,
|
|
34
|
+
readDetail: () => undefined,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default class DetailPanel extends Component {
|
|
38
|
+
componentDidMount() {
|
|
39
|
+
this.readDetail();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
componentDidUpdate(prevProps) {
|
|
43
|
+
const {
|
|
44
|
+
params,
|
|
45
|
+
} = this.props;
|
|
46
|
+
|
|
47
|
+
const {
|
|
48
|
+
params: prevParams,
|
|
49
|
+
} = prevProps;
|
|
50
|
+
|
|
51
|
+
if (params.get('csid') !== prevParams.get('csid')) {
|
|
52
|
+
this.readDetail();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
readDetail() {
|
|
57
|
+
const {
|
|
58
|
+
readDetail,
|
|
59
|
+
} = this.props;
|
|
60
|
+
|
|
61
|
+
readDetail();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
renderDescription() {
|
|
65
|
+
const {
|
|
66
|
+
data,
|
|
67
|
+
} = this.props;
|
|
68
|
+
|
|
69
|
+
const descFormatter = config.get('detailDescription');
|
|
70
|
+
const desc = descFormatter && descFormatter(data);
|
|
71
|
+
|
|
72
|
+
return <p>{desc}</p>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
renderFieldList() {
|
|
76
|
+
const {
|
|
77
|
+
data,
|
|
78
|
+
} = this.props;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<FieldList config={config.get('detailFields')} data={data} />
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
renderHeader() {
|
|
86
|
+
const {
|
|
87
|
+
adjacents,
|
|
88
|
+
data,
|
|
89
|
+
params,
|
|
90
|
+
} = this.props;
|
|
91
|
+
|
|
92
|
+
const titleFormatter = config.get('detailTitle');
|
|
93
|
+
const title = titleFormatter && titleFormatter(data);
|
|
94
|
+
|
|
95
|
+
const subtitleFormatter = config.get('detailSubtitle');
|
|
96
|
+
const subtitle = subtitleFormatter && subtitleFormatter(data);
|
|
97
|
+
|
|
98
|
+
const {
|
|
99
|
+
'collectionspace_core:refName': refName,
|
|
100
|
+
} = data;
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<header>
|
|
104
|
+
<DetailNavBar params={params} prev={adjacents.prev} next={adjacents.next} />
|
|
105
|
+
{title && <h1>{title}</h1>}
|
|
106
|
+
{subtitle && <h2>{subtitle}</h2>}
|
|
107
|
+
<InstitutionIndex refName={refName} />
|
|
108
|
+
</header>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
renderImageGallery() {
|
|
113
|
+
const {
|
|
114
|
+
data,
|
|
115
|
+
} = this.props;
|
|
116
|
+
|
|
117
|
+
const referenceField = config.get('referenceField');
|
|
118
|
+
const referenceValue = data[referenceField];
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<ImageGallery referenceValue={referenceValue} />
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
renderPageTitle() {
|
|
126
|
+
const {
|
|
127
|
+
data,
|
|
128
|
+
} = this.props;
|
|
129
|
+
|
|
130
|
+
const {
|
|
131
|
+
'collectionspace_denorm:title': title,
|
|
132
|
+
} = data;
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Helmet>
|
|
136
|
+
<title>{title}</title>
|
|
137
|
+
</Helmet>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
renderInstitutions() {
|
|
142
|
+
const {
|
|
143
|
+
data,
|
|
144
|
+
params,
|
|
145
|
+
} = this.props;
|
|
146
|
+
|
|
147
|
+
const institutionsConfig = config.get('institutions');
|
|
148
|
+
|
|
149
|
+
if (!institutionsConfig) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const selectedInstitutionId = params.get('#');
|
|
154
|
+
|
|
155
|
+
const referenceField = config.get('referenceField');
|
|
156
|
+
const referenceValue = data[referenceField];
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<InstitutionSection
|
|
160
|
+
config={institutionsConfig}
|
|
161
|
+
selectedInstitutionId={selectedInstitutionId}
|
|
162
|
+
referenceValue={referenceValue}
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
renderExhibition() {
|
|
168
|
+
const {
|
|
169
|
+
data,
|
|
170
|
+
} = this.props;
|
|
171
|
+
|
|
172
|
+
const exhibition = data['collectionspace_denorm:exhibition'];
|
|
173
|
+
|
|
174
|
+
if (exhibition && exhibition.length > 0) {
|
|
175
|
+
const historyNote = data['collectionobjects_common:objectHistoryNote'];
|
|
176
|
+
const ownerConrtibutionNote = data['collectionobjects_common:ownersContributionNote'];
|
|
177
|
+
const viewerContributionNote = data['collectionobjects_common:viewersContributionNote'];
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<ExhibitionSection
|
|
181
|
+
exhibition={exhibition[0]}
|
|
182
|
+
historyNote={historyNote}
|
|
183
|
+
ownerConrtibutionNote={ownerConrtibutionNote}
|
|
184
|
+
viewerContributionNote={viewerContributionNote}
|
|
185
|
+
/>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
render() {
|
|
192
|
+
const {
|
|
193
|
+
data,
|
|
194
|
+
} = this.props;
|
|
195
|
+
|
|
196
|
+
if (!data) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<div className={styles.common}>
|
|
202
|
+
{this.renderPageTitle()}
|
|
203
|
+
{this.renderHeader()}
|
|
204
|
+
{this.renderDescription()}
|
|
205
|
+
{this.renderImageGallery()}
|
|
206
|
+
{this.renderFieldList()}
|
|
207
|
+
{this.renderInstitutions()}
|
|
208
|
+
{this.renderExhibition()}
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
DetailPanel.propTypes = propTypes;
|
|
215
|
+
DetailPanel.defaultProps = defaultProps;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { connect } from 'react-redux';
|
|
2
|
+
import DetailPanel from './DetailPanel';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
readDetail,
|
|
6
|
+
} from '../../actions/detailActions';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getDetailAdjacents,
|
|
10
|
+
getDetailData,
|
|
11
|
+
getDetailError,
|
|
12
|
+
isDetailPending,
|
|
13
|
+
} from '../../reducers';
|
|
14
|
+
|
|
15
|
+
const mapStateToProps = (state) => ({
|
|
16
|
+
adjacents: getDetailAdjacents(state),
|
|
17
|
+
data: getDetailData(state),
|
|
18
|
+
error: getDetailError(state),
|
|
19
|
+
isPending: isDetailPending(state),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const mapDispatchToProps = {
|
|
23
|
+
readDetail,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default connect(
|
|
27
|
+
mapStateToProps,
|
|
28
|
+
mapDispatchToProps,
|
|
29
|
+
)(DetailPanel);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { defineMessages, FormattedMessage } from 'react-intl';
|
|
4
|
+
import styles from '../../../styles/cspace/ExhibitionSection.css';
|
|
5
|
+
|
|
6
|
+
const propTypes = {
|
|
7
|
+
exhibition: PropTypes.shape({
|
|
8
|
+
title: PropTypes.string,
|
|
9
|
+
generalNote: PropTypes.string,
|
|
10
|
+
curatorialNote: PropTypes.string,
|
|
11
|
+
}),
|
|
12
|
+
historyNote: PropTypes.string,
|
|
13
|
+
ownerConrtibutionNote: PropTypes.string,
|
|
14
|
+
viewerContributionNote: PropTypes.string,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
exhibition: undefined,
|
|
19
|
+
historyNote: undefined,
|
|
20
|
+
ownerConrtibutionNote: undefined,
|
|
21
|
+
viewerContributionNote: undefined,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const messages = defineMessages({
|
|
25
|
+
objectStoryHeader: {
|
|
26
|
+
id: 'exhibitionSection.objectStoryHeader',
|
|
27
|
+
defaultMessage: 'Object Story',
|
|
28
|
+
},
|
|
29
|
+
donorStoryHeader: {
|
|
30
|
+
id: 'exhibitionSection.donorStoryHeader',
|
|
31
|
+
defaultMessage: 'Donor Story',
|
|
32
|
+
},
|
|
33
|
+
curatorialStoryHeader: {
|
|
34
|
+
id: 'exhibitionSection.curatorialStoryHeader',
|
|
35
|
+
defaultMessage: 'Curatorial Story',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default function ExhibitionSection(props) {
|
|
40
|
+
const {
|
|
41
|
+
exhibition,
|
|
42
|
+
historyNote,
|
|
43
|
+
viewerContributionNote,
|
|
44
|
+
ownerConrtibutionNote,
|
|
45
|
+
} = props;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={styles.common}>
|
|
49
|
+
<hr />
|
|
50
|
+
<h1>{exhibition.title}</h1>
|
|
51
|
+
<div />
|
|
52
|
+
|
|
53
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
54
|
+
<h2><FormattedMessage {...messages.objectStoryHeader} /></h2>
|
|
55
|
+
<div>{historyNote}</div>
|
|
56
|
+
|
|
57
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
58
|
+
<h2><FormattedMessage {...messages.donorStoryHeader} /></h2>
|
|
59
|
+
<div>{ownerConrtibutionNote}</div>
|
|
60
|
+
<div>{exhibition.generalNote}</div>
|
|
61
|
+
|
|
62
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
63
|
+
<h2><FormattedMessage {...messages.curatorialStoryHeader} /></h2>
|
|
64
|
+
<div>{viewerContributionNote}</div>
|
|
65
|
+
<div>{exhibition.curatorialNote}</div>
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
ExhibitionSection.propTypes = propTypes;
|
|
71
|
+
ExhibitionSection.defaultProps = defaultProps;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { FormattedMessage } from 'react-intl';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import styles from '../../../styles/cspace/FieldList.css';
|
|
6
|
+
import groupStyles from '../../../styles/cspace/FieldListGroup.css';
|
|
7
|
+
import fieldStyles from '../../../styles/cspace/FieldListField.css';
|
|
8
|
+
|
|
9
|
+
const propTypes = {
|
|
10
|
+
config: PropTypes.shape({
|
|
11
|
+
fields: PropTypes.object.isRequired,
|
|
12
|
+
groups: PropTypes.object.isRequired,
|
|
13
|
+
layout: PropTypes.object.isRequired,
|
|
14
|
+
}).isRequired,
|
|
15
|
+
data: PropTypes.shape({
|
|
16
|
+
'collectionspace_core:refName': PropTypes.string,
|
|
17
|
+
'collectionspace_denorm:title': PropTypes.string,
|
|
18
|
+
}).isRequired,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const renderField = (id, fieldConfig, data) => {
|
|
22
|
+
const {
|
|
23
|
+
className,
|
|
24
|
+
field,
|
|
25
|
+
format,
|
|
26
|
+
label,
|
|
27
|
+
messages,
|
|
28
|
+
} = fieldConfig;
|
|
29
|
+
|
|
30
|
+
const title = messages
|
|
31
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
|
+
? <FormattedMessage {...messages.label} />
|
|
33
|
+
: label;
|
|
34
|
+
|
|
35
|
+
const value = data[field];
|
|
36
|
+
const formattedValue = (format && value) ? format(value, id) : value;
|
|
37
|
+
|
|
38
|
+
if (!formattedValue) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (title) {
|
|
43
|
+
const classes = classNames(fieldStyles[className]);
|
|
44
|
+
const classProp = classes ? { className: classes } : undefined;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<React.Fragment key={id}>
|
|
48
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
49
|
+
<div {...classProp}>{title}</div>
|
|
50
|
+
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
|
|
51
|
+
<div {...classProp}>{formattedValue}</div>
|
|
52
|
+
</React.Fragment>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const classes = classNames(fieldStyles.unlabeled, fieldStyles[className]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className={classes} key={id}>
|
|
60
|
+
{formattedValue}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const renderGroup = (id, groupConfig, config, data) => {
|
|
66
|
+
const {
|
|
67
|
+
className,
|
|
68
|
+
fields,
|
|
69
|
+
label,
|
|
70
|
+
messages,
|
|
71
|
+
} = groupConfig;
|
|
72
|
+
|
|
73
|
+
const title = messages
|
|
74
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
75
|
+
? <FormattedMessage {...messages.label} />
|
|
76
|
+
: label;
|
|
77
|
+
|
|
78
|
+
const fieldsConfig = config.fields;
|
|
79
|
+
|
|
80
|
+
const renderedFields = fields
|
|
81
|
+
.map((fieldId) => renderField(fieldId, fieldsConfig[fieldId], data))
|
|
82
|
+
.filter((renderedField) => !!renderedField);
|
|
83
|
+
|
|
84
|
+
if (renderedFields.length === 0) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const classes = classNames(groupStyles.common, groupStyles[className]);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className={classes} key={id}>
|
|
92
|
+
{title && <h3>{title}</h3>}
|
|
93
|
+
<div>
|
|
94
|
+
{renderedFields}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default function FieldList(props) {
|
|
101
|
+
const {
|
|
102
|
+
config,
|
|
103
|
+
data,
|
|
104
|
+
} = props;
|
|
105
|
+
|
|
106
|
+
const {
|
|
107
|
+
groups,
|
|
108
|
+
layout,
|
|
109
|
+
} = config;
|
|
110
|
+
|
|
111
|
+
return Object.keys(layout).map((layoutId) => (
|
|
112
|
+
<div
|
|
113
|
+
className={styles.common}
|
|
114
|
+
key={layoutId}
|
|
115
|
+
style={{ gridArea: layoutId }}
|
|
116
|
+
>
|
|
117
|
+
{layout[layoutId].map((groupId) => renderGroup(groupId, groups[groupId], config, data))}
|
|
118
|
+
</div>
|
|
119
|
+
));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
FieldList.propTypes = propTypes;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styles from '../../../styles/cspace/FieldValueList.css';
|
|
4
|
+
|
|
5
|
+
const propTypes = {
|
|
6
|
+
children: PropTypes.node,
|
|
7
|
+
inline: PropTypes.bool,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const defaultProps = {
|
|
11
|
+
children: undefined,
|
|
12
|
+
inline: false,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function FieldValueList(props) {
|
|
16
|
+
const {
|
|
17
|
+
children,
|
|
18
|
+
inline,
|
|
19
|
+
} = props;
|
|
20
|
+
|
|
21
|
+
const className = inline ? styles.inline : styles.common;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<ul className={className}>
|
|
25
|
+
{children}
|
|
26
|
+
</ul>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
FieldValueList.propTypes = propTypes;
|
|
31
|
+
FieldValueList.defaultProps = defaultProps;
|