UNPKG

cluedin-widget

Version:

This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.

43 lines (33 loc) 1.19 kB
import React, { Component } from 'react' import { register } from "../../../core/registry"; import Widget from '../../../core/components/generics/widget.jsx' import ImagePreview from '../../../core/components/generics/ImagePreview.jsx'; import { connect } from 'react-redux' class EntityPreview extends Component { render() { const { isFetchingEntity, entity } = this.props; let content; let imagePreviewUrl; if( !isFetchingEntity ) { if( entity.hasPreview ) { imagePreviewUrl = entity.previewUrl; } if( !imagePreviewUrl && entity.hasLogo ) { imagePreviewUrl = entity.logoUrl; } content = (<ImagePreview previewUrl={imagePreviewUrl} alt={entity.name}></ImagePreview>); } return ( <Widget loading={isFetchingEntity} title="Image Preview"> {content} </Widget> ); } } function select( state ) { return { entity: state.entity.selectedEntity, isFetchingEntity: state.entity.isFetchingEntity }; } register( 'EntityPreview', connect( select )( EntityPreview ) );