-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
1,615 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,4 +174,8 @@ | |
opacity: 1; | ||
} | ||
} | ||
|
||
&__icon-list { | ||
display: flex; | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
ui/app/components/app/connected-sites-list/connected-sites-list.component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import React, { Component } from 'react' | ||
import PropTypes from 'prop-types' | ||
import classnames from 'classnames' | ||
|
||
export default class ConnectedSitesList extends Component { | ||
static contextTypes = { | ||
t: PropTypes.func, | ||
} | ||
|
||
static propTypes = { | ||
disconnectAccount: PropTypes.func.isRequired, | ||
renderableDomains: PropTypes.arrayOf(PropTypes.shape({ | ||
name: PropTypes.string, | ||
icon: PropTypes.string, | ||
key: PropTypes.string, | ||
lastConnectedTime: PropTypes.string, | ||
permissionDescriptions: PropTypes.array, | ||
})).isRequired, | ||
domains: PropTypes.object.isRequired, | ||
} | ||
|
||
state = { | ||
expandedDomain: '', | ||
iconError: '', | ||
} | ||
|
||
handleDomainItemClick (domainKey) { | ||
if (this.state.expandedDomain === domainKey) { | ||
this.setState({ expandedDomain: '' }) | ||
} else { | ||
this.setState({ expandedDomain: domainKey }) | ||
} | ||
} | ||
|
||
render () { | ||
const { renderableDomains, domains, showDisconnectAccountModal } = this.props | ||
const { expandedDomain } = this.state | ||
const { t } = this.context | ||
|
||
return ( | ||
<div className="connected-sites-list"> | ||
{ | ||
renderableDomains.map((domain, domainIndex) => { | ||
const domainIsExpanded = expandedDomain === domain.key | ||
return ( | ||
<div | ||
className={classnames("connected-sites-list__domain", { | ||
'connected-sites-list__domain--expanded': domainIsExpanded, | ||
})} | ||
key={`connected-domain-${domainIndex}`} | ||
> | ||
<div className="connected-sites-list__domain-item" onClick={ () => this.handleDomainItemClick(domain.key) }> | ||
<div className="connected-sites-list__domain-item-info-container"> | ||
<div className="connected-sites-list__identicon-container"> | ||
<div className="connected-sites-list__identicon-border" /> | ||
{!this.state.iconError && domain.icon ? ( | ||
<img | ||
className="connected-sites-list__identicon" | ||
src={domain.icon} | ||
onError={() => this.setState({ iconError: true })} | ||
/> | ||
) : ( | ||
<i className="connected-sites-list__identicon--default"> | ||
{domain.name.charAt(0).toUpperCase()} | ||
</i> | ||
)} | ||
</div> | ||
<div className="connected-sites-list__domain-info"> | ||
<div className="connected-sites-list__domain-names"> | ||
<div className="connected-sites-list__domain-name"> | ||
{ domain.name } | ||
</div> | ||
<div className="connected-sites-list__domain-origin"> | ||
{ domain.key } | ||
</div> | ||
</div> | ||
<div className="connected-sites-list__domain-last-connected"> | ||
{ t('domainLastConnect', [domain.lastConnectedTime]) } | ||
</div> | ||
</div> | ||
</div> | ||
<div className="connected-sites-list__expand-arrow"> | ||
{ domainIsExpanded ? <i className="fa fa-chevron-left fa-sm" /> : <i className="fa fa-chevron-down fa-sm" /> } | ||
</div> | ||
</div> | ||
{ domainIsExpanded | ||
? <div className="connected-sites-list__permissions"> | ||
<div className="connected-sites-list__permission-list"> | ||
{ | ||
domain.permissionDescriptions.map((description, pdIndex) => { | ||
return ( | ||
<div className="connected-sites-list__permission" key={`permissionDescription-${pdIndex}`}> | ||
<i className="fa fa-check-square fa-sm" /> | ||
<div className="connected-sites-list__permission-description"> | ||
{ description } | ||
</div> | ||
</div> | ||
) | ||
}) | ||
} | ||
</div> | ||
<div | ||
className="connected-sites-list__disconnect" | ||
onClick={ () => showDisconnectAccountModal(domain.key, domains[domain.key]) } | ||
> | ||
{ t('disconnectAccount') } | ||
</div> | ||
</div> | ||
: null | ||
} | ||
</div> | ||
) | ||
}) | ||
} | ||
</div> | ||
) | ||
} | ||
} |
Oops, something went wrong.