-
Notifications
You must be signed in to change notification settings - Fork 12
/
CollectionHomeHeader.jsx
105 lines (102 loc) · 3.95 KB
/
CollectionHomeHeader.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import React from 'react';
import {
Loyalty as LoyaltyIcon,
Public as PublicIcon,
} from '@material-ui/icons';
import { Tooltip, Chip } from '@material-ui/core';
import { includes } from 'lodash';
import { toFullAPIURL, copyURL } from '../../common/utils';
import { GREEN } from '../../common/constants';
import OwnerButton from '../common/OwnerButton';
import CollectionButton from '../common/CollectionButton';
import VersionButton from '../common/VersionButton';
import LastUpdatedOnLabel from '../common/LastUpdatedOnLabel';
import ExternalIdLabel from '../common/ExternalIdLabel';
import CustomAttributesPopup from '../common/CustomAttributesPopup';
const CollectionHomeHeader = ({
collection, isVersionedObject, versionedObjectURL, currentURL
}) => {
const isRetired = collection.isRetired;
const onIconClick = () => copyURL(toFullAPIURL(currentURL))
return (
<header className='home-header col-md-12'>
<div className='col-md-12 container' style={{paddingTop: '10px'}}>
<div className='no-side-padding col-md-1 home-icon collection'>
<Tooltip title='Copy URL'>
<LoyaltyIcon onClick={onIconClick} />
</Tooltip>
</div>
<div className='col-md-11'>
<div className='col-md-12 no-side-padding flex-vertical-center'>
<OwnerButton {...collection} href={versionedObjectURL} />
<span className='separator'>/</span>
<CollectionButton label={collection.short_code} href={`#${versionedObjectURL}`} />
{
!isVersionedObject &&
<React.Fragment>
<span className='separator'>/</span>
<VersionButton
label={collection.version} retired={isRetired} href={`#${currentURL}`}
bgColor={GREEN}
/>
</React.Fragment>
}
</div>
<div className='col-md-12 no-side-padding flex-vertical-center home-resource-full-name'>
<span style={{marginRight: '10px'}} className={isRetired ? 'retired': ''}>
{collection.full_name}
</span>
{
includes(['view', 'edit'], collection.public_access.toLowerCase()) &&
<span style={{marginTop: '-5px'}}>
<Chip label='Public' size='small' icon=<PublicIcon fontSize='inherit' /> />
</span>
}
</div>
<div className='col-md-12 no-side-padding flex-vertical-center'>
<span className='italic' style={{marginRight: '3px'}}>
Collection Type:
</span>
<span>
{collection.collection_type}
</span>
</div>
<div className='col-md-12 no-side-padding flex-vertical-center'>
<span className='italic' style={{marginRight: '3px'}}>
Custom Attributes:
</span>
<span>
<CustomAttributesPopup attributes={collection.extras} />
</span>
</div>
<div className='col-md-12 no-side-padding flex-vertical-center' style={{paddingTop: '10px'}}>
<span>
<LastUpdatedOnLabel
date={collection.updated_on}
by={collection.updated_by}
iconSize='medium'
noContainerClass
/>
</span>
<span style={{marginLeft: '10px'}}>
<LastUpdatedOnLabel
label='Created'
date={collection.created_on}
by={collection.created_by}
iconSize='medium'
noContainerClass
/>
</span>
{
collection.external_id &&
<span style={{marginLeft: '10px', marginTop: '-8px'}}>
<ExternalIdLabel externalId={collection.external_id} iconSize='medium' />
</span>
}
</div>
</div>
</div>
</header>
)
}
export default CollectionHomeHeader;