-
Notifications
You must be signed in to change notification settings - Fork 12
/
ConceptHomeDetails.jsx
81 lines (78 loc) · 3.02 KB
/
ConceptHomeDetails.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React from 'react';
import { get } from 'lodash';
import HomeMappings from './HomeMappings';
import ConceptCollections from '../common/SourceChildCollections';
import CustomAttributesAccordion from '../common/CustomAttributesAccordion';
import ResourceReferences from '../common/ResourceReferences';
import HomeLocales from './HomeLocales';
import VersionList from '../common/VersionList';
const ACCORDIAN_HEADING_STYLES = {
fontWeight: 'bold',
}
const ACCORDIAN_DETAILS_STYLES = {
overflowX: 'auto', width: '100%', padding: '0'
}
const ConceptHomeDetails = ({ concept, isLoadingMappings, isLoadingCollections, source, singleColumn, versions, scoped, sourceVersion, parent, onIncludeRetiredAssociationsToggle, onCreateNewMapping, onRemoveMapping, onReactivateMapping, mappedSources, onUpdateMappingsSorting, onAssignSortWeight, onClearSortWeight, sourceVersionSummary }) => {
const names = get(concept, 'names', [])
const descriptions = get(concept, 'descriptions', [])
let classes = 'col-sm-12 padding-5';
if(!singleColumn)
classes += ' col-md-6'
return (
<div className='row' style={{width: '100%', margin: 0}}>
<div className={classes}>
<HomeLocales
concept={concept}
locales={names}
source={source}
label='Names & Synonyms'
searchable
/>
<HomeLocales
concept={concept}
locales={descriptions}
source={source}
label='Descriptions'
isDescription
/>
<CustomAttributesAccordion
attributes={concept.extras || {}}
headingStyles={ACCORDIAN_HEADING_STYLES}
detailStyles={ACCORDIAN_DETAILS_STYLES}
/>
</div>
<div className={classes} style={{paddingTop: '10px'}}>
<HomeMappings
concept={concept}
isLoadingMappings={isLoadingMappings}
source={source}
mappedSources={mappedSources}
sourceVersion={sourceVersion}
parent={parent}
onIncludeRetiredToggle={onIncludeRetiredAssociationsToggle}
onCreateNewMapping={onCreateNewMapping}
onUpdateMappingsSorting={onUpdateMappingsSorting}
onRemoveMapping={onRemoveMapping}
onReactivateMapping={onReactivateMapping}
onAssignSortWeight={onAssignSortWeight}
onClearSortWeight={onClearSortWeight}
sourceVersionSummary={sourceVersionSummary}
/>
{
scoped === 'collection' ?
<ResourceReferences
resource='concept'
references={concept.references}
headingStyles={ACCORDIAN_HEADING_STYLES}
detailStyles={ACCORDIAN_DETAILS_STYLES}
/> :
<React.Fragment>
<ConceptCollections collectionVersions={get(concept, 'collections') || []} isLoadingCollections={isLoadingCollections} resourceType='concept' />
<VersionList versions={versions} resource='concept' />
</React.Fragment>
}
</div>
</div>
);
}
export default ConceptHomeDetails;