import React from 'react';
import lbry from 'lbry';
import lbryuri from 'lbryuri';
import {Icon} from 'component/common';
const UriIndicator = (props) => {
const {
uri,
claim
} = props
const uriObj = lbryuri.parse(uri);
if (!claim) {
return Unused
}
const {
has_signature: hasSignature,
signature_is_valid: signatureIsValid
} = claim
if (!hasSignature || !uriObj.isChannel) {
return Anonymous;
}
const channelUriObj = Object.assign({}, uriObj);
delete channelUriObj.path;
delete channelUriObj.contentName;
const channelUri = lbryuri.build(channelUriObj, false);
let icon, modifier;
if (signatureIsValid) {
modifier = 'valid';
} else {
icon = 'icon-times-circle';
modifier = 'invalid';
}
return (
{channelUri} {' '}
{ !signatureIsValid ?
:
'' }
)
}
export default UriIndicator;